std='Travelovista.com... Your Gateway to Dream Vacations!';
document.onmousedown=onCalClose;

function changeaction(act,msg)
{
	if (act == 'del'){ 
		var Tell = window.confirm(" ARE YOU SURE ?? \n\n Click OK to delete " + msg + ", else click Cancel.");
		if (Tell) {
			return true; 
		}  else  return false; 
	}
}

function CheckNum(oThis){
	if (isNaN(oThis.value) || oThis.value == '') 
		return false; 
	else {
		if (oThis.value<=0) return false; else return true;
	}
}
function CheckZero(oThis){if (oThis.value<=0) return false; else return true;}

function newsletter() {  
 	var newsErrmsg = "";
	if(   (document.NewsletterForm.name.value == "") ||
		(document.NewsletterForm.name.value == "name"))
		{ 
		newsErrmsg += "\n" + "You have not typed your Name.";  
		document.NewsletterForm.name.focus(); 
		} 

	if(	(document.NewsletterForm.email.value.search("@") == -1) ||
		(document.NewsletterForm.email.value.search("[.*]") == -1))
		{ 
		newsErrmsg += "\n" + "You have not typed your Email Address, or it is incorrect.";  
		document.NewsletterForm.email.focus(); 
		} 

	if (newsErrmsg !== "")
		{ 
 		alert(newsErrmsg);  
		return false;
		} 
		return true;
	}



// function used to validate zero down search form


function checkOption(){
	if (document.FormZeroDown.txtHotelName.value == "" && document.FormZeroDown.SearchAmbience.value == "Zero" && document.FormZeroDown.SearchTariff.value == "Zero" ){
		alert("Please select at least one criteria to Zero Down!");
		document.FormZeroDown.txtHotelName.focus();
		return false;
	}
	return true;
}

function checkZero(){
	if (document.HotelMainPageZDForm.CityNumber.value == "Zero" ){
		alert("Please select at least one destination to Zero Down!");
		document.HotelMainPageZDForm.CityNumber.focus();
		return false;
	}
	return true;
}


//Function used to validate login name and password

function CheckLogin(txtValue,nWhat){
	var nLen,sCharAllowed,flag;
	flag=true;
	sCharAllowed="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_";
	nLen = txtValue.length;
	if(nLen<4 || nLen>20)
		flag=false;
	for(var nLoop=0;nLoop<=nLen;nLoop++){
		if(sCharAllowed.indexOf(txtValue.charAt(nLoop))== -1){
			flag=false;
			break;
		}
	}
	if (flag)
		return true;
	else{
		if (nWhat == 1)
			alert("INVALID LOGIN NAME !!" + "\n\n" + " Login Name must be a single alphanumeric \n word between 4 to 20 characters.");
		else
			alert("INVALID PASSWORD !!" + "\n\n" + " Password must be a single alphanumeric \n word between 4 to 20 characters.");			
		return false;
	}	
}

function CheckNumber(GivenValue){
	var sNumberAllowed,nLen;
	sNumberAllowed="0123456789.";
	nLen=GivenValue.length;
	for(var nLoop=0;nLoop<=nLen;nLoop++){
		if(sNumberAllowed.indexOf(GivenValue.charAt(nLoop)) == -1)
			return false;
	}
	return true;
}

//Calendar
var ClickForCal='Click to select date from Calendar'
var oTempCal;
function onCalClose(e){
	if (oTempCal){
		oTempCal.style.visibility="hidden"
	}
}


function OpenCalendar(GivenDateField, GivenElementName, blnFull, dCurDate){
	var oTemp, intCalX=0,intCalY=0;
	if (document.all) file="/cal.htm"; else file="/calns.htm";

	if (GivenDateField == ""){
		file+="?Element=" + GivenElementName + "&CurrentDate=" + dCurDate;
	}else {
		var DateArray;
		DateArray = GivenDateField.split("-");
		file+="?day=" + DateArray[0] + "&month=" + DateArray[1] + "&year=" + DateArray[2] + "&Element=" + GivenElementName + "&CurrentDate=" + dCurDate;
	}

	if (blnFull) file+="&full=1"; else file+="&full=2";

	if (document.all){
		oTemp=eval("div" + GivenElementName.split(".")[1]);
		oTemp.style.visibility="visible";
		intCalX=eval("document.img" + GivenElementName.split(".")[1] + ".offsetLeft")*1;
		intCalX=intCalX-90+192;
		intCalY=eval("document.img" + GivenElementName.split(".")[1] + ".offsetTop")*1;
		intCalY=intCalY+22+160;
		
		
		
		if (window.document.body.clientWidth+window.document.body.scrollLeft<intCalX)
			oTemp.style.left=window.document.body.clientWidth*1-200;
		else 
			oTemp.style.left=eval("document.img" + GivenElementName.split(".")[1] + ".offsetLeft")-90;
	
		if (window.document.body.scrollTop+window.document.body.clientHeight <intCalY)
			oTemp.style.top=(eval("document.img" + GivenElementName.split(".")[1] + ".offsetTop")*1-165);
		else
			oTemp.style.top=(eval("document.img" + GivenElementName.split(".")[1] + ".offsetTop")*1+22);

		oTemp.style.width=165;
		oTempCal=oTemp;

		oTemp.innerHTML="<iframe style='position: relative;bordercolor:white' frameborder=no border=0 width=165 src='"+ file + "' height=157 id='showimage'></iframe>";
	}else{
		window.open(file, "Date","resizable,width=300,height=200,left=100,top=100,screenX=100,screenY=100");
	}
}

//function OpenCalendar(GivenDateField, GivenElementName){
//	if (GivenDateField == "")
//			file="/calendar.asp?Element=" + GivenElementName + '&yearly=1';
//	else {
//		var DateArray;
//		DateArray = GivenDateField.split("-");
//		file= '/Calendar.asp?day=' + DateArray[0] + '&month=' + DateArray[1] + '&year=' + DateArray[2] + '&Element=' + GivenElementName + '&yearly=1';
//	}
//	window.open(file, "Date","resizable,width=300,height=200,left=100,top=100,screenX=100,screenY=100");
//}

//Check two date
///first should be less then secound

function CheckDate(FirstDate,SecDate){
	var sMonth="JanFebMarAprMayJunJulAugSepOctNovDec";
	if (FirstDate !=""){
		FirstDate=FirstDate.split("-");
		FirstDate[1]=(sMonth.search(FirstDate[1])+3)/3;
		FirstDate= new Date(FirstDate[2],FirstDate[1],FirstDate[0]);
	}else return false;
	
	if (SecDate != ""){
		SecDate=SecDate.split("-");
		SecDate[1]=(sMonth.search(SecDate[1])+3)/3;
		SecDate= new Date(SecDate[2],SecDate[1],SecDate[0]);
	}else return false;
	if (FirstDate>SecDate){ 
		return false
	}
return true;
}

function callPrint(){
	var sTitle=window.document.title;
	for (var nLoop=0;nLoop<=sTitle.length;nLoop++) sTitle=sTitle.replace(' ','%20');
	for (var nLoop=0;nLoop<=sTitle.length;nLoop++) sTitle=sTitle.replace('&','and');
	popupWin=window.open('/print.asp?Title=' + sTitle + '&File=' + window.location.href, 'Print', 'scrollbars=yes,menubar=yes,width=700,height=450,left=10,top=10,screenX=10,screenY=10');
}

function openConverter(whom) {
	popupWin = window.open('/guides/converter.asp?selectwhom='+whom, 'converter', 'resizable,width=500,height=250,left=30,top=30,screenX=30,screenY=30')
}


function openWin(fName,winName,width,height) {
	popupWin = window.open(''+fName+'', ''+winName+'', 'width='+width+',height='+height+',resizable,menubar=yes,left=10,top=10,screenX=10,screenY=10')
}

function onDescClick(GivenId){
	var oWin;
	oWin =  window.open("m-description.asp?CBId=" + GivenId,"Description","width=450,height=300,left=100,top=100,screenX=100,screenY=100");
}

function ValidateDate(oFrm,sName){
	var nDD,nMM,nYY;
	nDD=eval("oFrm.lst" + sName + "DD.options[oFrm.lst" + sName + "DD.selectedIndex].value");
	nMM=eval("oFrm.lst" + sName + "MM.options[oFrm.lst" + sName + "MM.selectedIndex].value-1");
	nYY=eval("oFrm.lst" + sName + "YY.options[oFrm.lst" + sName + "YY.selectedIndex].value");
	if (nYY==0 || nMM==-1 || nDD==0) return false;
	var dtCheck = new Date(nYY,nMM,nDD);
	if (nMM!=dtCheck.getMonth()){
		return false;	
	}
	return true;
}
function StringEmpty(txtstr){
	var i,j,flag,n;
	flag=true;
	n=txtstr.length;
	for (i=0;i<n;i++) if (txtstr.charAt(i)!=' ') flag=false;
	return flag;
}

function CheckEmail(TxtBx){
	if((TxtBx.value.search("@") == -1) || (TxtBx.value.search("[.*]") == -1)){ 
 		return false;
	} 		
	return true;
}
