function complain(strobject,strobject1) {
	document.all[strobject1].href = "";

	document.all[strobject].src = "image/smallhotel.gif";
	document.all[strobject].width = 100;
	document.all[strobject].height = 100;
	document.all[strobject].border = 0;
	document.all[strobject].style = "";
	}
function complain1(strobject,strobject1) {
	document.all[strobject1].href = "";

	document.all[strobject].src = "../image/smallhotel.gif";
	document.all[strobject].width = 100;
	document.all[strobject].height = 100;
	document.all[strobject].border = 0;
	document.all[strobject].style = "";
	}
function complain2(strobject,strobject1) {
	document.all[strobject1].href = "";

	document.all[strobject].src = "../../image/smallhotel.gif";
	document.all[strobject].width = 100;
	document.all[strobject].height = 100;
	document.all[strobject].border = 0;
	document.all[strobject].style = "";
	}
function DateAdd(startDate, numDays, numMonths, numYears){
	var returnDate = new Date(startDate.getTime());
	var yearsToAdd = numYears;
	var strmonth = returnDate.getMonth()	+ numMonths;
	if (strmonth > 11)	{
		yearsToAdd = Math.floor((month+1)/12);
		strmonth -= 12*yearsToAdd;
		yearsToAdd += numYears; }
	returnDate.setMonth(strmonth);
	returnDate.setFullYear(returnDate.getFullYear()	+ yearsToAdd);
	returnDate.setTime(returnDate.getTime()+60000*60*24*numDays);
	return returnDate; }

function YearAdd(startDate, numYears)
{
		return DateAdd(startDate,0,0,numYears);
}

function MonthAdd(startDate, numMonths)
{
		return DateAdd(startDate,0,numMonths,0);
}

function DayAdd(startDate, numDays)
{
		return DateAdd(startDate,numDays,0,0);
}
function show() {
	var oWait = null, oBody = null, elemWait, elemBody;
	if (document.getElementById) { // IE 5+/NS6
		elemWait = document.getElementById('waitDiv');
		if (elemWait != null) {
			oWait = elemWait.style;
		}
		elemBody = document.getElementById('bodyDiv');
		if (elemBody != null) {
			oBody = elemBody.style;
		}
	} else if (document.layers) {
		oWait = document.layers['waitDiv'];
		oBody = document.layers['bodyDiv'];
	} else if (document.all) {
		elemWait = document.all['waitDiv'];
		if (elemWait != null) {
			oWait = elemWait.style;
		}
		elemBody = document.all['bodyDiv'];
		if (elemBody != null) {
			oBody = elemBody.style;
		}
	}
	if (oWait != null) {
		oWait.visibility = 'hidden';
	}
	if (oBody != null) {
		oBody.visibility = 'visible';
	}
}

function popUp(url) {
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	self.name = "mainWin";
}

function openNewWindow(fileName,windowName,theWidth,theHeight) {
	if (windowName == "newWindow") {
		 windowName = new String(Math.round(Math.random() * 100000));
	}
	window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight)
}

function openNewWindowEscape(fileName,windowName,theWidth,theHeight,to) {
	if (windowName == "newWindow") {
		 windowName = new String(Math.round(Math.random() * 100000));
	}
	var encoded = escape(to);
	encoded = fileName + encoded;
	window.open(encoded,windowName,"toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight)
}

function openNewWindowReturnFalse(fileName,windowName,theWidth,theHeight) {
	if (windowName == "newWindow") {
		 windowName = new String(Math.round(Math.random() * 100000));
	}
	var w = window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight);
	return false;
}

function openPopup(url, to, windowName, theWidth, theHeight) {
	var newURL;
	if (isNN3 || isNN4) {
		newURL = url + to;
	} else {
		newURL = url + escape(to);
	}
	window.open(newURL,windowName,"toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight)
}

function open_calendar(strType) {
	document.myform.inout.value = strType;
	new_window=window.open("calendar.htm","","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=300,height=200");
}

function popup(url, name, width, height) {
	settings="toolbar=yes,location=yes,directories=yes,"+"status=no,menubar=no,scrollbars=yes,"+"resizable=yes,width="+width+",height="+height;
	MyNewWindow=window.open("http://"+url,name,settings);
}

function getMousePos(capEvent) {
	if (document.layers) {
		xPos=capEvent.screenX +30
		yPos=capEvent.screenY +10
	} else if (window.event) {
		xPos=window.event.clientX +30
		yPos=window.event.clientY +10
	} else {
		xPos=0
		yPos=0
	}
}
function openPopWindow(pageLocation,winName, pgW, pgH) {
	winStats='toolbar=no,location=no,directories=no,menubar=no,';
	winStats+='scrollbars=no,width=' + pgW + ',height=' + pgH ;

	if (navigator.appName.indexOf("Microsoft")>=0) {
		winStats+=',left=' + (xPos) + ',top=' + (-200 + yPos);
	} else {
		winStats+=',screenX='+ (xPos) + ',screenY=' + (yPos - 300);
	}

	floater=window.open(pageLocation,winName,winStats);
	if (floater!=null) { if (floater.focus) { floater.focus() } };
}

function openCalWindow(thisPage, strType, CalLocation) {
	document.myform.inout.value = strType;

	// Switch to JSP, this is a catch-all for old code.  Should be removed eventually
	if (thisPage=='popcal.html') { thisPage = 'popcal.jsp'; }

	thisPage = thisPage + '?' + new String(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value -1) + ',' + document.myform.CIYear.value

	if ( strType == 'out') {
		thisPage = thisPage + '?' + new String(document.myform.COMonth.value -1) + ',' + document.myform.COYear.value
	}
	winStats='toolbar=no,location=no,directories=no,menubar=no,'

	//IE/NS
	if (navigator.appName.indexOf("Microsoft")>=0) {winStats+='scrollbars=no,width=160,height=180'}
	else {winStats+='scrollbars=no,width=160,height=170'}

	//IE leftnav area
	if (navigator.appName.indexOf("Microsoft")>=0) {
			if(CalLocation == 'leftNavArea')
				{winStats+=',left=' + (xPos) + ',top=' + (yPos)
				 }//IE content area
			else if (CalLocation == 'contentArea')
				{winStats+=',left=' + (-200 + xPos) + ',top=' + (-160 + yPos)
				}
    } else {
		//Netscape leftnav area
		if(CalLocation == 'leftNavArea')
				{winStats+=',screenX='+ (xPos) + ',screenY=' + (yPos)
				 }//Netscape content area
			else if (CalLocation == 'contentArea')
				{winStats+=',screenX='+ (-150 + xPos) + ',screenY=' + (-230 + yPos)
				}
    }
	floater=window.open(thisPage,"myform",winStats)
	if (floater!=null) { if (floater.focus) { floater.focus() } };
}

function openWindow(thisPage, strType) {
	document.myform.inout.value = strType;
	thisPage = thisPage + '?' + new String(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value -1) + ',' + document.myform.CIYear.value

	if ( strType == 'out') {
		thisPage = thisPage + '?' + new String(document.myform.COMonth.value -1) + ',' + document.myform.COYear.value
	}
	winStats='toolbar=no,location=no,directories=no,menubar=no,'
	winStats+='scrollbars=no,width=160,height=140'
	if (navigator.appName.indexOf("Microsoft")>=0) {
     	  winStats+=',left=' + (xPos) + ',top=' + (yPos)
	} else {
	winStats+=',screenX='+ (xPos) + ',screenY=' + (yPos)
	}
	floater=window.open(thisPage,"myform",winStats)
	if (floater!=null) { if (floater.focus) { floater.focus() } };

}
function initializeDates()
{
	var thisdate = new Date();
	var thismonth = thisdate.getMonth();
	var thisday = thisdate.getDate();
	var thisyear = thisdate.getFullYear();

	document.myform.CIMonth.value = thismonth+1;
	document.myform.CIYear.value = thisyear;
	document.myform.CIDay.value = thisday+7;

	document.myform.COMonth.value = thismonth+1
	document.myform.COYear.value = thisyear;
	document.myform.CODay.value = thisday+7+1;
}

function doSelectOptions(theValue,theField) {
	
	var objForm = document.myform;
	for (i=0; i< objForm[theField].options.length; i++)
		if (objForm[theField].options[i].value == theValue) {
			objForm[theField].options[i].selected = true;
		}
}

function updateBothDates(theForm)
{
	var worker	= new Date();
	calcBothDates(theForm, (worker.getYear()%1900+1900), worker.getMonth()+1, worker.getDate());
}
function calcBothDates(theForm, ty, tm, td)
{
	
	var today	= new Date((ty%1900+1900), tm-1, td, 0,0,0);
	var inDate	= new Date((ty%1900+1900), parseInt(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value)-1, document.myform.CIDay[document.myform.CIDay.selectedIndex].value, 0,0,0);
	var outDate	= new Date((ty%1900+1900), parseInt(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value)-1, parseInt(document.myform.CIDay[document.myform.CIDay.selectedIndex].value)+2, 0,0,0);

	if (inDate.getTime()  < today.getTime()) { // Crossed the newyear boundary
		inDate.setYear((today.getYear()%1900+1900)+1);
		outDate.setYear((today.getYear()%1900+1900)+1);
	}

	theForm.CIYear.value	= (inDate.getYear()%1900) + 1900;
	doSelectOptions(inDate.getMonth()+1, 'CIMonth');
	doSelectOptions(inDate.getDate(), 'CIDay');
	theForm.COYear.value	= (outDate.getYear()%1900) + 1900;
	doSelectOptions(outDate.getMonth()+1, 'COMonth');
	doSelectOptions(outDate.getDate(), 'CODay');
}

function updateCIDate(theForm)
{
	var worker	= new Date();
	calcCIDate(theForm, (worker.getYear()%1900+1900), worker.getMonth()+1, worker.getDate());
}
function calcCIDate(theForm, ty, tm, td)
{
	var today	= new Date((ty%1900+1900), tm-1, td, 0,0,0);
	var inDate	= new Date((ty%1900+1900), parseInt(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value)-1, document.myform.CIDay[document.myform.CIDay.selectedIndex].value, 0,0,0);

	if (inDate.getTime()  < today.getTime()) { // Crossed the newyear boundary
		inDate. setYear((today.getYear()%1900+1900)+1);
	}

	theForm.CIYear.value	= (inDate.getYear()%1900) + 1900;
	doSelectOptions(inDate.getMonth()+1, 'CIMonth');
	doSelectOptions(inDate.getDate(), 'CIDay');
}

function updateCODate(theForm)
{
	var worker	= new Date();
	calcCODate(theForm, (worker.getYear()%1900+1900), worker.getMonth()+1, worker.getDate());
}
function calcCODate(theForm, ty, tm, td)
{
	var today	= new Date((ty%1900+1900), tm-1, td, 0,0,0);
	var outDate	= new Date((ty%1900+1900), parseInt(document.myform.COMonth[document.myform.COMonth.selectedIndex].value)-1, parseInt(document.myform.CODay[document.myform.CODay.selectedIndex].value), 0,0,0);

	if ((parseInt(theForm.CIYear.value)%1900) >(today.getYear()%1900)) {
		outDate.setYear((today.getYear()%1900+1900)+1);	// Already a year ahead for in date
	} else if (outDate.getTime() < today.getTime()) {
		outDate.setYear((today.getYear()%1900+1900)+1);	// Crossed the newyear boundary
	}

	theForm.COYear.value	= (outDate.getYear()%1900) + 1900;
	doSelectOptions(outDate.getMonth()+1, 'COMonth');
	doSelectOptions(outDate.getDate(), 'CODay');
}

function searchDebug() { alert('CIYear='+myform.CIYear.value+', COYear='+myform.COYear.value); }
function changeRezDebug() { alert('CIYear='+myform.CIYear.value+', COYear='+myform.COYear.value); }
function debugRefineLeftnav() { alert('CIYear='+myform.CIYear.value+', COYear='+myform.COYear.value); }