// JavaScript Document
var xmlHttp
var CtyNo = ""
var CONTROL
var fieldValue = -1
var TimeId
var ShowPk = 1
var strCty
var IntNo = 0

function showHint(str,id){
strCty = str.length
CtyNo = id
//alert(CtyNo)
CtyName = "Enter City "+ id
//alert (CtyName)
	if (str != CtyName){
		if (str.length > 1){ 
		//var url="Get_Cities_Hint.asp?sid=" + Math.random() + "&q=" + str +"&ctyNo=" + id
		var url="/Get_Cities_Hint_V2.asp?q=" + str +"&ctyNo=" + id
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
		} 
		else{
		eval("document.all['txtHint"+ CtyNo +"'].innerHTML=''");
		} 
	} 
	if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){	
		Codekey = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	}
	else{
		Codekey = evt.which ? evt.which : evt.keyCode;
	}
}

function showHintCo(str,id){
strCty = str.length
ShowPk = 0
CtyNo = id
//alert(CtyNo)
CtyName = "Enter City "+ id
//alert (CtyName)
	if (str != CtyName){
		if (str.length > 1){ 
		//var url="Get_Cities_Hint.asp?sid=" + Math.random() + "&q=" + str +"&ctyNo=" + id
		var url="/Get_Cities_Hint_V2.asp?q=" + str +"&ctyNo=" + id
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
		} 
		else{
		eval("document.all['txtHint"+ CtyNo +"'].innerHTML=''");
		} 
	} 
	if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){	
		Codekey = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	}
	else{
		Codekey = evt.which ? evt.which : evt.keyCode;
	}
}

function stateChanged(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		
		if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){
			eval("document.all['txtHint"+ CtyNo +"'].innerHTML=xmlHttp.responseText");
			eval("document.all['txtHint"+ CtyNo +"'].style.display='block'");
			}
		if (navigator.userAgent.indexOf("Firefox")>=0){
			document.getElementById('txtHint'+ CtyNo).innerHTML=xmlHttp.responseText;
			document.getElementById('txtHint'+ CtyNo).style.display='block';
		}
		if (strCty >= 4){
			if (document.getElementById('Dest'+ CtyNo) != null){
				document.getElementById('Dest'+ CtyNo).focus();
			}
			else{
				document.getElementById('inText'+ CtyNo).focus();
			}
		}
	} 
} 

function GetXmlHttpObject(handler){
	
	if (navigator.userAgent.indexOf("Opera")>=0){
		alert("This City selector doesn't work in Opera")
		return
	}
	if (navigator.userAgent.indexOf("MSIE")>=0){
		var strName="Msxml2.XMLHTTP"
			if (navigator.appVersion.indexOf("MSIE 5.5")>=0){
				strName="Microsoft.XMLHTTP"
			}
			try{
				objXmlHttp=new ActiveXObject(strName)
				objXmlHttp.onreadystatechange=handler
				return objXmlHttp
			}
			catch(e){
				alert("Error. Scripting for ActiveX might be disabled")
				return
			}
	}
				if (navigator.userAgent.indexOf("Firefox")>=0){
				objXmlHttp=new XMLHttpRequest()
				objXmlHttp.onload=handler
				objXmlHttp.onerror=handler
				return objXmlHttp
			}
	}

function PassValueK(a,b,c,evt){
	
	if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){	
		var Codekey = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	}
	else{
		var Codekey = evt.which ? evt.which : evt.keyCode;
	}
	
	//alert(Codekey)
	if (Codekey == 8 || Codekey == 27){
		
		if (CtyNo <= 12){
					if (window.event) window.event.returnValue = true
					
					document.cityselect('inText'+ CtyNo).value = 'Enter City ' + CtyNo ;
/*rt*/				document.cityselect('inText'+ CtyNo).focus();
					//p = eval('document.cityselect.inText'+ CtyNo) 
					//highlight(p);
					}
		
		document.getElementById('txtHint'+ CtyNo).innerHTML='';
		document.getElementById('txtHint'+ CtyNo).style.display='none';
		objXmlHttp=null
		
	}
	
	if(Codekey == 9 || Codekey == 13){
		PassValue(a,b)
	}
	
	if (Codekey == 40){
		if (window.event) window.event.returnValue = false
		
			if (document.getElementById('pDest'+ c) != null){
				document.getElementById('pDest'+ c).focus();
			}
		}
		
	if (Codekey == 38){
		if (window.event) window.event.returnValue = true
			//alert(c + ' = c')
		d = c - 2
			//alert(d + ' = d')
		if (c==3){
		document.getElementById('Dest'+ CtyNo).focus();
		}
	else{
			if (document.getElementById('pDest'+ d) != null){
				document.getElementById('pDest'+ d).focus();
			}
		}
		}
}

function PassValue(a,b){
	
	//alert(a + ' = a || ' + b + ' = b')
	
	if (a == ''){
		ShowPk = -1
	}
	    fieldValue = 0
		if (navigator.userAgent.indexOf("Firefox")>=0){
		document.getElementById('StayCity'+ CtyNo).value=a;
		document.getElementById('StayCity'+ CtyNo +'_Name').value=b;
		document.getElementById('inText'+ CtyNo).value=b;
		document.getElementById('inText'+ CtyNo).className='BOX-Select_City_Small';
		document.getElementById('txtHint'+ CtyNo).innerHTML='';
		document.getElementById('txtHint'+ CtyNo).style.display='none';
		objXmlHttp=null
		fieldValue = -1
		
	}
	if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){
		eval("document.all['StayCity"+ CtyNo +"'].value=a");
		eval("document.all['StayCity"+ CtyNo +"_Name'].value=b");
		eval("document.all['inText"+ CtyNo +"'].value=b");
		eval("document.all['inText"+ CtyNo +"'].className='BOX-Select_City_Small'");
		eval("document.all['txtHint"+ CtyNo +"'].innerHTML=''");
		eval("document.all['txtHint"+ CtyNo +"'].style.display='none'");
		objXmlHttp=null
		
	}	
	if (CtyNo > 1 && ShowPk == 1){
		checkValue()
	}
	
	CtyNo = CtyNo + 1
			
			if (document.getElementById('inText'+ CtyNo) != null){
				
				if (CtyNo <= 12){
					if (window.event) window.event.returnValue = true
//rt				c = document.cityselect('inText'+ CtyNo)
					c = eval('document.cityselect.inText'+ CtyNo) 
					highlight(c);
					}
				}
			else{
				//alert('aaahhhhhhhhh')
				if (window.focus) window.focus()
				}
}

function highlight(field){
  field.focus();
  field.select();
}

function handleEnter(evt){
if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){	
var Codekey = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
}
else{
//var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
var Codekey = evt.which ? evt.which : evt.keyCode;
}
//alert(Codekey)
	/*if (Codekey == 13 || Codekey == 9) {
		if (navigator.userAgent.indexOf("Firefox")>=0){
			a = document.getElementById('Dest'+ CtyNo).value;
			b = document.getElementById('Dest'+ CtyNo).options[document.getElementById('Dest'+ CtyNo).selectedIndex].text;
			
			PassValue(a,b);
			
		}
		if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){
			eval("a = document.all['Dest"+ CtyNo +"'].value");
			eval("b = document.all['Dest"+ CtyNo +"'].options[document.all['Dest"+ CtyNo +"'].selectedIndex].text");
			
			PassValue(a,b);
		}
			
			CtyNo = CtyNo + 1
			
			if (document.getElementById('inText'+ CtyNo) != null){
				
				if (CtyNo <= 12){
					c = document.cityselect('inText'+ CtyNo)
					highlight(c);
					}
				}
			else{
				if (window.focus) window.focus()
				}
 }
 
 	var coll = document.all.tags("P");
    if (coll.length >= 5)
   {
      coll(4).style.textDecoration = "underline";
      coll(4).scrollIntoView(true);
   }
 */
 //alert(Codekey)
 //if (Codekey == 27){
	
	
 //}
 
 if (Codekey == 40){
	// alert(Codekey)
	if (window.event) window.event.returnValue = false
	document.getElementById('Dest'+ CtyNo).focus();
	//document.getElementById('Dest').focus();
 }
}

function showHintInt(str,Na)
{
//strInt = str.length
//ShowCtry = 0
//alert(str)
//alert(Na)
IntNa = str
//alert(CtyNo)
//IntName = "Enter City "+ id
//alert (CtyName)
//if (str != CtyName){
//if (str.length > 2)
//{ 
//var url="Get_Cities_Hint.asp?sid=" + Math.random() + "&q=" + str +"&ctyNo=" + id
var url="/Get_CountryXInt.asp?q=" + str +"&intNa=" + Na
xmlHttp=GetXmlHttpObject(stateChangedInt)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
} 
//else
//{
//eval("document.all['txtHint"+ CtyNo +"'].innerHTML=''");
///} 
//} 
//}

function closeDiv(a){
	//xmlHttp = ""
	document.getElementById('intHint' + a).innerHTML='';
	document.getElementById('intHint' + a).style.display='block';
}
	

function stateChangedInt() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
	
	if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){
		document.getElementById('intHint' + IntNa).innerHTML=xmlHttp.responseText;
		document.getElementById('intHint' + IntNa).style.display='block';
		}
	if (navigator.userAgent.indexOf("Firefox")>=0){
		document.getElementById('intHint' + IntNa).innerHTML=xmlHttp.responseText;
		document.getElementById('intHint' + IntNa).style.display='block';
		}
		
} 
}

function Item(CONTROL){
	CONTROL = CONTROL
}

function SelectItem(CONTROL){
		for(var i = 0;i < CONTROL.length;i++){
			
			if (CONTROL.length == 1){
				CONTROL.options[i].selected = true;
			}
		if (i==0){
			CONTROL.options[i].selected = true;
			}
			}
			}
function checkValue(){
	if (fieldValue != -1){
		
		window.clearTimeout(TimeId);
		document.getElementById('showPack').style.display='block';
		var CityIds
		if (navigator.userAgent.indexOf("Firefox")>=0){
			a=document.getElementById('StayCity1').value
			b=document.getElementById('StayCity2').value
			c=document.getElementById('StayCity3').value
			d=document.getElementById('StayCity4').value
		}
		if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){
			eval("a=document.cityselect.StayCity1.value")
			eval("b=document.cityselect.StayCity2.value")
			eval("c=document.cityselect.StayCity3.value")
			eval("d=document.cityselect.StayCity4.value")
		}
		
		if (a != -1){
			CityIds = a
		}
		if (a != -1 && b != -1){
			CityIds = a +','+ b
		}
		if (a != -1 && b != -1 && c != -1){
			CityIds = a +','+ b +','+ c
		}
		if (a != -1 && b != -1 && c != -1 && d != -1){
			CityIds = a +','+ b +','+ c +','+ d
		}
		//alert(a)
		//alert(b)
		//alert(c)
		//alert(d)
		showPack(CityIds)
		}
       else{
		   fieldValue=document.cityselect.StayCity2.value;
		   TimeId=setTimeout("checkValue()",200)
         }
}

function showPack(ctyid){
document.getElementById('showPack').style.display='block';
var url="/Get_Cities_Pack.asp?sid=" + Math.random() + "&q=" + ctyid 
xmlHttp=GetXmlHttpObject(stateChanged2)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}
function PageChange(a){
//var URL = a;
var goURL = a

if (goURL.indexOf('Latin_') > 0){
	goURL = 'http://latin.solartours.com'
}
if (goURL.indexOf('Asia') > 0){
	goURL = 'http://asia.solartours.com'
}
if (goURL.indexOf('Europe') > 0){
	goURL = 'http://europe.solartours.com'
}
window.location.href = goURL //URL

}
function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
	if (navigator.userAgent.indexOf("MSIE")>=0 || navigator.userAgent.indexOf("MSIE 5.5")>=0){
		//alert(xmlHttp.responseText)
		if (xmlHttp.responseText == ''){
			eval("document.all['showPack'].style.display='none'");
		}
		else{
		eval("document.all['showPack'].innerHTML=xmlHttp.responseText");
		}
		}
	if (navigator.userAgent.indexOf("Firefox")>=0){
		//alert('wait')
		document.getElementById('showPack').innerHTML=xmlHttp.responseText;
		//document.getElementById('txtHint'+ CtyNo).style.display='block';
		}
	
} 
}
function jCtyAir(a){
//alert(a)
if (a==1){
eval("document.frmShowCal.addflights.value = 1")
eval("document.frmShowCal.ShowCal.value = 2");
document.frmShowCal.submit()
}
else {
eval("document.frmShowCal.addflights.value = 2")
eval("document.frmShowCal.ShowCal.value = 2");
document.frmShowCal.submit()
}
}
function McToCs(){
eval("document.frmShowCal.ShowCal.value = 2");
document.frmShowCal.submit()
}
function CsToMc(){
eval("document.frmShowCal.ShowCal.value = ''");
document.frmShowCal.submit()
}

function SelectPackED(a){
//alert(a)
//alert(b)
eval("document.frmShowCal.EDPackShow.value = a");
//eval("document.frmShowCal.packFilter.value = b");
document.frmShowCal.submit()
}

function SelectPackBD(a){
//alert(a)
//alert(document.frmShowCal.BDPackShow.value)
eval("document.frmShowCal.BDPackShow.value = a");
//eval("document.frmShowCal.packFilter.value = b");
document.frmShowCal.submit()
}

function SubmitAir(a)
{
//alert(a)
//alert(document.frmShowCal.ShowCal.value)
if (a=='False'){
eval("document.frmShowCal.ShowCal.value = 2")
eval("document.frmShowCal.addflights.value = 2")
document.frmShowCal.submit()
}
else {
eval("document.frmShowCal.ShowCal.value = 2")
eval("document.frmShowCal.addflights.value = 1")
document.frmShowCal.submit()
}
}

function SubmitAirBD(a)
{
//alert(a)
//alert(document.frmShowCal.ShowCal.value)
if (a=='False'){
eval("document.frmShowCalBD.ShowCalBD.value = 2")
eval("document.frmShowCalBD.addflightsBD.value = 2")
//alert(document.frmShowCalBD.addflightsBD.value)
document.frmShowCalBD.submit()
}
else {
eval("document.frmShowCalBD.ShowCalBD.value = 2")
eval("document.frmShowCalBD.addflightsBD.value = 1")
document.frmShowCalBD.submit()
}
}

function selectItemFromListW(inputElementName, listElementName, formName, strFlag)
  
{
	//get the input value and the list length
	inputElementValue = new String(eval("document." + formName + "." + inputElementName + ".value")).toLowerCase();	
	 var c = inputElementValue.length;
    // alert(c)
    if (c<=3)
	{
 	listElementLength = eval("document." + formName + "." + listElementName + ".length");
	
	//get the string delimiter (to filter out the country name, or any other prefix to the list data)
	strDelimiterValue = new String(strFlag).toLowerCase();
	//alert(strDelimiterValue)
	//get length of string delimiter
	if (strDelimiterValue != null) 
	{
		strDelimiterLength = strDelimiterValue.length;
	}
	else
	{
		strDelimiterLength = 0;
	}
		
	//cycle through list to find a match
	for (count=0; count<listElementLength; count++) 
	{
		//get the distinct list value and match text
	 	listElementValue = new String(eval("document." + formName + "." + listElementName + ".options[count].text")).toLowerCase();
	 	//position 
	 	var startPosition = listElementValue.indexOf( strFlag, 0 ) + strDelimiterLength;
	 	var matchText = listElementValue.substr(startPosition, inputElementValue.length);
	 	
		if (inputElementValue == matchText) //then match found
	 	{
	 		// set matching list option to selected
	 		eval("document." + formName + "." + listElementName + ".options[count]").selected = true;
	 		break; 
	 	} 
	}
	}
	
	if (c>3)
	{
	eval("findVal = (new String(document.frmListQry." + inputElementName + ".value)).toLowerCase()");	
	eval("len=document.frmListQry." + listElementName + ".length");
 	var findLength = findVal.length;
	for (count=0; count<len; count++) 
	   {
		eval("compVal = (new String(document.frmListQry." + listElementName + ".options[count].text)).toLowerCase()");
		var subStrin = compVal.substr(0, findLength);
		if (findVal == subStrin) 
		  {
			eval("document.frmListQry." + listElementName + ".options[count].selected = true");
			break; 
		  } 
       }
   } 
}

function UpdateValue(c,a){
//alert(a)
//alert(c)
//if (a == 2782 || a == 2758 || a == 1184 || a == 1207 || a == 2557 || a == 2781 || a == 2720 || a == 1284 || a == 3232 || a == 1096 || a == 2747 || a == 3231 || a == 2754 || a == 3015 || a == 2748 || a == 2751 || a == 981 || a == 2784 || a == 2954 || a == 1147 || a == 1093 || a == 1233 || a == 1285 || a == 2725 || a == 2716 || a == 2800 || a == 1141 || a == 2816 || a == 2749 || a == 965 || a == 2721 || a == 2736 || a == 2740 || a == 2731 || a == 2724 || a == 2735 || a == 2733 || a == 2732 || a == 2508 || a == 2804)
//{
//u = "2|X2-X3"
//}
//else
//{
//u = "2|X1-X3"
//}
//alert(u)
eval("b = document.frmListQry."+ c +".options[document.frmListQry."+ c +".selectedIndex].text");
//alert(b)
eval("document.frmListQry."+ c +"_Name.value = b");
eval("document.frmListQry.StayCityE.value = a");
eval("document.frmListQry.StayCityE_Name.value = b");
eval("document.frmListQry.StayCity1.value = a");
eval("document.frmListQry.StayCity1_Name.value = b");
//eval("document.frmListQry.APICity1.value = u");
}

function UpdateValueBD(c,a){
//alert(a)
//alert(c)
if (a == 3889 || a == 3890 || a == 3891 || a == 3892 || a == 3888){
u = "2|X1-X3"
}
else{
u = "2|X0-X3"
}
//alert(u)
eval("b = document.frmListQry."+ c +".options[document.frmListQry."+ c +".selectedIndex].text");
//alert(b)
eval("document.frmListQry."+ c +"_Name.value = b");
eval("document.frmListQry.StayCityE.value = a");
eval("document.frmListQry.StayCityE_Name.value = b");
eval("document.frmListQry.StayCity1.value = a");
eval("document.frmListQry.StayCity1_Name.value = b");
eval("document.frmListQry.APICity1.value = u");
}


function showChild(n)
   {
    var objChild0=document.getElementById("divChild0")
    var objChild1=document.getElementById("divChild1")
    var objChild2=document.getElementById("divChild2")
    var objChild3=document.getElementById("divChild3")
    var objChild4=document.getElementById("divChild4")
    

    if (n>0)
      objChild0.style.display=''

    if (n==0)
      objChild0.style.display='none'
 
    for(i=1;i<=n;i++)
      eval("objChild"+i+".style.display=''")  
      
     for(;i<=4;i++)
      {
      eval("objChild"+i+".style.display='none'")
      eval("document.frmListQry.iChild"+i+".value=''")
       }
    
   }


var win = true;	
function QueryWindow(mypage,myname,w,h,scroll){
//alert(myname)
if (myname=='Latin' || myname=='Beach' || myname=='Europe')
{
mypage = mypage+"?SODest="+myname //+"&PaxMail="+b+"&PaxPhone="+c+"&PaxBestTime="+d+"&PaxHowHelp="+e+"&FromPack="+f+"&PaxTimeZone="+g
//alert(mypage)
}
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
}

var win = true;	
function QueryWindowHELP(mypage,myname,w,h,scroll){
//alert(myname)
if (myname==3)
{
eval("a=document.EmailRQ.PaxNames.value");
eval("b=document.EmailRQ.PaxMail.value");
eval("c=document.EmailRQ.PaxPhone.value");
eval("d=document.EmailRQ.PaxBestTime.value");
eval("e=document.EmailRQ.PaxHowHelp.value");
eval("g=document.EmailRQ.PaxTimeZone.value");
//eval("f=document.EmailRQ.FromPack.value");
eval("f=window.location.href");
mypage = mypage+"?PaxNames="+a+"&PaxMail="+b+"&PaxPhone="+c+"&PaxBestTime="+d+"&PaxHowHelp="+e+"&FromPack="+f+"&PaxTimeZone="+g
alert(mypage)
}
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}	

//============================start group by destination validation logic===================
function findObj(elemID){
	var obj=false;
	if(document.all){
		obj=document.all(elemID);
	}
	else{
		if(document.getElementById){
			obj=document.getElementById(elemID);
		}
		else{
			if(document.laers){
				obj=document.laers[elemID];
			}
		}
	}
	return obj;	
}
function isNotValidMail(inputStr){
	if(inputStr.match(/^[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)){
		return false;
	}
return true;
}

function isEmpty(inputStr){
	if (inputStr == null || inputStr == ""){
		return true;
	}
	return false;
} 

function confirmGroupRequestForm(){
	var val1=findObj("gAgency");
	var val2=findObj("gName");
	var val3=findObj("gIATA");
	var val4=findObj("gEmail");
	var val5=findObj("gPhone");
	var val6=findObj("gGroupName");
	var val7=findObj("gDestino");
	var val8=findObj("firstdepcity");
	var val9=findObj("iFromDate");
	if (findObj("iReturnDate") != null){
		var val10=findObj("iReturnDate");
	}
	else{
		var val10='none';
	}
	if(findObj("rangents") != null){
		var val11=findObj("rangents");
	}
	else{
		var val11='none'
	}
	var val12=findObj("iAdult");
	var val13=findObj("iChildren");
	var empty=false;
	var emptyControlIdx=0;
	for (i=1;i<=13;i++){
		empty=eval("isEmpty(val"+i+".value)");
		if (empty==true){
			emptyControlIdx=i;
			break;
		}
	}
	if (empty==true){
		for (i=emptyControlIdx;i<=13;i++){
			empty=eval("isEmpty(val"+i+".value)");
			if(empty==true){
				if (findObj("div"+ i) !=null){
					eval("changeDivColor('div"+ i +"','red')");
				}
			}
		}
	 	alert("Please fill all required fields!");
		eval("val"+emptyControlIdx+".focus()");
		return false;		
	}
	if(val7.value=="-1" || val8.value=="none"){
		alert("Please select a valid value!");
		if (val8.value=="none"){
			val8.focus();
			changeDivColor('div8','red');
		}
		if (val7.value=="-1"){
			val7.focus();
			changeDivColor('div7','red');		
		}		
		return false;
	}
	
	if(isNotValidMail(val4.value)==true){
		alert("Please enter a valid email address!");
		val4.focus();
		changeDivColor('div4','red');	
		return false;
	}
	return true;
}
function changeDivColor(divID,sColor){
	var oDiv=findObj(divID);
	oDiv.style['color']=sColor;
}
function setDivColor(controlID,controlIdx){
	var val=findObj(controlID).value;
	if (controlIdx==7 || controlIdx==8){
		switch (controlIdx){
			case 7:
					if (val=="-1"){
						color='red';						
					}
					else{
						color='black';						
					}
					break;
			case 8:
					if (val=="none"){
						color='red';
					}
					else{
						color='black';
					}
					break;
		}
		eval("changeDivColor('div" + controlIdx + "','" + color + "')");				
	}
	else{
		if (isEmpty(val)){
			eval("changeDivColor('div" + controlIdx + "','red')");		
		}
		else{
			eval("changeDivColor('div" + controlIdx + "','black')");		
		}
	}
}
//===============================================end==========================================
//===========================start city hotels display functions==============================

function filterCityHotels(rating,cityName,pgType,region){
	//findObj
	var noHotels = findObj('noHotels').value;
	var oDivTopLinks = findObj('divTopLinks');
	var oNoHotelsFiltered = findObj('noHotelsFiltered');
	//var oCityHotels = findObj("cityHotels");
	var oHotelDiv,oRatingVal,oNoInnerHot
	var countHotels = 0;
	
	for (i=1;i<=noHotels;i++){
		oRatingVal = eval("findObj('valRating" +i+"')");
		oHotelDiv = eval("findObj('divRating" +i+"')");
		oNoInnerHot = eval("findObj('noInnerHot" +i+"')");
		if (oRatingVal.value==rating || rating=="all"){
			oHotelDiv.style['display'] = "";
			//alert("noInnerHot" +i);
			//alert(oNoInnerHot.value);
			countHotels=countHotels + parseInt(oNoInnerHot.value);
			//alert(countHotels);
			
			}
		else{
			oHotelDiv.style['display'] = "none";
		}
		
	}
	if (rating=="all"){
		
		document.title=cityName + " " + pgType + ": " + cityName + " stays, hotel accommodations, pictures, and location info in "+cityName;		
		window.status="All Hotels";
		oDivTopLinks.innerHTML=findObj('sTopLinks').value;
	}
	else{
		document.title=cityName + " " + pgType + ": " + cityName + " " + rating + " Hotels";
		window.status=rating + ' Hotels';
		oDivTopLinks.innerHTML=findObj('sTopLinks').value + " (" +rating+" Hotels)";
		
	}
	oNoHotelsFiltered.innerHTML = countHotels +" "+ rating + " Hotel(s) Found.";
	
	//oCityHotels.style['height']="5px";
}
function cancunDisplay(ruleIdx,url){
	var oCancunTopDeals= findObj('cancunTopDeals');
	var oRmTopDeals = findObj('rmTopDeals');
	var oCancunHotels=findObj('cancunHotels');
	
	switch (ruleIdx) {
		case 0:
			oRmTopDeals.style['display'] = "none";
			oCancunTopDeals.style['display'] = "";
			oCancunHotels.style['display'] = "";
			break;
		case 1:
			window.location=url;
			break;
	}
}

//===============================================end==========================================
function redirectOpener(url){
		window.opener.location=url;
		window.close();
}
//======================== start show div Pack by country on region page =====================
/*function showctry(a,b){
//alert (a + ' = a | ' + b +' = b')
	for(i=1;i<=a;i++)
	if (i==b){
	document.getElementById('shw'+ i).style.display='block';
    //eval("document.all['shw"+ i +"'].style.display='block'")  
	}
    //else{
    // eval("document.all['shw"+ i +"'].style.display='none'") 
    //}
}*/
function showpic(picimage,a) {
	//alert(picimage)
	//alert(picimage.indexOf("plus"))
	if (picimage.indexOf("plus")> 0){
		z = "/images/minus.gif"
		eval("document.all['pic"+ a +"'].src=z");
	}
	else{
		z = "/images/plus.gif"
		eval("document.all['pic"+ a +"'].src=z");
		document.getElementById('shw'+ a).style.display='none';
		
	}
}
function showpicBD(a) {
	//alert(a)
	eval("b = document.all['pic"+ a +"'].src");
	//alert(b)
	
	//alert(picimage.indexOf("plus"))
	if (b.indexOf("plus")> 0){
		z = "/images/minus.gif"
		eval("document.all['pic"+ a +"'].src=z");
	}
	else{
		z = "/images/plus.gif"
		eval("document.all['pic"+ a +"'].src=z");
		document.getElementById('shw'+ a).style.display='none';
		
	}
}

function showpicI(picimage,a) {
	//alert(picimage.indexOf("plus"))
	if (picimage.indexOf("minus")> 0){
		z = "/images/plus.gif"
		eval("document.all['picI"+ a +"'].src=z");
	}
	else{
		z = "/images/minus.gif"
		eval("document.all['picI"+ a +"'].src=z");
		document.getElementById('shwI'+ a).style.display='block';
		
	}
}
function showpicIBD(a){
	//alert(a)
	eval("b = document.all['picI"+ a +"'].src");
	//alert(b)
	
	//alert(picimage.indexOf("plus"))
	if (b.indexOf("plus")> 0){
		z = "/images/minus.gif"
		eval("document.all['picI"+ a +"'].src=z");
	}
	else{
		z = "/images/plus.gif"
		eval("document.all['picI"+ a +"'].src=z");
		document.getElementById('shwI'+ a).style.display='none';
		
	}
}

function showctryB(a,b){
	
    //alert (a + ' = a | ' + b +' = b')
	z = "/images/plus.gif"
	w = "/images/minus.gif"
	document.getElementById('shw'+ b).style.display='block';
	eval("document.all['pic"+ b +"'].src=w");
	
	for(i=1;i<=a;i++)
	if (i != b){
	document.getElementById('shw'+ i).style.display='none';
	eval("document.all['pic"+ i +"'].src=z");
   	}
}

function showcty(a,b){
	for(i=1;i<=a;i++)
	if (i==b){
    eval("document.all['shw"+ i +"'].style.display='block'")  
	}
    //else{
    // eval("document.all['shw"+ i +"'].style.display='none'") 
    //}
}
function showpic(picimage,a) {
	//alert(picimage.indexOf("plus"))
	if (picimage.indexOf("plus")> 0){
		z = "/images/minus.gif"
		eval("document.all['pic"+ a +"'].src=z");
	}
	else{
		z = "/images/plus.gif"
		eval("document.all['pic"+ a +"'].src=z");
		eval("document.all['shw"+ a +"'].style.display='none'")
	}
}

function showInt(a,b,c){
	alert(a)
    for(i=1;i<=a;i++)
	if (i==b){
	document.getElementById('shwI'+ i).style.display='none';
	}
	if (c==9){
		picsrc = document.getElementById('picI'+ b).src;
		if (picsrc.indexOf("plus")> 0){
			w = "/images/minus.gif"
			document.getElementById('shwI'+ b).style.display='block';
			eval("document.all['picI"+ b +"'].src=w");
		}
		else{
			w = "/images/plus.gif"
			document.getElementById('shwI'+ b).style.display='none';
			eval("document.all['picI"+ b +"'].src=w");
		}
	}
}
function showctry(a){
	//alert(a)
	eval("b = document.all['pic"+ a +"'].src");
	//alert(b)
	if (b.indexOf("plus")> 0){
		z = "/images/minus.gif"
		eval("document.all['pic"+ a +"'].src=z");
		document.getElementById('shw'+ a).style.display='block';
	}
	else{
		z = "/images/plus.gif"
		eval("document.all['pic"+ a +"'].src=z");
		document.getElementById('shw'+ a).style.display='none';
		
	}
}

function showIntLD(a){
	//alert(a)
	eval("b = document.all['picI"+ a +"'].src");
	//alert(b)
	if (b.indexOf("plus")> 0){
		z = "/images/minus.gif"
		eval("document.all['picI"+ a +"'].src=z");
		document.getElementById('shwI'+ a).style.display='block';
	}
	else{
		z = "/images/plus.gif"
		eval("document.all['picI"+ a +"'].src=z");
		document.getElementById('shwI'+ a).style.display='none';
		
	}
}
//======================== end =============================
function UpdateValueED(c,a){
//alert(a)
//alert(c)
if (a == 2782 || a == 2758 || a == 1184 || a == 1207 || a == 2557 || a == 2781 || a == 2720 || a == 1284 || a == 3232 || a == 1096 || a == 2747 || a == 3231 || a == 2754 || a == 3015 || a == 2748 || a == 2751 || a == 981 || a == 2784 || a == 2954 || a == 1147 || a == 1093 || a == 1233 || a == 1285 || a == 2725 || a == 2716 || a == 2800 || a == 1141 || a == 2816 || a == 2749 || a == 965 || a == 2721 || a == 2736 || a == 2740 || a == 2731 || a == 2724 || a == 2735 || a == 2733 || a == 2732 || a == 2508 || a == 2804)
{
u = "2|X2-X3"
}
else
{
u = "2|X1-X3-X5"
}
//alert(u)
eval("b = document.frmListQry."+ c +".options[document.frmListQry."+ c +".selectedIndex].text");
//alert(b)
eval("document.frmListQry."+ c +"_Name.value = b");
eval("document.frmListQry.StayCityE.value = a");
eval("document.frmListQry.StayCityE_Name.value = b");
eval("document.frmListQry.StayCity1.value = a");
eval("document.frmListQry.StayCity1_Name.value = b");
eval("document.frmListQry.APICity1.value = u");
}
function buildCo(z){
window.clearTimeout(TimeId);
eval("a=document.cityselect.inText1.value")
eval("b=document.cityselect.inText2.value")
eval("c=document.cityselect.inText3.value")
eval("d=document.cityselect.inText4.value")
eval("e=document.cityselect.transp.value")
//alert(a.indexOf("City"))
//alert(b)
//alert(c)
//alert(d)
if (a.indexOf("City") < 0 && b.indexOf("City") < 0 && c.indexOf("City") < 0 && d.indexOf("City") < 0){
document.cityselect.action = "/"+ z +"/Build_Package_to_"+ a +"_"+ b +"_"+ c +"_"+ d +"_by_"+ e +".aspx"
}
if (a.indexOf("City") < 0 && b.indexOf("City") < 0 && c.indexOf("City") < 0 && d.indexOf("City") >= 0){
document.cityselect.action = "/"+ z +"/Build_Package_to_"+ a +"_"+ b +"_"+ c +"_by_"+ e +".aspx"
}
if (a.indexOf("City") < 0 && b.indexOf("City") < 0 && c.indexOf("City") >= 0 && d.indexOf("City") >= 0){
document.cityselect.action = "/"+ z +"/Build_Package_to_"+ a +"_"+ b +"_by_"+ e +".aspx"
}
if (a.indexOf("City") < 0 && b.indexOf("City") >= 0 && c.indexOf("City") >= 0 && d.indexOf("City") >= 0){
document.cityselect.action = "/"+ z +"/Build_Package_to_"+ a +"_by_"+ e +".aspx"
}
document.cityselect.submit()
}


var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}


function MoreCity(){
	//alert('hi')
document.cityselect.action = "/More_Cities.asp"
document.cityselect.submit()
}
function buildMo(){
document.cityselect.submit()
}