//Declaring Arrays for each picture rotation
////////////////////////////////////////////

//Array One
var imagesrc = new Array();
	imagesrc[0] = 'http://www.stonemountainchalet.com/images/upload/clubhouse/pic1.jpg'
	imagesrc[1] = 'http://www.stonemountainchalet.com/images/upload/clubhouse/pic2.jpg'
	imagesrc[2] = 'http://www.stonemountainchalet.com/images/upload/clubhouse/pic3.jpg'
	imagesrc[3] = 'http://www.stonemountainchalet.com/images/upload/clubhouse/pic4.jpg'
	imagesrc[4] = 'http://www.stonemountainchalet.com/images/upload/clubhouse/pic5.jpg'
	imagesrc[5] = 'http://www.stonemountainchalet.com/images/upload/clubhouse/pic6.jpg'
	imagesrc[6] = 'http://www.stonemountainchalet.com/images/upload/clubhouse/pic7.jpg'
	imagesrc[7] = 'http://www.stonemountainchalet.com/images/upload/clubhouse/pic8.jpg'
	
var imagetag = new Array();
	imagetag[0] = 'Pic 1 - Stone Mountain Chalets'
	imagetag[1] = 'Pic 2 - Lodging Near Holiday Valley Ski Resort, New York'
	imagetag[2] = 'Pic 3 - Minutes from Ellicottville, NY'
	imagetag[3] = 'Pic 4 - Custom, Upscale, Ski Rentals in western New York State'
	imagetag[4] = 'Pic 5 - Romantic, Secluded & Luxurious'
	imagetag[5] = 'Pic 6 - Check our special rates & loding packages'
	imagetag[6] = 'Pic 7 - We accommodate couples as well as LARGE groups'
	imagetag[7] = 'Pic 8 - We accommodate couples as well as LARGE groups'
	
//Declaring Variables
	var j = 0
	var p = imagesrc.length;
	var preBuffer = new Array();

	for (i = 0; i < p; i++){
	   preBuffer[i] = new Image();
	   preBuffer[i].src = imagesrc[i];
	}

	var whichPicture = Math.round(Math.random() * (p - 1));
	setTimeout("slideit()", 5000);


var image1=new Image()
	image1.src= imagesrc[0]
var image2=new Image()
	image2.src=imagesrc[1]
var image3=new Image()
	image3.src=imagesrc[2]
var image4=new Image()
	image4.src=imagesrc[3]
var image5=new Image()
	image5.src=imagesrc[4]
var image6=new Image()
	image6.src=imagesrc[5]
var image7=new Image()
	image7.src=imagesrc[6]
var image8=new Image()
	image8.src=imagesrc[7]
	
var step = 1;
var whichimage = 1;
var bln = 1;

function slideit() {
		if (!document.images) 
			return;
		if (bln == 1) {
			//If the browser is IE 4.x 
			if (document.all)  {
				var img = imagetag[step - 1];
				slide.filters.blendTrans.apply(); 
				document.images.slide.src = eval("image"+ step +".src"); 
				document.images.slide.setAttribute("alt", img);
				slide.filters.blendTrans.play(); 
				whichimage = step; 
			if (step < 8) {
				step++;}
			else {
				step = 1;}
				setTimeout("slideit()", 5500);}
			}
} 
	
function fnStop () {
	if (bln == 1) {bln = 2; document.getElementById("lnkStop").style.color = '#888888'; document.getElementById("lnkStop").style.cursor = 'none';}
}

	
function generate() {
	document.write('<table width="100%" cellpadding="0" cellspacing="0" summary="format only">');
	document.write('<tr><td valign="top">');
	document.write('<img src="'+ imagesrc[whichPicture] +'" id="slide" alt="'+imagetag[whichPicture]+'" style="filter:blendTrans(duration=2); height:300px; width:"";">');
	//document.write('<div style="padding:2px;"><a id="lnkStop" onclick="javascript:fnStop();" style="cursor:pointer; font:800 11px Verdana, Arial, Helvetica, Sans-Serif; color:#004B28;">Stop Rotation</a></div>');
	//document.write('<div align="center"><img src="/images/welcome.jpg" style="margin-top:35px;" alt="  " /></div></td>');
	document.write('</tr>');
	document.write('</table>');
}
