// Clears forms on page
function myFormClear(what) {
    for (var i=0, j=what.elements.length; i<j; i++) {
        myType = what.elements[i].type;
		//alert(myType);
        if (myType == 'checkbox' || myType == 'radio'){
            what.elements[i].checked = 0;
			//alert(what.elements[i].checked);
		}
        //if (myType == 'hidden' || myType == 'password' || myType == 'text' || myType == 'textarea')
        //    what.elements[i].value = what.elements[i].defaultValue;
        if (myType == 'select-one' || myType == 'select-multiple'){
			what.elements[i].selectedIndex = 0;
            //alert(what.elements[i].selectedIndex);
		}
			//for (var k=0, l=what.elements[i].options.length; k<l; k++)
            //   what.elements[i].options[k].selected = what.elements[i].options[0].selected;
    }
}


function jumpPage() {

    var Current = document.Navigation.Page.selectedIndex;



    if( document.Navigation.Page.options[Current].value ){

        window.location.href=document.Navigation.Page.options[Current].value;

    }

    else {

        return false;

    }

}



function MM_openBrWindow(theURL,winName,features) { //v3.0 fixes URLchopping
  var myLocation = location.href;
  //alert("Location" + myLocation);
  var newLoc;

  newLoc = theURL + "?REFERER=" + escape(myLocation);

  //alert("newLoc" + newLoc);
  window.open(newLoc,winName,features);
}



function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}


function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}

// Check browser version

var isNav4 = false, isNav5 = false, isIE4 = false

var strSeperator = "/"; 

// If you are using any Java validation on the back side you will want to use the / because 

// Java date validations do not recognize the dash as a valid date separator.

var vDateType = 3; // Global value for type of date format

//                1 = mm/dd/yyyy

//                2 = yyyy/dd/mm  (Unable to do date check at this time)

//                3 = dd/mm/yyyy

var vYearType = 4; //Set to 2 or 4 for number of digits in the year for Netscape

var vYearLength = 2; // Set to 4 if you want to force the user to enter 4 digits for the year before validating.

var err = 0; // Set the error code to a default of zero

if(navigator.appName == "Netscape") {

if (navigator.appVersion < "5") {

isNav4 = true;

isNav5 = false;

}

else

if (navigator.appVersion > "4") {

isNav4 = false;

isNav5 = true;

   }

}

else {

isIE4 = true;

}

function DateFormat(vDateName, vDateValue, e, dateCheck, dateType) {

vDateType = dateType;

// vDateName = object name

// vDateValue = value in the field being checked

// e = event

// dateCheck 

// True  = Verify that the vDateValue is a valid date

// False = Format values being entered into vDateValue only

// vDateType

// 1 = mm/dd/yyyy

// 2 = yyyy/mm/dd

// 3 = dd/mm/yyyy

//Enter a tilde sign for the first number and you can check the variable information.

if (vDateValue == "~") {

alert("AppVersion = "+navigator.appVersion+" \nNav. 4 Version = "+isNav4+" \nNav. 5 Version = "+isNav5+" \nIE Version = "+isIE4+" \nYear Type = "+vYearType+" \nDate Type = "+vDateType+" \nSeparator = "+strSeperator);

vDateName.value = "";

vDateName.focus();

return true;

}

var whichCode = (window.Event) ? e.which : e.keyCode;

// Check to see if a seperator is already present.

// bypass the date if a seperator is present and the length greater than 8

if (vDateValue.length > 8 && isNav4) {

if ((vDateValue.indexOf("-") >= 1) || (vDateValue.indexOf("/") >= 1))

return true;

}

//Eliminate all the ASCII codes that are not valid

var alphaCheck = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/-";

if (alphaCheck.indexOf(vDateValue) >= 1) {

if (isNav4) {

vDateName.value = "";

vDateName.focus();

vDateName.select();

return false;

}

else {

vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));

return false;

   }

}

if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value

return false;

else {

//Create numeric string values for 0123456789/

//The codes provided include both keyboard and keypad values

var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';

if (strCheck.indexOf(whichCode) != -1) {

if (isNav4) {

if (((vDateValue.length < 6 && dateCheck) || (vDateValue.length == 7 && dateCheck)) && (vDateValue.length >=1)) {

alert("Invalid Date\nPlease Re-Enter");

vDateName.value = "";

vDateName.focus();

vDateName.select();

return false;

}

if (vDateValue.length == 6 && dateCheck) {

var mDay = vDateName.value.substr(2,2);

var mMonth = vDateName.value.substr(0,2);

var mYear = vDateName.value.substr(4,4)

//Turn a two digit year into a 4 digit year

if (mYear.length == 2 && vYearType == 4) {

var mToday = new Date();

//If the year is greater than 30 years from now use 19, otherwise use 20

var checkYear = mToday.getFullYear() + 30; 

var mCheckYear = '20' + mYear;

if (mCheckYear >= checkYear)

mYear = '19' + mYear;

else

mYear = '20' + mYear;

}

var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;

if (!dateValid(vDateValueCheck)) {

alert("Invalid Date\nPlease Re-Enter");

vDateName.value = "";

vDateName.focus();

vDateName.select();

return false;

}

return true;

}

else {

// Reformat the date for validation and set date type to a 1

if (vDateValue.length >= 8  && dateCheck) {

if (vDateType == 1) // mmddyyyy

{

var mDay = vDateName.value.substr(2,2);

var mMonth = vDateName.value.substr(0,2);

var mYear = vDateName.value.substr(4,4)

vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;

}

if (vDateType == 2) // yyyymmdd

{

var mYear = vDateName.value.substr(0,4)

var mMonth = vDateName.value.substr(4,2);

var mDay = vDateName.value.substr(6,2);

vDateName.value = mYear+strSeperator+mMonth+strSeperator+mDay;

}

if (vDateType == 3) // ddmmyyyy

{

var mMonth = vDateName.value.substr(2,2);

var mDay = vDateName.value.substr(0,2);

var mYear = vDateName.value.substr(4,4)

vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;

}

//Create a temporary variable for storing the DateType and change

//the DateType to a 1 for validation.

var vDateTypeTemp = vDateType;

vDateType = 1;

var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;

if (!dateValid(vDateValueCheck)) {

alert("Invalid Date\nPlease Re-Enter");

vDateType = vDateTypeTemp;

vDateName.value = "";

vDateName.focus();

vDateName.select();

return false;

}

vDateType = vDateTypeTemp;

return true;

}

else {

if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {

alert("Invalid Date\nPlease Re-Enter");

vDateName.value = "";

vDateName.focus();

vDateName.select();

return false;

         }

      }

   }

}

else {

// Non isNav Check

if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {

alert("Invalid Date\nPlease Re-Enter");

vDateName.value = "";

vDateName.focus();

return true;

}

// Reformat date to format that can be validated. mm/dd/yyyy

if (vDateValue.length >= 8 && dateCheck) {

// Additional date formats can be entered here and parsed out to

// a valid date format that the validation routine will recognize.

if (vDateType == 1) // mm/dd/yyyy

{

var mMonth = vDateName.value.substr(0,2);

var mDay = vDateName.value.substr(3,2);

var mYear = vDateName.value.substr(6,4)

}

if (vDateType == 2) // yyyy/mm/dd

{

var mYear = vDateName.value.substr(0,4)

var mMonth = vDateName.value.substr(5,2);

var mDay = vDateName.value.substr(8,2);

}

if (vDateType == 3) // dd/mm/yyyy

{

var mDay = vDateName.value.substr(0,2);

var mMonth = vDateName.value.substr(3,2);

var mYear = vDateName.value.substr(6,4)

}

if (vYearLength == 4) {

if (mYear.length < 4) {

alert("Invalid Date\nPlease Re-Enter");

vDateName.value = "";

vDateName.focus();

return true;

   }

}

// Create temp. variable for storing the current vDateType

var vDateTypeTemp = vDateType;

// Change vDateType to a 1 for standard date format for validation

// Type will be changed back when validation is completed.

vDateType = 1;

// Store reformatted date to new variable for validation.

var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;

if (mYear.length == 2 && vYearType == 4 && dateCheck) {

//Turn a two digit year into a 4 digit year

var mToday = new Date();

//If the year is greater than 30 years from now use 19, otherwise use 20

var checkYear = mToday.getFullYear() + 30; 

var mCheckYear = '20' + mYear;

if (mCheckYear >= checkYear)

mYear = '19' + mYear;

else

mYear = '20' + mYear;

vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;

// Store the new value back to the field.  This function will

// not work with date type of 2 since the year is entered first.

if (vDateTypeTemp == 1) // mm/dd/yyyy

vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;

if (vDateTypeTemp == 3) // dd/mm/yyyy

vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;

} 

if (!dateValid(vDateValueCheck)) {

alert("Invalid Date\nPlease Re-Enter");

vDateType = vDateTypeTemp;

vDateName.value = "";

vDateName.focus();

return true;

}

vDateType = vDateTypeTemp;

return true;

}

else {

if (vDateType == 1) {

if (vDateValue.length == 2) {

vDateName.value = vDateValue+strSeperator;

}

if (vDateValue.length == 5) {

vDateName.value = vDateValue+strSeperator;

   }

}

if (vDateType == 2) {

if (vDateValue.length == 4) {

vDateName.value = vDateValue+strSeperator;

}

if (vDateValue.length == 7) {

vDateName.value = vDateValue+strSeperator;

   }

} 

if (vDateType == 3) {

if (vDateValue.length == 2) {

vDateName.value = vDateValue+strSeperator;

}

if (vDateValue.length == 5) {

vDateName.value = vDateValue+strSeperator;

   }

}

return true;

   }

}

if (vDateValue.length == 10&& dateCheck) {

if (!dateValid(vDateName)) {

// Un-comment the next line of code for debugging the dateValid() function error messages

//alert(err);  

alert("Invalid Date\nPlease Re-Enter");

vDateName.focus();

vDateName.select();

   }

}

return false;

}

else {

// If the value is not in the string return the string minus the last

// key entered.

if (isNav4) {

vDateName.value = "";

vDateName.focus();

vDateName.select();

return false;

}

else

{

vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));

return false;

         }

      }

   }

}

function dateValid(objName) {

var strDate;

var strDateArray;

var strDay;

var strMonth;

var strYear;

var intday;

var intMonth;

var intYear;

var booFound = false;

var datefield = objName;

var strSeparatorArray = new Array("-"," ","/",".");

var intElementNr;

// var err = 0;

var strMonthArray = new Array(12);

strMonthArray[0] = "Jan";

strMonthArray[1] = "Feb";

strMonthArray[2] = "Mar";

strMonthArray[3] = "Apr";

strMonthArray[4] = "May";

strMonthArray[5] = "Jun";

strMonthArray[6] = "Jul";

strMonthArray[7] = "Aug";

strMonthArray[8] = "Sep";

strMonthArray[9] = "Oct";

strMonthArray[10] = "Nov";

strMonthArray[11] = "Dec";

//strDate = datefield.value;

strDate = objName;

if (strDate.length < 1) {

return true;

}

for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {

if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {

strDateArray = strDate.split(strSeparatorArray[intElementNr]);

if (strDateArray.length != 3) {

err = 1;

return false;

}

else {

strDay = strDateArray[0];

strMonth = strDateArray[1];

strYear = strDateArray[2];

}

booFound = true;

   }

}

if (booFound == false) {

if (strDate.length>5) {

strDay = strDate.substr(0, 2);

strMonth = strDate.substr(2, 2);

strYear = strDate.substr(4);

   }

}

//Adjustment for short years entered

if (strYear.length == 2) {

strYear = '20' + strYear;

}

strTemp = strDay;

strDay = strMonth;

strMonth = strTemp;

intday = parseInt(strDay, 10);

if (isNaN(intday)) {

err = 2;

return false;

}

intMonth = parseInt(strMonth, 10);

if (isNaN(intMonth)) {

for (i = 0;i<12;i++) {

if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {

intMonth = i+1;

strMonth = strMonthArray[i];

i = 12;

   }

}

if (isNaN(intMonth)) {

err = 3;

return false;

   }

}

intYear = parseInt(strYear, 10);

if (isNaN(intYear)) {

err = 4;

return false;

}

if (intMonth>12 || intMonth<1) {

err = 5;

return false;

}

if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {

err = 6;

return false;

}

if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {

err = 7;

return false;

}

if (intMonth == 2) {

if (intday < 1) {

err = 8;

return false;

}

if (LeapYear(intYear) == true) {

if (intday > 29) {

err = 9;

return false;

   }

}

else {

if (intday > 28) {

err = 10;

return false;

      }

   }

}

return true;

}

function LeapYear(intYear) {

if (intYear % 100 == 0) {

if (intYear % 400 == 0) { return true; }

}

else {

if ((intYear % 4) == 0) { return true; }

}

return false;

}



function show(name,src) {

    if (document.images)

        document.images[name].src = src;

}



// FOR QUERY.HTML



function makeArray() {

    this[0] = makeArray.arguments.length;

    for (i = 0; i<makeArray.arguments.length; i++)

        this[i+1] = makeArray.arguments[i];

}



var accumulate    = new makeArray(  0, 31, 59, 90,120,151,181,212,243,273,304,334);

var accumulateLY  = new makeArray(  0, 31, 60, 91,121,152,182,213,244,274,305,335);



function LeapYear(year) {

    if ((year/4)   != Math.floor(year/4))   return false;

    if ((year/100) != Math.floor(year/100)) return true;

    if ((year/400) != Math.floor(year/400)) return false;

    return true;

}



function getJulian(day,month,year) {

    if (LeapYear(year))

        return (day + accumulateLY[month]);

    else

        return (day + accumulate[month]);

}



function numberOfDays(month,year) {

	var numDays=new Array(0,31,28,31,30,31,30,31,31,30,31,30,31)

	n = numDays[month]

	if(month == 02 && year % 4 == 0) ++n

	return n

}


// Following 2 functions are to determine the number of nights staying on query pg.

// Following 3 functions are to determine the number of nights staying on query pg.

function y2k(number) { return (number < 1000) ? number + 1900 : number; }

function daysElapsed(object) {
	var arrMonth = object.ArrMonth.selectedIndex - 1;
	var arrDay = object.ArrDay.selectedIndex;
	var arrYearSelect = object.ArrYear.selectedIndex;
	var arrYear = object.ArrYear.options[arrYearSelect].text;

	var depMonth = object.DepMonth.selectedIndex - 1;
	var depDay = object.DepDay.selectedIndex;
	var depYearSelect = object.DepYear.selectedIndex;
	var depYear = object.DepYear.options[depYearSelect].text;

	var date2 = new Date(arrYear,arrMonth,arrDay);
	var date1 = new Date(depYear,depMonth,depDay);

    var difference =
        Date.UTC(y2k(date1.getYear()),date1.getMonth(),date1.getDate(),0,0,0)
      - Date.UTC(y2k(date2.getYear()),date2.getMonth(),date2.getDate(),0,0,0);
    //return difference/1000/60/60/24;
	
	var nights = difference/1000/60/60/24;

	if(isNaN(nights)){
		nights = 0;
	}

	object.nights.value = nights;
}

function addDays(object) {
	var arrMonth = object.ArrMonth.selectedIndex - 1;
	var arrDay = object.ArrDay.selectedIndex;
	var arrYearSelect = object.ArrYear.selectedIndex;
	var arrYear = object.ArrYear.options[arrYearSelect].text;
	var myDate = new Date(arrYear,arrMonth,arrDay);
	days = object.nights.value;
	newDepDate = new Date(myDate.getTime() + days*24*60*60*1000);
	newDepYear = newDepDate.getYear();
	newDepMonth = newDepDate.getMonth()+1;
	newDepDay = newDepDate.getDate();
	object.DepMonth.selectedIndex = newDepMonth;
	object.DepDay.selectedIndex = newDepDay;
	object.DepYear.options[object.DepYear.selectedIndex].text = newDepYear;
    //alert(newDepMonth+"/"+newDepDay+"/"+newDepYear);
}



function onChangeArr(object,inYear,arrControl) {
	// Month
	if(arrControl == 1){
    	var Current = object.ArrMonth.selectedIndex
	    var currentID = object.ArrMonth.options[Current].text
	    var currentValue = object.ArrMonth.options[Current].value


		totalDays = numberOfDays(currentValue,inYear)

		dcount = 1



		while (dcount <= totalDays){
	
		object.ArrDay.options[dcount] = new Option()

	    object.ArrDay.options[dcount].text = dcount
	
	    object.ArrDay.options[dcount].value = dcount

		++dcount

		}

		var stopDay = totalDays + 1
	
		while( object.ArrDay.options[stopDay] ){  

      		object.ArrDay.options[stopDay] = null;

		}

		object.DepMonth.selectedIndex = Current

	

	 	totalDays = numberOfDays(currentValue,inYear)

		dcount = 1

	 	while (dcount <= totalDays){

	 	object.DepDay.options[dcount] = new Option()

     	object.DepDay.options[dcount].text = dcount
     	object.DepDay.options[dcount].value = dcount

	 	++dcount

		}

	 	var stopDay = totalDays + 1

	 	while( object.DepDay.options[stopDay] ){  

        object.DepDay.options[stopDay] = null;

		}
	}

	// Day
	if(arrControl == 2){
		var Current = object.ArrDay.selectedIndex
		object.DepDay.selectedIndex = Current
	}

	// Year
	if(arrControl == 3){
		var Current = object.ArrYear.selectedIndex
		object.DepYear.selectedIndex = Current
	}



	daysElapsed(object);


}



function onChangeDep(object,inYear) {

    var Current = object.DepMonth.selectedIndex

    var currentID = object.DepMonth.options[Current].text

    var currentValue = object.DepMonth.options[Current].value

	

	totalDays = numberOfDays(currentValue,inYear)

	dcount = 1



	while (dcount <= totalDays){

	object.DepDay.options[dcount] = new Option()

    object.DepDay.options[dcount].text = dcount

    object.DepDay.options[dcount].value = dcount

	++dcount

	}

	var stopDay = totalDays + 1

	while( object.DepDay.options[stopDay] ){  

           		object.DepDay.options[stopDay] = null;

		}



	daysElapsed(object);



}



// function onChangeArrDay(object) {

//	object.DepDay.selectedIndex = object.ArrDay.selectedIndex + 2

// }



function onChangeArrYear(object) {

	object.DepYear.selectedIndex = object.ArrYear.selectedIndex

}


function checkCriteria(object,CritNum){
	var checkedCount = 0;
	var lastValue = "";
	for (var i=0;i<object.elements.length;i++) {
		
		currentValue = object.elements[i].name.substring(0,3);
		
		if (object.elements[i].checked == true && currentValue != lastValue ){
			lastValue = object.elements[i].name.substring(0,3);
			checkedCount++;
		}

		//alert("Element: "+i+" value: "+object.elements[i].value+" Name:"+object.elements[i].name);
		
		//lastValue = currentValue;
	}
	
	checkedCount = checkedCount - 1;

	//alert("Checked = " + checkedCount + "Required Checked = " + CritNum);
	
	if(checkedCount >= (CritNum-1)){
		return true;
	}else{
		return false;
	}

}



function dateCheck(object,inYear,inMonth,inDay,selectCritNum) {
	
	// Following is customization to force user to select a certain number of criteria. The number is defined in the OLConfig - CR 2/11/03
	if(selectCritNum){
		if (checkCriteria(object,selectCritNum)){
    	    //alert("We have a WINNER");
	    }else{
	        alert("Please select a choice from two or more categories, then press search.");
			return false;
		}
	}

	// END MODIFICATION
	

	var arrMonth = object.ArrMonth.selectedIndex
	var arrDay = object.ArrDay.selectedIndex
	var arrYearSelect = object.ArrYear.selectedIndex
	if (arrYearSelect != 0 || arrMonth != 0 || arrDay != 0) {
		
		var arrYear = object.ArrYear.options[arrYearSelect].text;
		var arrToJulian = getJulian(arrDay,arrMonth,arrYear)
		var todaysDate = getJulian(inDay,inMonth,inYear)

		var depMonth = object.DepMonth.selectedIndex
		var depDay = object.DepDay.selectedIndex
		if (object.DepYear.selectedIndex != 0){
			var depYearSelect = object.DepYear.selectedIndex
			var depYear = object.DepYear.options[depYearSelect].text;
		}else{
			var depYear = 0
		}	
		
		// alert("Arrival: "+arrYear+" "+arrMonth+" "+arrDay+"\nDepart: "+depYear+" "+depMonth+" "+depDay );
		
		// Check that all fields have a value
		if (arrYearSelect <= 0 || arrMonth <= 0 || arrDay <= 0){
			alert ("You have entered an incorrect ARRIVAL DATE!\nPlease check that you have entered a correct month, day and year.")
			return false;
		}
		
	 	if (inYear == arrYear && arrToJulian < todaysDate){
			alert ("You have entered an incorrect Arrival Date! The arrival date chosen is before today's date.")
				return false
		}
			
		if (depMonth <= 0 || depDay <= 0 || depYear <= 0 ){
			alert ("You have entered an incorrect departure date.\nPlease check that you have entered a correct month, day and year.");
			return false
		}
		var depToJulian = getJulian(depDay,depMonth,depYear)
		
		if (arrYear > depYear){
				alert ("You must select a departure date that is after your arrival date!")
				return false
		}

		if (arrYear == depYear){
			if(arrToJulian >= depToJulian){
				alert ("You must select a departure date that is after your arrival date!")
				return false
			}
			/* Turned off for C21T
			if ( (depToJulian-arrToJulian) > 18){
				alert ("For stays longer then 18 days please contact our office by phone")
				return false
			}
						
			if ( (depToJulian-arrToJulian) < 2){
				alert ("A Minimum of 2 nights stay is required!")
				return false
			}
			*/
		}
		if (arrYear < depYear){
			depToJulian = depToJulian + 365

			if(arrToJulian > depToJulian){
				alert ("You must select a departure date that is after your arrival date!")
				return false
			}

			/* Turned off for C21T
			if ( (depToJulian-arrToJulian) > 18){
				alert ("For stays longer then 18 days please contact our office by phone")
				return false
			}
			
			if ( (depToJulian-arrToJulian) < 2){
				alert ("A Minimum of 2 nights stay is required!")
				return false
			}
			*/
		}			

	return true
 // alert ("Month:" + arrMonth + "Day:" + arrDay + "Year:" + arrYear + "ArrJulian:" + arrToJulian + "\nMonth:" + depMonth + "Day:" + depDay + "Year:" + depYear + "DepJulian:" + depToJulian);
	}else{
		
		var depMonth = object.DepMonth.selectedIndex
		var depDay = object.DepDay.selectedIndex
		var depYearSelect = object.DepYear.selectedIndex
		

		if (depYearSelect != 0 || depMonth != 0 || depDay != 0) {
			alert ("You have entered a departure date but have not entered a correct arrival date.\nPlease reenter your arrival date.")

			return false

		}


	}
}



// FOR ANY POPUP WINDOWS



function popUp(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}



// FOR EXTRANET SECURITY WHEN LOGGING OUT

function go(url) {

//	alert("theurl" + url);
    if (document.images)
		location.replace(url);
    else
        location.href = url;

	var username = "logout";
	var password = "NONE";
	var server = url;
	if (username && password && server) {
		var htsite = "http://" + username + ":" + password + "@" + server;
		window.location = htsite;
	}
	else {
		alert("Problem logging out!");
   }



}

// FOR EXTRANET TO PASS INFO INTO HTACCESS
function Login(form) {
	var username = form.username.value;
	var password = form.password.value;
	var server = form.server.value;
	if (username && password && server) {
		var htsite = "http://" + username + ":" + password + "@" + server + "?UserName=" + username + "-" + password;
		window.location = htsite;
	}
	else {
		alert("Please enter a correct username and password.");
   }
}
// For reservation propcess 2/12/03 CR

function checkAgreement(object){
	//for (var i=0;i<object.elements.length;i++) {

	//alert("Element: "+i+" value: "+object.elements[i].value+" Name:"+object.elements[i].name);

		if (object.elements[21].checked != true && object.elements[22].checked != true){
			alert("Please check whether you accept this agreement or not.")
			return false;
		}
    
		if (object.elements[22].checked){
			//alert ("checked value:"+object.elements[17].value)
			if(confirm("You have chosen not to agree to the terms listed.\nIf this is correct press OK and you will be taken to our property search page.")){
				location.href="query.html";
				return false;
			}else{ return false }
		}
	//}

}

//for image viewer slide show

myCount = 0;

function UpdateCounter( currentCount )
{
	myCount = currentCount;
}

function loadImgArray( strList ){
	myImgList = strList.split(",");
}
function NextSlideShow( maxCount ){
	if(myCount >= maxCount){
		myCount = 0;
	}else{
		myCount++;
	}
	//alert( myImgList[myCount] );
	show('MainPhoto',myImgList[myCount]);
}
function PrevSlideShow( maxCount ){
	if(myCount <= 0){
		myCount = maxCount;
	}else{
		myCount--;
	}
	//alert( myImgList[myCount] );
	show('MainPhoto',myImgList[myCount]);
}
//calendar
function update_calendar_form(DDval,MMval,YYval)
{
        document.frmRes.day.selectedIndex = DDval;
        document.frmRes.month.selectedIndex = MMval;
        document.frmRes.year.selectedIndex = YYval;
}


