
//====THIS FUNCTION CHECKS THE CITY BOX AND SUBMITS THE FORM TO HOTAVAIL FOR GENERAL AVAIL LIST

 function submitForm(){
	var formnogood = false;
	var mycity = document.hotavailbox.city.value;
	var intVal = mycity.length;
	var stateVal = document.hotavailbox.stateProvince[document.hotavailbox.stateProvince.selectedIndex].value;
	var mycountry = document.hotavailbox.country[document.hotavailbox.country.selectedIndex].value;
	if ((mycity == '') || (mycity == null) || (intVal < 3)){
	alert ('Please enter the city.');
	formnogood = true;
		}
		else
	if ((stateVal = "")){
	alert(stateVal);
	alert('Please select a State/Province.');
	formnogood = true;
	}
		if (formnogood == true){
		return false;
			}
		else
		{
		document.hotavailbox.submit();
		}
}


//========pop up windows-----

function info(page, describe){
secondWindow=window.open(page,"Show_image","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=400,height=400,top=100,left=100");
secondWindow.focus();
}

function popHTU(){
	newwin = window.open("http://www.hotel-and-discount.com/popInfo/HTU.html", "newwin", "toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=300")
	}

function popspecial(){
	newwin = window.open("http://www.hotel-and-discount.com/popInfo/special.html", "newwin", "toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=350")
	}

function popratings(){
	newwin2 = window.open("http://www.hotel-and-discount.com/popInfo/ratings.html", "newwin2","toolbar=no,location=no,directories=no,status=yes, menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=614,height=530");}

function popfaq(){
newwin = window.open("http://www.hotel-and-discount.com/infos/faq.html", "newwin", "toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=550,height=500");
}

function popstates(){
	states = window.open( "http://www.hotel-and-discount.com/popInfo/states.html", "states", 'width=390,height=500,resizable=1,scrollbars=yes');
	}

function popCondostates(){
	states = window.open( "http://www.hotel-and-discount.com/popInfo/states.html", "states", 'width=390,height=500,resizable=1,scrollbars=yes');
	}

function popcountries(){
	countries = window.open( "http://www.hotel-and-discount.com/popInfo/countries.html", "countries", 'width=765,height=500,resizable=1,scrollbars=yes');
	}

function popCondocountries(){
	countries = window.open( "http://www.hotel-and-discount.com/popInfo/countries.html", "countries", 'width=765,height=500,resizable=1,scrollbars=yes');
	}

function converter(file, input){
currencyWindow=window.open(file,input,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=640,height=215,top=100,left=100");
currencyWindow.focus();
}

function swapImage(imgPath){
	 document.HotelPic.src=imgPath;
	 imgCurrent = imgPath;
}

function go(loc) {
window.location.href = loc;

}

//===== map pop up
//travelnow's map pop up

 function MapPopup2(theURL,winName,features) {
        fileWindow = "http://travel.ian.com/hotels/info/map.jsp";

        fileWindow += theURL;
        window.open(fileWindow,winName,features);
    }
    
	
function openMapWindow(url) {
        window.open(url, "map", "width=478,height=333,top=170,left=162,toolbar=no,location=no,directories=no,status=no,menubar=no,dependent=yes,resizable=no,status=no,scrollbars=yes");
    }

function openRules(page,describe) {  
        win = window.open(page,"window","toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=800,height=700");
win.focus();
}


//========transform input to proper case for next page title

function Capitalize(frmCityInput) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmCityInput.value.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)  {
for (index = 0; index < strLen; index++)  {
if (index == 0)  {
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))  {
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
         }
      }
   }
}

  if (strLen == 3)
  {
  tmpStr = tmpStr.toUpperCase() ;
  }

frmCityInput.value = tmpStr;
}



//place cursor in first form box

function placeFocus() {
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
document.forms[0].elements[i].focus();
break;
         }
      }
   }
}
 
//-----------------------------------------------------------------
