var bannerImg1 = new Array();
bannerImg1[0]="images/about-faq-raves-connect/about1.jpg";
bannerImg1[1]="images/about-faq-raves-connect/about2.jpg";
bannerImg1[2]="images/about-faq-raves-connect/about3.jpg";

var newBanner1 = 0;
var totalBan1 = bannerImg1.length;

function suziq(direction) {

	if (direction == 'right') {
		newBanner1++;
		if (newBanner1 == totalBan1) {
			newBanner1 = 0;
		}
		$("#first").fadeOut(300, function(){ document.banner4.src=bannerImg1[newBanner1]; });
		$("#first").fadeIn(300);
	}
	else {
		if (newBanner1 == 0) {
			newBanner1 = totalBan1-1;
		}
		else {
			newBanner1--;
		}
		$("#first").fadeOut(300, function(){ document.banner4.src=bannerImg1[newBanner1]; });
		$("#first").fadeIn(300);
	}
}

var bannerImg2 = new Array();
bannerImg2[0]="images/about-faq-raves-connect/faq1.jpg";
bannerImg2[1]="images/about-faq-raves-connect/faq2.jpg";
bannerImg2[2]="images/about-faq-raves-connect/faq3.jpg";
bannerImg2[3]="images/about-faq-raves-connect/faq4.jpg";
bannerImg2[4]="images/about-faq-raves-connect/faq5.jpg";

var newBanner2 = 0;
var totalBan2 = bannerImg2.length;

function faqs(direction) {
	if (direction == 'right') {
		newBanner2++;
		if (newBanner2 == totalBan2) {
			newBanner2 = 0;
		}
		$("#first").fadeOut(300, function(){ document.banner4.src=bannerImg2[newBanner2]; });
		$("#first").fadeIn(300);
	}
	else {
		if (newBanner2 == 0) {
			newBanner2 = totalBan2-1;
		}
		else {
			newBanner2--;
		}
		$("#first").fadeOut(300, function(){ document.banner4.src=bannerImg2[newBanner2]; });
		$("#first").fadeIn(300);
	}
}

var bannerImg3 = new Array();
bannerImg3[0]="images/about-faq-raves-connect/raves1.jpg";
bannerImg3[1]="images/about-faq-raves-connect/raves2.jpg";
bannerImg3[2]="images/about-faq-raves-connect/raves3.jpg";
bannerImg3[3]="images/about-faq-raves-connect/raves4.jpg";
bannerImg3[4]="images/about-faq-raves-connect/raves5.jpg";
bannerImg3[5]="images/about-faq-raves-connect/raves6.jpg";

var newBanner3 = 0;
var totalBan3 = bannerImg3.length;

function raves(direction) {
	if (direction == 'right') {
		newBanner3++;
		if (newBanner3 == totalBan3) {
			newBanner3 = 0;
		}
		$("#first").fadeOut(300, function(){ document.banner4.src=bannerImg3[newBanner3]; });
		$("#first").fadeIn(300);
	}
	else {
		if (newBanner3 == 0) {
			newBanner3 = totalBan3-1;
		}
		else {
			newBanner3--;
		}
		$("#first").fadeOut(300, function(){ document.banner4.src=bannerImg3[newBanner3]; });
		$("#first").fadeIn(300);
	}
}


var newHotelito = 0;
var totalHotelito = hotelitoImgs.length;

function cyclePageImgs(direction, entrypoint, pageid) {

	// Use Ajax to get the rest of the images preloaded into the browser
	if (newHotelito==0) {
		if (pageid=='hotelito')
			setTimeout("getMoreImages('hotelito')", 750);
		else if (pageid=='ladybird')
			setTimeout("getMoreImages('ladybird')", 750);
		else if (pageid=='pasadena')
			setTimeout("getMoreImages('pasadena')", 750);
		else if (pageid=='stcecilia')
			setTimeout("getMoreImages('stcecilia')", 750);
		else if (pageid=='favorites')
			setTimeout("getMoreImages('favorites')", 750);
		else if (pageid=='one+one')
			setTimeout("getMoreImages('engaged')", 750);
		else if (pageid=='coffee')
			setTimeout("getMoreImages('coffee')", 750);
		else		// this is for published
			setTimeout("getMoreImages('published')", 750);
	}


	if (entrypoint=='manual') {
		document.onImage.src="images/on.png";
		document.offImage.src="images/off_rollover.png";
		if (imageCycle==1) {
			clearTimeout(sy);
			imageCycle = 0;
		}
	}
	if (imageCycle==1) {
		sy = setTimeout("cyclePageImgs('right')", 3500);
	}

	if (direction == 'right') {
		newHotelito++;
		if (newHotelito == totalHotelito) {
			newHotelito = 0;
		}
		$("#first").fadeOut(300, function(){ document.banner5.src=hotelitoImgs[newHotelito]; });
		$("#first").fadeIn(300);
	}
	else {
		if (newHotelito == 0) {
			newHotelito = totalHotelito-1;
		}
		else {
			newHotelito--;
		}
		$("#first").fadeOut(300, function(){ document.banner5.src=hotelitoImgs[newHotelito]; });
		$("#first").fadeIn(300);
	}

	var units = 0;
	var tens = 0;
	units=(newHotelito+1)%10;
	if ((newHotelito+1) > 9) {
		tens=(newHotelito+1)/10;
		tens=Math.floor(tens);
	}
	// document.getElementById("some_element").innerHTML = "value = " + tens + " " + units;

	if (units==1) {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/one.png"; });
		$("#unitsplace").fadeIn(300);
	}
	else if (units==2) {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/two.png"; });
		$("#unitsplace").fadeIn(300);
	}
	else if (units==3) {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/three.png"; });
		$("#unitsplace").fadeIn(300);
	}
	else if (units==4) {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/four.png"; });
		$("#unitsplace").fadeIn(300);
	}
	else if (units==5) {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/five.png"; });
		$("#unitsplace").fadeIn(300);
	}
	else if (units==6) {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/six.png"; });
		$("#unitsplace").fadeIn(300);
	}
	else if (units==7) {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/seven.png"; });
		$("#unitsplace").fadeIn(300);
	}
	else if (units==8) {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/eight.png"; });
		$("#unitsplace").fadeIn(300);
	}
	else if (units==9) {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/nine.png"; });
		$("#unitsplace").fadeIn(300);
	}
	else {
		$("#unitsplace").fadeOut(300, function(){ document.units.src="images/zero.png"; });
		$("#unitsplace").fadeIn(300);
	}

	if (tens!=0) {
		document.getElementById('tensposition').style.width = "2.08%";
		document.getElementById('spacerwidth').style.width = "25.05%";
	}

	if (tens==1) {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/one.png"; });
		$("#tensplace").fadeIn(300);
	}
	else if (tens==2) {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/two.png"; });
		$("#tensplace").fadeIn(300);
	}
	else if (tens==3) {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/three.png"; });
		$("#tensplace").fadeIn(300);
	}
	else if (tens==4) {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/four.png"; });
		$("#tensplace").fadeIn(300);
	}
	else if (tens==5) {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/five.png"; });
		$("#tensplace").fadeIn(300);
	}
	else if (tens==6) {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/six.png"; });
		$("#tensplace").fadeIn(300);
	}
	else if (tens==7) {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/seven.png"; });
		$("#tensplace").fadeIn(300);
	}
	else if (tens==8) {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/eight.png"; });
		$("#tensplace").fadeIn(300);
	}
	else if (tens==9) {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/nine.png"; });
		$("#tensplace").fadeIn(300);
	}
	else {
		$("#tensplace").fadeOut(300, function(){ document.tens.src="images/blanknumber.png"; });
		$("#tensplace").fadeIn(300);
		document.getElementById('tensposition').style.width = ".08%";
		document.getElementById('spacerwidth').style.width = "27.05%";
	}
}

function getMoreImages(page) {
	// Start background preload for remainder of the images
	getData(page, newHotelito);
}



