<!--
function getHotelchain(cityXid) // fN for getting the hotel chain for the city selection
	{
	
	var Pid=cityXid
	var  HotelChains =document.Wiz.HotelChains.value;
	var HcchainXid =document.Wiz.HcchainXid.value;	
	var HcCityXid =document.Wiz.HcCityXid.value;	

	aHotelchain = HotelChains.split('|');
	aHotelchainPid = HcchainXid.split('|');
	aHotelchainCity = HcCityXid.split('|');

	var b;
	b = aHotelchain.length;
	
	var flag;
	
	var Hotelchain;
	Hotelchain = "";	
	Hotelchain = '<SELECT  name=AHotelChainXid>'; 	    
	Hotelchain = Hotelchain + '<OPTION value="null">Select</OPTION>';
	for(i = 0; i < b; i++)
	{
		if(Pid == aHotelchainCity[i])
		{
			flag = true;
			Hotelchain = Hotelchain + '<option value="'+aHotelchainPid[i]+'">'+aHotelchain[i]+'</option>';
		}
		if(flag == true && i < b)
		{
			if(Pid != aHotelchainCity[i + 1])
			{
				break;
			}
		}
	}
	
	Hotelchain = Hotelchain + '</select>';
	 document.all.Hotelchains.innerHTML = Hotelchain;
	}
function openwin1()
	{
	window.open("Group Travel.htm",'ab','width=550, height=400,scrollbars=yes ,resizable=1,left=120 ,top=100' )
	}

function openwin(pname)
{
window.open(pname,'ab','width=550, height=400,scrollbars=yes ,resizable=1,left=120 ,top=100') 
//window.open("FeedbackDescription.asp?notesXid=" + notesXid + "&pid=" + pid,'ab','width=550, height=400,scrollbars=yes ,resizable=1,left=120 ,top=100' )
}

function chkBrowser()
{
    this.ver=navigator.appVersion;
    this.dom=document.getElementById?1:0;
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bVer=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
    return this;
}

bVer=new chkBrowser();
ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;

function AttB(f)
{
    if(bVer.ie4)
    f.style.display='block';
}

function AttN(f)
{
    if(bVer.ie4)
    f.style.display='none';
}

function show(idLayer,idParent)
{

//cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
//cLayer.display='none';
//divLinksForm=(ns4)?document.divLinks.document.divLinks:document.divLinks;
var d=document.Wiz;

/* if (idLayer=='basicdis')
{
AttB(d.BHotelQualityXid);
//d.srch[0].status='true';
document.Wiz.SearchType.value = "Basic";
//AttB(d.basicdis);
//AttN(d.advancedis)
document.Wiz.all("basicdis").style.display='block';
document.Wiz.all("advancedis").style.display='none';
document.Wiz.all("late").style.display='none';

}*/

if (idLayer=='advancedis')
{
AttB(d.ARatingXid);
AttB(d.HotelQyality1);
AttB(d.AHotelChainXid);
//d.srch[1].status='true';
document.Wiz.SearchType.value = "Advance"
document.Wiz.all("advancedis").style.display='block';
}
else
	{
	//document.Wiz.all("basicdis").style.display='none';
	document.Wiz.all("advancedis").style.display='none';
	//document.Wiz.all("late").style.display='block';
	}
}


function ShowHide(BorA)
{
    if (BorA =='Basic')
    {
        document.frmhome.all("advancedis").innerHTML=""
        document.frmhome.all("late").innerHTML=""
        document.frmhome.all("basicdis").style.visibility="visible";
        document.frmhome.all("advancedis").style.visibility="hidden";
        document.frmhome.all("late").style.visibility="hidden";
    }
    else if(BorA =='Advance')
    {
        document.frmhome.all("basicdis").innerHTML=""
        document.frmhome.all("late").innerHTML=""
        document.frmhome.all("basicdis").style.visibility="hidden";
        document.frmhome.all("late").style.visibility="hidden";
        document.frmhome.all("advancedis").style.visibility="visible";    
    }
   else
   {
        document.frmhome.all("basicdis").innerHTML=""
        document.frmhome.all("latadvanceeid").innerHTML=""
        document.frmhome.all("basicdis").style.visibility="hidden";
        document.frmhome.all("advancedis").style.visibility="hidden";
        document.frmhome.all("late").style.visibility="visible";  
   } 
}


function validate()
{
		document.Wiz.ACheckIn.value = document.Wiz.CheckInDate.value;
		document.Wiz.ACheckOut.value = document.Wiz.CheckOutDate.value;
	
        Addmillisec = (1 * 24 * 60 * 60 * 1000)
        var currentdate=new Date();
		var currdate = new Date((currentdate.getTime() - Addmillisec ))	

    if (document.Wiz.SearchType.value == "Basic")
    {

        if ((document.Wiz.BCheckIn.value =='') || (document.Wiz.BCheckIn.value =='dd/mm/yyyy'))
        {
            alert("Please Select Check In Date");
            //document.Wiz.BCheckIn.focus();
            return false;
        }
        
      if (! isValidDate(document.Wiz.BCheckIn.value))
        return false

    datevaluesp1 = document.Wiz.BCheckIn.value.split("/")
	var chkindate =datevaluesp1[1]+"/"+datevaluesp1[0]+"/"+datevaluesp1[2]

        
        var arrdt1= new Date(chkindate);
        if ( arrdt1 < currdate )
		{	
			alert("Arrival Date must be Greater Than or Equal to " + currentdate)
			//window.document.booking.arr_day.focus();
			return(false);
		} 

    
        if ((document.Wiz.BCheckOut.value =='') || (document.Wiz.BCheckOut.value =='dd/mm/yyyy'))
        {
            alert("Please Select Check Out Date");
            //document.Wiz.BCheckOut.focus();
            return false;
        }
        
        
     if (! isValidDate(document.Wiz.BCheckOut.value))
     return false

    datevaluesp2 = document.Wiz.BCheckOut.value.split("/")
	var chkoutdate =datevaluesp2[1]+"/"+datevaluesp2[0]+"/"+datevaluesp2[2]
	
  		if (Date.parse(chkindate) - Date.parse(chkoutdate) > 0)
		{	
			alert("Check Out Date must be Greater Than Check In Date")
			//window.document.booking.arr_day.focus();
			return(false);
		}    
        if (document.Wiz.BCityXid.value =='null')
        {
            alert("Please Select City");
            document.Wiz.BCityXid.focus();
            return false;
        } 
       /* if (document.Wiz.BHotelQualityXid.value =='null')
        {
            alert("Please Select Hotel quality");
            document.Wiz.BHotelQualityXid.focus();
            return false;
        } 
		*/
        //document.Wiz.SearchType.value = "Basic"
    }
    else
    {
     if ((document.Wiz.ACheckIn.value =='') || (document.Wiz.ACheckIn.value =='dd/mm/yyyy'))
   
        {
            alert("Please Select Check In Date");
            //document.Wiz.ACheckIn.focus();
            return false;
        }
        
              if (! isValidDate(document.Wiz.ACheckIn.value))
                return false

        datevaluesp3 = document.Wiz.ACheckIn.value.split("/")
	    var chkindate1 =datevaluesp3[1]+"/"+datevaluesp3[0]+"/"+datevaluesp3[2]

        
        var arrdt1= new Date(chkindate1);
        if ( arrdt1 < currdate )
		{	
			alert("Arrival Date must be Greater Than or Equal to " + currentdate)
			//window.document.booking.arr_day.focus();
			return(false);
		} 


        
         if ((document.Wiz.ACheckOut.value =='') || (document.Wiz.ACheckOut.value =='dd/mm/yyyy'))
    
        {
            alert("Please Select Check Out Date");
            //document.Wiz.ACheckOut.focus();
            return false;
        } 
        
                  
        if (! isValidDate(document.Wiz.ACheckOut.value))
        return false

        datevaluesp4 = document.Wiz.ACheckOut.value.split("/")
	    var chkoutdate1 =datevaluesp4[1]+"/"+datevaluesp4[0]+"/"+datevaluesp4[2]
	
  		if (Date.parse(chkindate1) - Date.parse(chkoutdate1) > 0)
		{	
			alert("Check Out Date must be Greater Than Check In Date")
			//window.document.booking.arr_day.focus();
			return(false);
		}    
        
        if (document.Wiz.ACityXid.value =='null')
        {
            alert("Please Select City");
            document.Wiz.ACityXid.focus();
            return false;
        } 
        
        /* if (document.Wiz.AHotelQualityXid.value =='null')
        {
            alert("Please Select Hotel quality");
            document.Wiz.AHotelQualityXid.focus();
            return false;
        } 
        */
        
          
    
        
     }
   
    
	

}


/* function chkcity(cityxid)
{
	var objXMLReq = new ActiveXObject( "Microsoft.XMLHTTP" );	 
	document.Wiz.action='ChkCity.asp?Cityxid='+cityxid
	objXMLReq.open( "POST", document.Wiz.action, false );
	objXMLReq.send('home.asp');
	var xml=new ActiveXObject("microsoft.xmldom")
	xml.loadXML(objXMLReq.responseText);
	root=xml.documentElement;
	Qty=root.getElementsByTagName("ReturnQty")
	var qt = Qty(0).text;
	return qt;
}
*/

function lateavailability(idLayer)

{
var frm="document.Wiz"
if (document.Wiz.LCityXid.value =='null')
       {
           alert("Please Select City");
           document.Wiz.LCityXid.focus();
           return
       } 
/*else if (document.Wiz.LZoneXid.value =='null')
       {
           alert("Please Select Zone");
           document.Wiz.LZoneXid.focus();
           return
       }        
  */     
else
	{ 
	 if (document.Wiz.LHotelQualityXid.value !='')
		{
		var lhotelqualityxid=document.Wiz.LHotelQualityXid.value
		document.Wiz.selLhotelqualityxid.value=lhotelqualityxid
		}	
	 var BCityXid=document.Wiz.LCityXid.value
	 document.Wiz.selCityXid.value=BCityXid
	 document.Wiz.SearchType.value="Basic"
	 document.Wiz.target="_top"
	//document.Wiz.action='Booking/LateAvailabilityResult.asp?BCityXid='+BCityXid + "&searchtype=Basic"
	document.Wiz.action='Booking/LateAvailabilityResult.asp'

	 //window.open('Booking/LateAvailabilityResult.asp?BCityXid='+BCityXid + "&searchtype=Basic",'ab','resize=yes,menubars=no,scrollbars=yes,width=780,height=530,left=0,top=0' )
	} 
document.Wiz.submit()					      
}	
/*
if (idLayer=='basic')
	{
	// document.Wiz.ACityXid.value=""
	if (document.Wiz.BCityXid.value =='null')
       {
           alert("Please Select City");
           document.Wiz.BCityXid.focus();
           return
       } 
	 else
		{ 
		 var BCityXid=document.Wiz.BCityXid.value
 		document.Wiz.action='Booking/LateAvailabilityResult.asp?BCityXid='+BCityXid + "&searchtype=Basic"
		 //window.open('Booking/LateAvailabilityResult.asp?BCityXid='+BCityXid + "&searchtype=Basic",'ab','resize=yes,menubars=no,scrollbars=yes,width=780,height=530,left=0,top=0' )
		}
	}
if (idLayer=='advance')
	{
	 //document.Wiz.BCityXid.value=""
	if (document.Wiz.ACityXid.value =='null')
       {
           alert("Please Select City");
           document.Wiz.ACityXid.focus();
           return
       } 
	 else
		{ 
		 var BCityXid=document.Wiz.ACityXid.value
 		 document.Wiz.action='Booking/LateAvailabilityResult.asp?BCityXid='+BCityXid + "&searchtype=Basic"
		 //window.open('Booking/LateAvailabilityResult.asp?BCityXid='+BCityXid + "&searchtype=Basic",'ab','resize=yes,menubars=no,scrollbars=yes,width=780,height=530,left=0,top=0' )
		}
	}
document.Wiz.submit()				
}	*/


function winopen(from)
{
    window.open('Booking/facilities.asp?facilityxid='+document.Wiz.facilityxid.value +'&from=' + from,'','width=450, height=300,scrollbars=yes ,resizable=1,left=200 ,top=100');
}

function setZone(AorB)
{
	var Pid;
	var ShowAllcityYN=document.Wiz.ShowAllcityYN.value
	if (ShowAllcityYN=='Y')
		{	
		if (AorB == 'A')
			Pid=document.Wiz.ACityXid.options[document.Wiz.ACityXid.selectedIndex].value;
		//else if(AorB == 'B')
		//	Pid=document.Wiz.BCityXid.options[document.Wiz.BCityXid.selectedIndex].value;
		//else
		//	Pid=document.Wiz.BCityXid.options[document.Wiz.LCityXid.selectedIndex].value;    
		}
	else if(ShowAllcityYN=="N")	
	{
		 Pid=document.Wiz.BCityXid.value
	}
	var ShowAllzoneYN=document.Wiz.ShowAllzoneYN.value
	if (ShowAllzoneYN=="Y")
	{
	var  Zone =document.Wiz.HZone.value;
	var ZoneXid =document.Wiz.HZoneXid.value;	
	var ZCityXid =document.Wiz.HCityXid.value;	
	
	aLoc = Zone.split('|');
	aLocPid = ZoneXid.split('|');
	aLocCountry = ZCityXid.split('|');

	var b;
	b = aLoc.length;
	
	var flag;
	
	var sLoc;
	sLoc = "";	
	if (AorB == 'A')	
	    sLoc = '<SELECT  name=AZoneXid>';
    else if (AorB == 'B')	
        sLoc = '<SELECT  name=BZoneXid>'; 	    
    else
        sLoc = '<SELECT  name=LZoneXid>'; 	    
	sLoc = sLoc + '<OPTION value="null">Select</OPTION>';
	for(i = 0; i < b; i++)
	{
		if(Pid == aLocCountry[i])
		{
			flag = true;
			sLoc = sLoc + '<option value="'+aLocPid[i]+'">'+aLoc[i]+'</option>';
		}
		if(flag == true && i < b)
		{
			if(Pid != aLocCountry[i + 1])
			{
				break;
			}
		}
	}
	
	sLoc = sLoc + '</select>';
	if (AorB == 'A')	
	    document.all.ZoneID.innerHTML = sLoc;
    //else if (AorB == 'B')
     //   document.all.BZoneID.innerHTML = sLoc;	    
    //else
     //   document.all.LZoneID.innerHTML = sLoc;	     
//	alert("anand")
    if (AorB == 'A')	
	    if (document.Wiz.AZoneXid.options.length > 1)
	        document.Wiz.AZoneXid.disabled = false;
	    else
	        document.Wiz.AZoneXid.disabled = true;
	/* else if(AorB == 'B')
	   if (document.Wiz.BZoneXid.options.length > 1)
	        document.Wiz.BZoneXid.disabled = false; 
	    else
	        document.Wiz.BZoneXid.disabled = true;  */       
	/* else
		if (document.Wiz.LZoneXid.options.length > 1)
	        document.Wiz.LZoneXid.disabled = false;
	    else
	        document.Wiz.LZoneXid.disabled = true;  */        
	}
	var showHotelChainYN=document.Wiz.showHotelChainYN.value
	if (showHotelChainYN=='Y')
	{
		if(AorB=='A')
		{
		getHotelchain(Pid)
		}	
	}		
}


function SearchCity(citydrop,citysearch,AorB)
{
var uppercaseOptionValue,uppercaseSearchValue
for(i=0;i<citydrop.options.length;i++)
	{
			uppercaseOptionValue = citydrop.options[i].innerText.toUpperCase()
			uppercaseSearchValue = citysearch.value.toUpperCase()
			if(uppercaseOptionValue.indexOf(uppercaseSearchValue) == 0)
			{
			citydrop.selectedIndex = i
			break;
			}
			
	}
if (AorB == 'A')
    setZone('A')
else if(AorB == 'B')
    setZone('B')
else
	setZone('L')	    
}

function isValidDate(dateValue)
 {
    var dateStr = dateValue;
	//var datePat =  /^(\d{1,2})(\/)(\d{1,2})\2(\d{4})$/;
	var datePat = /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{4})$/;
	var matchArray = dateStr.match(datePat); // is the format ok?
//	alert(matchArray)
	if (matchArray == null)
		 {
			 alert("Date is not in a valid format.")
			 return false;
		 }


    
    datevaluesp = dateValue.split("/")
	month = datevaluesp[1]; // parse date into variables
	day = datevaluesp[0];
	year = datevaluesp[2];
	    
	if (month < 1 || month > 12)
        
	 { // check month range
//                alert(dateValue);
		alert("Month must be between 1 and 12.");
		return false;
	 }
	if (day < 1 || day > 31) 
	 {
		alert("Day must be between 1 and 31.");
		return false;
	 }
	
	
	if ((month==4 || month==6 || month==9 || month==11) && day==31) 
	{
		alert("Month " + month +" doesn't have 31 days!")
		return false
	}
	if(month == 2 )
	{
		var leap ;
		leap = year % 4 
		if ( leap == 0 && day > 29 ) 
		{
		alert("Month February doesn't have more than 29 days!");
			return(false) ;	
		}
		else if ( leap != 0 && day > 28 )
		{
		alert("Month February doesn't have more than 28 days!");
			return(false) ;	
		}	
			  
	}
    return(true)
  }

function isValidFormat(dateValue,txtbal)
{
    if (dateValue!='')
    {
        var dateStr = dateValue;
	    var datePat = /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{4})$/;
	    var matchArray = dateStr.match(datePat); // is the format ok?
	    if (matchArray == null)
	    	 {
	    		 alert("Date is not in a valid format.")
	    		 eval(txtbal+".value = ''");
	    		 return false;
	    	 }
	    else 
	        return true;	 
	}
	else
	    return true;    
}

function makeblank(txtdate)
{
    if (eval("document.Wiz."+txtdate+".value=='dd/mm/yyyy'"))
    
       eval("document.Wiz."+txtdate+".value=''")
}
//-->
