//deluxe
var arrPics1 = new Array("Deluxe1.jpg","Deluxe2.jpg","Deluxe3.jpg","Deluxe4.jpg","Deluxe5.jpg","Deluxe6.jpg");
//excutive
var arrPics2 = new Array("Executive1.jpg","Executive2.jpg","Executive3.jpg","Executive4.jpg","Executive5.jpg","Executive6.jpg");
//Excutive Suit
var arrPics3 = new Array("Executive_Suite1.jpg","Executive_Suite2.jpg","Executive_Suite3.jpg","Executive_Suite4.jpg");
//Superior
var arrPics4 = new Array("superior1.jpg","superior2.jpg","superior3.jpg");
//var arrPics5 = new Array();
var arrPicAll = new Array(4);

var ns = (navigator.appName.indexOf("Netscape") != -1);
var nCount = 0;
var nAll = 0;
var alpMain = 0;
var objMain;
var objDivPic;
var objPicMain;
var bLocked = false;
var beginX = 0;
var beginY = 0;
var stWidth = 0;
var stHeight = 0;
var stLeft = 0;
var stTop = 0;
var destLeft = 0;
var destTop = 0;
var durX = 0;
var durY = 0;
var nPic = 0;
var bReady = false;
var picNow;
var nPicNow = 0;
var strDir = "images/roomrates/";

function setAlpha(obj,per) {
	if (!bReady) return;
	inone = per / 100;
	if (inone >= 1) inone = 0.99;
	obj.style.opacity = inone;
	obj.style.MozOpacity = inone;
	obj.style.KhtmlOpacity = per / 100;
	obj.style.filter = "alpha(opacity=" + per + ")";
}

function fillAll(evt,n) {
	if (bLocked) return;
	obj = document.getElementById("divFilter");
	nPic = n - 1;
	setAlpha(obj,1);
	obj.style.left = obj.style.top = 0;
	obj.style.height = document.body.clientHeight + 525;
	obj.style.width = document.body.clientWidth;
	objMain = obj;
	bLocked = true;
	beginX = mouseX(evt);
	beginY = mouseY(evt);
	alphaBegin();
}

function alphaBegin() {
	alpMain = 0;
	setTimeout("alphaGo()",50);
}

function alphaGo() {
	alpMain += 10;
	if (alpMain > 70) {
		bLocked = false;
		spBegin();
		return;
	}
	setAlpha(objMain,alpMain);
	setTimeout("alphaGo()",50);
}

function spBegin() {
	objPicMain = document.getElementById("picMain");
	objDivPic = document.getElementById("divPic");
	picNow = arrPicAll[nPic][nPicNow];
	objPicMain.src = picNow.src;
	objPicMain.width = 5;
	objPicMain.height = 5;
	objDivPic.style.left = beginX;
	objDivPic.style.top = beginY;
	stLeft = stTop = stWidth = stHeight = 0;
	destLeft = document.body.clientWidth / 2 - 600 / 2;
	//destTop = document.body.clientHeight / 2 - picNow.height / 2;
	destTop = ns ? pageYOffset + 10 : document.body.scrollTop + 10;
	stLeft = beginX;
	stTop = beginY;
	if (beginX < destLeft) durX = 1;
	else if (beginX > destLeft) durX = 2;
	else durX = 0;
	if (beginY < destTop) durY = 1;
	else if (beginY > destTop) durY = 2;
	else durY = 0;
	spGo();
}

function spGo() {
	stWidth += 50;
	stHeight += 50;
	if (durX == 1) {
		stLeft += 50;
		if (stLeft >= destLeft) {
			stLeft = destLeft;
			durX = 0;
		}
	}
	else if (durX == 2) {
		stLeft -= 50;
		if (stLeft <= destLeft) {
			stLeft = destLeft;
			durX = 0;
		}
	}
	if (durY == 1) {
		stTop += 50;
		if (stTop >= destTop) {
			stTop = destTop;
			durY = 0;
		}
	}
	else if (durY == 2) {
		stTop -= 50;
		if (stTop <= destTop) {
			stTop = destTop;
			durY = 0;
		}
	}
	if (stWidth > picNow.width) stWidth = picNow.width;
	if (stHeight > picNow.height) stHeight = picNow.height;
	objPicMain.width = stWidth;
	objPicMain.height = stHeight;
	objDivPic.style.left = stLeft;
	objDivPic.style.top = stTop;
	if (stWidth == picNow.width && stHeight == picNow.height && durX == 0 && durY == 0) return;
	setTimeout("spGo()",50);
}

function closePic() {
	objDivPic.style.left = -5000;
	obj = document.getElementById("divFilter");
	obj.style.width = 5;
	obj.style.height = 5;
	obj.style.left = -1000;
	nPicNow = 0;
}

function mouseX(evt) {
	if (evt.pageX) return evt.pageX;
	else if (evt.clientX)
		return evt.clientX + (document.documentElement.scrollLeft ?
		document.documentElement.scrollLeft :
		document.body.scrollLeft);
	else return null;
}

function mouseY(evt) {
if (evt.pageY) return evt.pageY;
	else if (evt.clientY)
		return evt.clientY + (document.documentElement.scrollTop ?
		document.documentElement.scrollTop :
		document.body.scrollTop);
	else return null;
}

function slideBack() {
	nPicNow--;
	if (nPicNow < 0) nPicNow = arrPicAll[nPic].length - 1;
	picNow = arrPicAll[nPic][nPicNow];
	objPicMain.src = picNow.src;
	destLeft = document.body.clientWidth / 2 - 600 / 2;
	destTop = document.body.clientHeight / 2 - picNow.height / 2;
	objPicMain.width = picNow.width;
	objPicMain.height = picNow.height;
	objDivPic.style.left = destLeft;
	//objDivPic.style.top = destTop;
}

function slideNext() {
	nPicNow++;
	if (nPicNow >= arrPicAll[nPic].length) nPicNow = 0;
	picNow = arrPicAll[nPic][nPicNow];
	objPicMain.src = picNow.src;
	destLeft = document.body.clientWidth / 2 - 600 / 2;
	destTop = document.body.clientHeight / 2 - picNow.height / 2;
	objPicMain.width = picNow.width;
	objPicMain.height = picNow.height;
	objDivPic.style.left = destLeft;
	//objDivPic.style.top = destTop;
}

function countPic() {
	nCount++;
	if (nCount >= nAll) {
		bReady = true;
	}
}

for (nGal = 0;nGal < arrPicAll.length;nGal++) {
	nGall = nGal + 1;
	g = eval("arrPics" + nGall);
	nAll += g.length;
}

for (nGal = 1;nGal <= 4;nGal++) {
	g = eval("arrPics" + nGal);
	arrPicAll[nGal - 1] = new Array(g.length);
	for (nP = 0;nP < g.length;nP++) {
		arrPicAll[nGal - 1][nP] = new Image();
		arrPicAll[nGal - 1][nP].onload = countPic;
		arrPicAll[nGal - 1][nP].src = strDir + g[nP];
	}
}

