// JScript File

var LoadXml;
var LoadTrustXml;
var ci="ci"
var co="co";
var Id="HL"+document.getElementById('HId').value;
var totalguest=5;

Read(Id)


 var ArrDate=document.f1.month.value;
   var DepDate=document.f1.monthOut.value;
   var ArArr=new Array();
   var DpArr=new Array();
   ArArr=ArrDate.split(":");
   DpArr=DepDate.split(":");
   
  


 
 
  function disp_div()
  {
 if(document.getElementById("Opt").style.display=='none')
{
var w=document.getElementById("Opt").style.display='block';
var q=document.getElementById("Exp");
q.src='../../images/minus1.jpg';
}
else
{
var w=document.getElementById("Opt").style.display='none'//visibility='hidden';
var q=document.getElementById("Exp");
q.src='../../images/plus1.jpg';
}
  }
  
  
  
 
 function getMonthName(s)
            {
            if(s==0)
            return "JAN";
             if(s==1)
            return "FEB";
             if(s==2)
            return "MAR";
             if(s==3)
            return "APR";
             if(s==4)
            return "MAY";
            if(s==5)
            return "JUN";
             if(s==6)
            return "JUL";
              if(s==7)
            return "AUG";
            
             if(s==8)
            return "SEP";
             if(s==9)
            return "OCT";
            
             if(s==10)
            return "NOV";
            
             if(s==11)
            return "DEC";
            
             
            }
      function isLastDate1(date,month,year)
            {
          // alert(date);
            var  strReturn="false";
            
          
             if(month==0||month==2||month==4||month==6||month==7||month==9||month==11)
            {
            
            
            if(date==31)
            {
            strReturn="true";
            }
            }
         if(month==3||month==5||month==8||month==10)
            {
           
            if(date==30)
             {
				strReturn="true";
			 }
            }
            
             if(month==1)
            {
            
           
            if(year%4==0)
            {
				if(date==29)
				{
					strReturn="true";
				}
            }
            else
            {
				if(date==28)
				{
				 strReturn="true";
				}
            }
           
            
            }
            
            
            return strReturn;
            }
           
          
               
            
            
             function isLastDateBefore(date,month,year)
            {
           
            var strReturn="false";
            
          
             if(month==0||month==2||month==4||month==6||month==7||month==9||month==11)
            {
            
            
            if(date==30)
            {
            strReturn="true";
            }
            }
         if(month==3||month==5||month==8||month==10)
            {
           
            if(date==29)
             {
				strReturn="true";
			 }
            }
            
             if(month==1)
            {
            
           
            if(year%4==0)
            {
				if(date==28)
				{
					strReturn="true";
				}
            }
            else
            {
				if(date==27)
				{
				 strReturn="true";
				}
            }
            
            
            }
            
            return strReturn;
            }
            
     
            	
		
		 function get_Month_Number(monthnumber)
     {
      var MonName;
      switch(monthnumber)
       {
        case 1:
              MonName="01";
              break;
        case 2:
              MonName="02";
              break;
        case 3:
              MonName="03";
              break;
        case 4:
              MonName="04";
              break;
        case 5:
              MonName="05";
              break;
        case 6:
              MonName="06";
              break;
        case 7:
              MonName="07";
              break;
        case 8:
              MonName="08";
              break;
        case 9:
              MonName="09";
              break;
        case 10:
              MonName="10";
              break;
        case 11:
              MonName="11";
              break;
        case 12:
              MonName="12";
              break;
       }
      return MonName;
     }
     
     function get_date_number(dateid)
     {
     var get_value;
           var get_number;
           get_number=dateid.length;
          if(get_number==1)
          {
           get_value="0"+dateid;
          }
          else
          {
          get_value=dateid;
          }
        return get_value;
     }
		
            function opentrust()
            {
            var totoccupancy;
            var url;
            var childDetails=null;
            var ArrDate=document.f1.month;
            var DepDate=document.f1.monthOut;
            var one_day=1000*60*60*24;
            var ArArr=new Array();
            var DpArr=new Array()
            var ymIn=ArrDate.options[ArrDate.selectedIndex].value;
            var ymOut=DepDate.options[DepDate.selectedIndex].value;
            var Valid_Char="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()_,+|}{<>?/.:;[]=''-~`\\ "+'"';
            //alert(ymOut);
            ArArr=ymIn.split(":");
            DpArr=ymOut.split(":");
           
            var In=new Date(ArArr[1],ArArr[0],document.f1.date.value);
            //alert(parseInt(ArArr[1])+1);
            //alert(In.getMonth());
            //alert(In.getFullYear());
            var Out=new Date(DpArr[1],DpArr[0],document.f1.dateOut.value);
            var Diff=Math.ceil((Out.getTime()-In.getTime())/(one_day)); 
            //var DIn=new Date(2007,11,21);
            var cIn=new Date(myscriptTime.getFullYear(),myscriptTime.getMonth(),myscriptTime.getDate()+1);
            var cOut=new Date(myscriptTime.getFullYear()+1,myscriptTime.getMonth(),myscriptTime.getDate()-1);
                   
            if(document.f1.date.value=="")
             {
             alert("Please Enter Arrival Date");
             document.f1.date.focus();
             return false;
             }
            // else if(Char_Check(document.f1.date.value,Valid_Char)==false || isLastDate1(document.f1.date.value,ArArr[0],ArArr[1])=="false" || document.f1.date.value==0)
            // {
            // alert("Invalid Arrival Date");
            //document.f1.date.focus();
            // }
//            else if(In<cIn)
//            {
//            alert("Arrival Date should be Greater than Current Date");
//            document.f1.date.focus();
//            }
            else if(document.f1.dateOut.value=="")
              {
               alert("Please Enter Departure Date");
               document.f1.dateOut.focus();
               return false
              }
            else if(Out>cOut)
            {
            var s=new Date(cOut.setDate(cOut.getDate()+1));
            alert("Departure date should be less than  "+ (parseInt(s.getDate()))+"-"+getMonthName(s.getMonth())+"-"+s.getFullYear());
            document.f1.dateOut.focus();
            return false
            }
            else if(In>=Out)
            {
            alert("Departure date should be greater than arrival date");
            document.f1.dateOut.focus();
            return false
            return false
            }
             else if(Diff>30)
             {
             var htelID;
             if(document.f1.HId.value.indexOf("OFF")!=-1)
             htelID=document.f1.HId.value.substr(0,document.f1.HId.value.length-3);
             else
             htelID=document.f1.HId.value;
             if(htelID!="TLONBG")
             {
             if(htelID!="TBOMWM")
             {
             alert("No of nights should be less than or equal to 30 days");
             document.f1.dateOut.focus();
             return false
             }
             }
             }
           else if(Diff<30)
           {
             var htelID;
             if(document.f1.HId.value.indexOf("OFF")!=-1)
             htelID=document.f1.HId.value.substr(0,document.f1.HId.value.length-3);
             else
             htelID=document.f1.HId.value;
             if(htelID=="TBOMWM")
             {
             alert("No of Nights should be greater than or equal to 30.");
             document.f1.dateOut.focus();
             return false
             }
           
           }  
           var room;
          var j;
           
          if(document.f1.Guests.options[document.f1.Guests.selectedIndex].value<totalguest)
          {
          
             for(i=1;i<=1;i++)
              {
                var chid="cmbchildcnt"+i;
                  if(i==1)
                totoccupancy=parseInt(document.getElementById(chid).value)+parseInt(document.f1.Guests.value)
               if(document.getElementById(chid).value>=0)
                {
                 
                if(childDetails==null)
                   childDetails="&prsNumChildren="+document.getElementById(chid).value;
                else
                childDetails+="&prsNumChildren="+document.getElementById(chid).value;
                    //alert(room);
                    for(j=1;j<=document.getElementById(chid).value;j++)
                     {
                   
                           if(i==1)
                              {
                                  var ageId="childagecmbchildcnt"+(parseInt(j)-1);
                                   //alert(ageId);
                               }
                            else
                            {
                                    var ageId="childagecmbchildcnt"+i+(j-1);
                                   // alert(document.getElementById(ageId).value);
                            }
                  if(document.getElementById(ageId).value=="<1")
                  {
                  childDetails+="&prsRoomAge=0";
                  }
                  else
                  {          
                 childDetails+="&prsRoomAge="+document.getElementById(ageId).value;
                  }
                       }
                 }
               }
               
          }
            else
          {
         totoccupancy=document.f1.Guests.options[document.f1.Guests.selectedIndex].value
          }
              
          //  totoccupancy=document.f1.Guests.options[document.f1.Guests.selectedIndex].value
           ADate=ArArr[1]+"-"+(parseInt(ArArr[0])+1)+"-"+document.f1.date.value;
           DDate=DpArr[1]+"-"+(parseInt(DpArr[0])+1)+"-"+document.f1.dateOut.value;
           HId=document.f1.HId.value
           nofGuest=totoccupancy;
        //   roomCount=document.f1.cmbRoomcount.value;
        roomCount=1;
           var Actype=document.getElementById("cmbaccountType").value; 
           if(document.f1.accountId.value!="" || Actype!="-1")
           { 
            if(document.f1.accountId.value==0)
              {
                alert("Please enter the Account Id");
                document.f1.accountId.focus();
                return false;
              }
              if(Actype=="-1")
              {
               alert("Please select account type");
               document.getElementById("cmbaccountType").focus();
               return false;
              }
           }
             
           GotoReservation(HId,ADate,DDate,cityId,countId,nofGuest,roomCount,document.f1.accountId.value,document.getElementById('rateAccesscode').value,childDetails,Actype,"HotelPages");
        
         
                   
            }
     
    
     
        
             
             
		 
		 
		
	

function getMonthValue(mon,yr)
{       
       return mon+":"+yr;
 }

 
 function setcType()
{
document.getElementById("Exp").style.cursor='pointer';
document.getElementById("indate").style.cursor='pointer';
document.getElementById("outdate").style.cursor='pointer';
}
function invokeCal(vtype)
{
//alert("1");
var ArrDate=document.f1.month.value;
   var DepDate=document.f1.monthOut.value;
   var ArArr=new Array();
   var DpArr=new Array();
   ArArr=ArrDate.split(":");
   DpArr=DepDate.split(":");
    var dtArrival;
	frmname =document.f1.name;
	//alert(frmname);
	if (vtype=='ci')
	{
	 var dd=document.f1.date.value
	 var mm=parseInt(ArArr[0])+1;
	 var yy=ArArr[1];
	// alert(mm);
	 GoToCalendar('Cal','CHECK-IN',frmname,dd,mm,yy,dtArrival)
	}
	else if (vtype=='co')
	{
	 var mm=parseInt(ArArr[0])+1;
	 var yy=ArArr[1];
	  var dd=parseInt(document.f1.date.value);
		
	 dtArrival = mm+"-"+yy+"-"+dd
	 GoToCalendar('Cal','CHECK-OUT',frmname,dd,mm,yy,dtArrival)
	}
}

function GoToCalendar(CalName,LinkName,frm,day,month,year,dtArrival) {
		var myFrm;
		var selDate;
		var thisWinFrm;
		
		thisWinFrm=document.forms[frm];
		
		myFrm=thisWinFrm;
				
		//if(LinkName=='CHECK-IN') {
			selDate=month + " " + year + " " + day
		//}		
		myselDate=selDate.split(' ')
		selDate=''
		
		for(i=0;i<myselDate.length;i++) {
			if(selDate=='') {
				selDate=myselDate[i]
			}
			else {
				selDate=selDate+ '-' +myselDate[i]
			}
		}		
	
		calendar_url="../../TajHotelFinder/Res_Calendar.aspx?formName="+frm+"&formCtrl="+LinkName+"&selDate="+selDate + "&selDate1=" + dtArrival
		
		if(navigator.userAgent.indexOf("Firefox")!=-1)
		MM_openwin(calendar_url,"150px","224px","400px","200px");
		else if(navigator.userAgent.indexOf("MSIE")!=-1)
		MM_openwin(calendar_url,"188px","240px","400px","200px");
		else
		MM_openwin(calendar_url,"165px","232px","400px","200px");
	}
	function MM_openwin(MM_file,MM_height,MM_width,left,top)
{
   MM_config=""
   MM_config+="toolbar=no,";
   MM_config+="location=no,"
   MM_config+="directories=no,";
   MM_config+="status=no,"
   MM_config+="menubar=no," //Not on Apple Mac for obvious reasons
   MM_config+="scrollbars=no,"
   MM_config+="resizable=no," //Mac windows are always resizable
   MM_config+="copyhistory=no,"
   MM_config+="width="+MM_width+","
   MM_config+="left="+left+","
   MM_config+="top="+top+","
   MM_config+="height="+MM_height
   var MM_win=open(MM_file,"",MM_config);
   MM_win.focus();
}

function calendarCall(formCtrl,myMonthYear,dtD) 
              {	
            
	 var str=eval(myMonthYear.split(' '));
	 var str1=str[0].slice(0,3);

	 putdate(dtD,str1,str[1],formCtrl);
	}
	
	
	function putdate(dd,mm,yy,ctrlname)
{

var cOut=new Date(myscriptTime.getFullYear()+1,myscriptTime.getMonth(),myscriptTime.getDate()-1);

var mNum=getMonthNumber(mm.toUpperCase());

var Out=new Date(yy,mNum,dd);
var my=mm.toUpperCase()+" "+yy;
var currform=document.f1;



	if (ctrlname == 'CHECK-IN')
	{
	
		//set year
		for(i=0;i<currform.month.options.length;i++)
		{
		
			if (currform.month.options[i].text ==my){
			
				currform.month.options[i].selected = true;
				break;}
		}
	
			onchangepopulateIndate();
		for(i=0;i<currform.date.options.length;i++)
		{
	
			if (currform.date.options[i].text ==dd){
				currform.date.options[i].selected = true;
				break;}
		}
		
			changeDate("date","month");
		
	}
	
	if (ctrlname == 'CHECK-OUT')
	{
	if(Out>cOut)
            {
            alert("Departure Date should be less than  "+ (parseInt(cOut.getDate())+1)+"-"+getMonthName(cOut.getMonth())+"-"+cOut.getFullYear());
            return false;
          
            }
  
	

	for(i=0;i<currform.monthOut.options.length;i++)
		{
	        	if (currform.monthOut.options[i].text ==my){
				currform.monthOut.options[i].selected = true;
				break;}
		}
onchangepopulateOutdate();

	
	for(i=0;i<currform.dateOut.options.length;i++)
		{
			if (currform.dateOut.options[i].value ==dd){
				currform.dateOut.options[i].selected = true;
				break;}
		}
	}
	
}

function getMonthNumber(s)
            {
            if(s=="JAN")
            return 0;
             if(s=="FEB")
            return 1;
             if(s=="MAR")
            return 2 ;
             if(s=="APR")
            return 3;
             if(s=="MAY")
            return 4;
            if(s=="JUN")
            return 5;
             if(s=="JUL")
            return 6;
              if(s=="AUG")
            return 7;
            if(s=="SEP")
            return 8;
             if(s=="OCT")
            return 9;
            if(s=="NOV")
            return 10;
            if(s=="DEC")
            return 11;
            
             
            }
            
            

 


 
 function Read(Id)
 {
   if(navigator.appName=="Microsoft Internet Explorer")
    {
      ReadXml1(Id);
    }
    else
    {
       ReadXml(Id)
    }
 }
function ReadXml(Id)
 {
     var XmlHTTP = null;
    var Possibles = {0: "XMLHttpRequest()", 1: "ActiveXObject('Microsoft.XMLHttp')", 2:"ActiveXObject('MSXML2.XMLHttp')", 3:"ActiveXObject('MSXML2.XMLHttp.3.0')", 4:"ActiveXObject('MSXML2.XMLHttp.4.0')", 5:"ActiveXObject('MSXML2.XMLHttp.5.0')", 6:"ActiveXObject('MSXML2.XMLHttp.6.0')",7:"ActiveXObject('Msxml.DOMDocument')", 8:""};
    var Option = 0;
    while(XmlHTTP === null){
        XmlHTTP = eval("new " + Possibles[Option]);
      
    }
if(XmlHTTP === null)
    return false;
XmlHTTP.open("get", "../../Common_Inc/link.xml", false);
XmlHTTP.send("");
LoadXml = XmlHTTP.responseXML;
ManipulateXML(Id);
}
  
function ReadXml1(Id) 
{ 

	if( window.ActiveXObject && /Win/.test(navigator.userAgent) )
	{ 
		LoadXml = new ActiveXObject("Msxml.DOMDocument"); 
		LoadXml.async = false; 
		LoadXml.onreadystatechange = function () 
		{ 
		    if (LoadXml.readyState == 4) ManipulateXML(Id); 
		} 
		LoadXml.load("../../Common_Inc/link.xml"); 
	} 
	else if( document.implementation && document.implementation.createDocument ) 
	{ 
		LoadXml = document.implementation.createDocument("","",null); 
		LoadXml.async=false; 
		var loaded = LoadXml.load("../../Common_Inc/link.xml"); 
		moz=1;
		if (loaded) 
		{ 
			ManipulateXML(Id);
		} 
	} 
	else 
	{ 
		alert("Your browser can\'t handle this script"); 
		return; 
	} 
}



function showchild()
{

var pos;
if(navigator.userAgent.indexOf("Safari")!=-1)
pos=6;
else if(navigator.userAgent.indexOf("Firefox")!=-1)
pos=4;
else
pos=3;
    
var strroom;
var strnoofchildren;
document.getElementById('cntchildren').innerHTML="";
var gusetroom=document.getElementById("Guests");
document.getElementById("agechild").innerHTML="";
var roomcount=1;//document.getElementById("cmbRoomcount");
 if(gusetroom.value!=5)
  {
     document.getElementById('child').style.display='block';
     var child=null;
     if(gusetroom.value<4)
     child=2;
     else
     child=totalguest-gusetroom.value;
    // alert(child);
     for(j=0;j<=child;j++)
     {
     if(strnoofchildren==null)
     strnoofchildren="<option value='"+j+"'>"+j+"</option>";
     else
     strnoofchildren+="<option value='"+j+"'>"+j+"</option>";
     }
     for(i=1;i<=1;i++)
     {
     if(strroom==null)
     strroom="<table width='100%' cellpadding='1' cellspacing='0' border='0' ><tr vAlign='top'><td style='padding-top:"+pos+"px' width='45%'><span class='darkb'>Children&nbsp;</span><select id='cmbchildcnt"+i+"' name='cmbchildcnt'"+i+" onchange=showAge('age"+i+"',cmbchildcnt"+i+");>"+strnoofchildren+"</select></td><td id='age"+i+"' width='55%'></td></tr>";
     else
     strroom+="<tr vAlign='top'><td style='padding-top:"+pos+"px'><span class='darkb'>Children&nbsp;</span><select class='test' id='cmbchildcnt"+i+"' name='cmbchildcnt"+i+"' onchange=showAge('age"+i+"',cmbchildcnt"+i+");>"+strnoofchildren+"</select></td><td id='age"+i+"'></td></tr>";
     break;
     }
     strroom+="</table>";
     if(document.getElementById('cntchildren')!=null)
      {
        document.getElementById('cntchildren').innerHTML=strroom;//"<select id='cmbchildcnt' name='cmbchildcnt'><option value='0'>0</option><option value='1'>1</option></select>";
      }  
      
  }
        else
         {
         document.getElementById('child').style.display='none';
         document.getElementById('cntchildren').innerHTML="";
         }
}

function showAge(tdid1,childcnt)
{

var tdid=document.getElementById(tdid1);
tdid.innerHTML="";

var strage='';
var strrooms;

if(childcnt.value!=0)
  {
 
  
     document.getElementById("agechild").innerHTML="Age of Children";
     for(m=0;m<=16;m++)
     {
     if(strrooms==null)
     strrooms="<option value='<1'><1</option>";
     else
     strrooms+="<option value='"+m+"'>"+m+"</option>";
     }
    var t=0;
    strage+="<table cellpadding='0' cellspacing='0' border='0'>"
    strage+="<tr vAlign='top'>"
     for(k=0;k<childcnt.value;k++)
     {
     strage+="<td align='left' style='padding-bottom:1px;'>";
      if(t!=0)
      if(t%2==0)
      strage+="<tr vAlign='top'><td style='padding-top:1px;' align='left'>"
      if(strage==null)
      strage="<select id='childage"+childcnt.name+k+"' name='childage"+childcnt.name+k+"'>"+strrooms+"</select>";
      else
      strage+="&nbsp<select id='childage"+childcnt.name+k+"' name='childage"+childcnt.name+k+"'>"+strrooms+"</select>";
      strage+="</td>";
      
      t++;
     }
 
   strage+="</tr></table>"
    
   
    tdid.innerHTML=strage;
    strage=null;
   
    
  }
else
 {

 if(document.getElementById("childagecmbchildcnt0")==null && document.getElementById("childagecmbchildcnt1")==null && document.getElementById("childagecmbchildcnt10")==null && document.getElementById("childagecmbchildcnt11")==null && document.getElementById("childagecmbchildcnt20")==null && document.getElementById("childagecmbchildcnt21")==null && document.getElementById("childagecmbchildcnt30")==null && document.getElementById("childagecmbchildcnt31")==null && document.getElementById("childagecmbchildcnt40")==null && document.getElementById("childagecmbchildcnt41")==null)
 {

    document.getElementById("agechild").innerHTML="";
 }
     //document.getElementById("tdid").innerHTML="";
     strage=null;
      tdid.innerHTML="";
 }

}

function ManipulateXML(resortid)
{

var headID = document.getElementsByTagName("head")[0];         
var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = '../Booker.css';
cssNode.media = 'screen';
headID.appendChild(cssNode);

var strTitle

//var design="<link href='../Booker.css' rel='Stylesheet' />";
var design="<table class='Tab' border=0 cellpadding=1 cellspcing=0 width='220px' style='table-layout:fixed;'><tr><td class=txt>Check Rates & Availability<hr class='hcolor'></td></tr><tr><td><table border=0 cellspacing=2 cellpadding=0 width='210px'>"
design+="<input type='hidden' name=language id=language value=en><input type='hidden' name='ccpSelectCountry' id='ccpSelectCountry'><input type='hidden' name='ccpSelectCity' id='ccpSelectCity'><input type='hidden' name='ccpSelectHotel' id='ccpSelectHotel'><input type='hidden' name='calArrivalDateField' id='calArrivalDateField'><input type='hidden' name='calDepartureDateField' id='calDepartureDateField'><input type='hidden' name=prsRoomCount id=prsRoomCount value=3><input type='hidden'name='occupancy' id='occupancy'><input type='hidden' name=prsRoomCount id=prsRoomCount>";
design+="<tr><td class='darkb' vAlign='top' colspan=3 width='100%'>Arrive:</td></tr><tr><td width='90px' vAlign='bottom' align='left'><select id='month' name='month' onchange='onchangepopulateIndate()'><option value='0'>Select a Month</option>"
design+="</select></td><td vAlign='bottom' width='50px' align='center'><select id='date' name='date' onchange=changeDate('date','month');><option value=''></option></select></td><td vAlign='bottom' width='60px' align='left' style='padding-left:4px;'><img id='indate' name='indate' src='../../images/hcalc.jpg' onclick='invokeCal(ci);' onmouseover='setcType();' onmouseout='setcType();'></td></tr><tr><td class='darkb' colspan=3 vAlign='top' width='100%'>Depart:</td></tr><tr><td vAlign='bottom' width='90px' align='left'><select id='monthOut' name='monthOut' onchange='onchangepopulateOutdate()'>"
design+="<option value='0'>Select a Month</option></select></td><td vAlign='bottom' width='50px' align='center'><select id='dateOut' name='dateOut' onchange='checkDate();'><option value=''></option></select></td><td vAlign='bottom' width='60px' align='left' style='padding-left:4px;'><img id='outdate' src='../../images/hcalc.jpg' onclick='invokeCal(co);' name='outdate' onmouseover='setcType();' onmouseout='setcType();'>"
design+="</td></tr>";
//design+="<tr><td colspan=3 class='darkb' width='100%' vAlign='top'>Room(s)</td></tr>"
//design+="<tr><td colspan='3'><select id='cmbRoomcount' name='cmbRoomcount' onchange='showchild();'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select></td></tr>"
design+="<tr><td class='darkb' vAlign='top' width='100%' colspan='3'>Adults</td></tr><tr>"
design+="<td width='100%' colspan=3'><select id='Guests' name='guests' onchange='showchild();'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option></select></td></tr>"
design+="<tr><td vAlign='top' width='100%' colspan='3'>";
design+="<div id='child' style='display:none'><table width='100%' border='0' cellpadding='0' cellspacing='0'><tr style='height:10px;'><td class='darkb' width='49%'></td><td id='agechild' class='darkb' width='51%' colspan='2'></td></tr><tr>"
design+="<tr><td class='darkb' vAlign='top' width='50%' colspan='3' id='cntchildren' name='cntchildren'></td></tr></table></div></td></tr><tr>"
design+="<tr><td colspan=3 width='90%'><hr class='hcolor'/>"
design+="<img id='Exp' name='Exp' src='../../images/plus1.jpg' onclick='disp_div();' onmouseover='setcType();' onmouseout='setcType();'/>&nbsp;<span class='darkb'>Optional Information</span><div style='display:none' id='Opt'><table border='0' width='100%' cellpadding='0' cellspacing='0'><tr><td class='darkb' vAlign='top' width='60%'>Account ID</td><td align='left' width='40%' style='padding-bottom:3px;'><input type='text' id='accountId ' name='accountId' style='width:60px;height:20px' />"
design+="</td></tr><tr><td class='darkb' vAlign='top'>Rate Access Code</td><td align='left'><input type='text' id='rateAccesscode' name='rateAccesscode' style='width:60px;height:20px' /></td></tr>";
design+="<tr><td colspan='3' class='darkb' vAlign='top' style='padding-bottom:3px;'>Select Account Type</td></tr><tr><td colspan='2' vAlign='top'><select id='cmbaccountType' name='cmbaccountType'>"+fillAccounttype+"</select></td></tr></table></div>";
design+="<hr class='hcolor'/></td></tr><tr><td colspan='3' vAlign='middle' align='center'>"
design+="<input type='image' src='../images/submit.gif' id='link' name='link' onclick='opentrust();return false;' /></table></td></tr></table>"


var j=0;
strTitle = LoadXml.getElementsByTagName("HotelLinks")[0]; 
var cap;
var lnk
var type;
var size;
var tooltip;

    if(strTitle.getElementsByTagName('Hotel').length>0)
    {
    //var temp="<table width='220px' cellpadding='2' cellspacing='0' class='quick_table' vAlign='middle'><tr><td align='left'><ul>"
    var temp="<table width='220px' cellpadding='2' cellspacing='0' class='quick_table' vAlign='middle'><tr style='height:10px;'><td colspan='2'></td></tr>"
            for(var i=0; i<strTitle.getElementsByTagName('Hotel').length; i++) 
            {
              
                    if(strTitle.getElementsByTagName('Hotel')[i].getAttribute("HotelId")==resortid)
                    {
                    temp+="<tr vAlign='top'>"
                    cap=strTitle.getElementsByTagName('Hotel')[i].getAttribute("caption");
                    lnk=strTitle.getElementsByTagName('Hotel')[i].getAttribute("link");
                    type=strTitle.getElementsByTagName('Hotel')[i].getAttribute("displaytype");
                    size=strTitle.getElementsByTagName('Hotel')[i].getAttribute("size");
                    countId=strTitle.getElementsByTagName('Hotel')[i].getAttribute("countryId");
                    cityId=strTitle.getElementsByTagName('Hotel')[i].getAttribute("CityId");
                    tooltip=strTitle.getElementsByTagName('Hotel')[i].getAttribute("tooltiptext");
                    googelana=strTitle.getElementsByTagName('Hotel')[i].getAttribute("googleanalytic");      
//                        if(type=="zoomOut")
//                        {
//                          if(size!=null)
//                          temp+="<li class='ieli'><a href='"+lnk+"' class='prim' rel='lyteframe' rev='"+size+"'>"+cap+"</a></li>";
//                          else
//                          temp+="<li class='ieli'><a href='"+lnk+"' class='prim' rel='lyteframe' rev='width: 740px; height: 490px; scrolling:no;'>"+cap+"</a></li>";
//                          
//                        }
//                        else
//                        {
//                            if(cap!=null)
//                            temp+="<li class='ieli'><a href='"+lnk+"' class='prim'>"+cap+"</span></a></li>";
//                        }


                         if(type=="zoomOut")
                        {
                          if(size!=null)
                          temp+="<td class='More' style='padding-top:4px;'>&raquo;</td><td><a href='"+lnk+"' class='prim' rel='lyteframe' rev='"+size+"'>"+cap+"</a></td>";
                          else
                          temp+="<td class='More' style='padding-top:4px;'>&raquo;</td><td><a href='"+lnk+"' class='prim' rel='lyteframe' rev='width: 740px; height: 490px; scrolling:no;'>"+cap+"</a></td>";
                          
                        }
                        else
                        {
                       // alert(tooltip);
                            if(cap!=null)
                            {
                            if(tooltip!=null)
                            temp+="<td class='More' style='padding-top:4px;'>&raquo;</td><td><a title='"+tooltip+"' onclick="+googelana+" href="+lnk+" class='prim' >"+cap+"</a></td>";
                            else
                            temp+="<td class='More' style='padding-top:4px;'>&raquo;</td><td><a onclick="+lnk+" href='javascript:void(0);' class='prim'>"+cap+"</a></td>";
                            }
                        }
                    temp+="</tr>"
                    }
            } 
   // temp+="</ul></td></tr></table>";
   temp+="<tr style='height:10px;'><td colspan='2'></td></tr></table>";
   
    }
   

if(temp.indexOf("href")==-1)
document.write(design+"<br><script language='javascript' src='../../Common_Inc/gotobooker.js'></script>");
else
document.write(design+temp+"<br><script language='javascript' src='../../Common_Inc/gotobooker.js'></script>");
document.getElementById('ccpSelectCountry').value=countId;
document.getElementById('ccpSelectCity').value=cityId;



}


function fillAccounttype()
{
var actype="<option value='-1'>Please select</option>";
actype+="<option value='travelagency-agent-'>Travel Agency/Guest guarantees</option>";
actype+="<option value='travelagency-agent-A'>Travel Agency/Agency guarantees</option>";
actype+="<option value='travelagency-guest-'>Guest</option>";
actype+="<option value='travelagency-company-A'>Company</option>";
return actype;


}

            


function checkDate()
{
            var ArrDate=document.f1.month;
            var DepDate=document.f1.monthOut;
            var one_day=1000*60*60*24;
            var ArArr=new Array();
            var DpArr=new Array()
            var ymIn=ArrDate.options[ArrDate.selectedIndex].value;
            var ymOut=DepDate.options[DepDate.selectedIndex].value;
            //var Valid_Char="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()_,+|}{<>?/.:;[]=''-~`\\ "+'"';
            //alert(ymOut);
            ArArr=ymIn.split(":");
            DpArr=ymOut.split(":");
           
            var In=new Date(ArArr[1],ArArr[0],document.f1.date.value);
            //alert(parseInt(ArArr[1])+1);
            //alert(In.getMonth());
            //alert(In.getFullYear());
            var Out=new Date(DpArr[1],DpArr[0],document.f1.dateOut.value);
            var Diff=Math.ceil((Out.getTime()-In.getTime())/(one_day)); 
            if(In>=Out)
            {
            alert("Departure date should be greater than arrival date");
            document.f1.dateOut.focus();
   
            return false
            
            }

}
   

            
	 
 function openpopup(filename,wd,ht,top,lft)
{
//var filename="summer_experience.htm";
var Offerwin;
if(filename!="" ||filename!=null)
Offerwin=window.open(filename,"offer","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+wd+",height="+ht+",top="+top+",left="+lft);
Offerwin.focus();


}
function offerLink_fn2()
{
	window.open("offers.htm","Young","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=760,height=600,top=80,left=120");
}


function offerLink_fn1()
{

var countId;
 var cityId
 var strTitle;

strTitle = LoadXml.getElementsByTagName("HotelLinks")[0]; 
  if(strTitle.getElementsByTagName('Hotel').length>0) 
   { 
     for(var i=0; i<strTitle.getElementsByTagName('Hotel').length; i++) 
      {
        if(strTitle.getElementsByTagName('Hotel')[i].getAttribute("HotelId")==Id)
           {
                    countId=strTitle.getElementsByTagName('Hotel')[i].getAttribute("countryId");
                    cityId=strTitle.getElementsByTagName('Hotel')[i].getAttribute("CityId");
                    break;
            }        
                    
       }
//document.location.href = "https://www.trustinternational.com/mBooker/taj/2B?LANGUAGE=en&i=TajHolidays&property=TXL-TJ-"+Id;
   }
   
   window.open("https://www.luxuryexplorer.com/hotels/taj/ibe/TajHolidays/main.html?ccpSelectCity=" +cityId +"&ccpSelectCountry="+countId+"&ccpSelectHotel=TJ%2D"+Id+"&language=EN&quick=page1");
     
     /*
   //if(Id == 'HLTJDHUB')
    //document.location.href="http://cypress/tajbeta/Palace/Umaid%20Bhawan%20Palace,JODHPUR/sploffers.asp";  
   //else if(Id == 'HLTJAIRP')        
     //document.location.href="sploffers.asp";
   //if(Id == 'HLTUDRTL')     
     //   document.location.href="http://58.68.25.35/Tajbeta/Palace/Taj%20Lake%20Palace,UDAIPUR/sploffers.asp"; 
         //else if(Id == 'HLTBOMTM')     
           //document.location.href="https://www.luxuryexplorer.com/hotels/taj/ibe/HLTBOMTM/main.html?rateAccessCode=*PQ$"; 
   else 
   {
        //alert(Id);
     document.location.href="https://www.luxuryexplorer.com/hotels/taj/ibe/TajHolidays/main.html?ccpSelectCity=" +cityId +"&ccpSelectCountry="+countId+"&ccpSelectHotel=TJ%2D"+Id+"&language=EN&quick=page1" ;
     }*/
 }  

function opennewwindow()
{
	window.location.href="offers.htm";
}
function OpenJivaSpa(cityVal)
{
var ppp=window.open('../../mothersdayoffer.htm?City='+cityVal);
}
function New_Offer_Links()
{
 var ratecode=arguments[0];
 var noofnights=arguments[1];
 var arridate=arguments[2];
 
 var urlbook="https://www.luxuryexplorer.com/hotels/taj/ibe/02_tajLink/main.htm?ccpSelectHotel=TJ-";
 if(arguments.length==0)
  urlbook+=Id+"&quick=page1";
  if(arguments.length==1)
  urlbook+=+"&quick=page1&rateAccessCode=*"+ratecode+"$";
 if(arguments.length==2) 
  {
  if(noofnights!=1)	  
  urlbook+=Id+"&quick=page1&rateAccessCode=*"+ratecode+"$&numberOfNights="+noofnights;
  else
  urlbook+=Id+"&quick=page1&rateAccessCode=*"+ratecode+"$";
  }
  if(arguments.length==3) 
  {
	if(noofnights!=1)	    
    urlbook+=Id+"&quick=page1&rateAccessCode=*"+ratecode+"$&numberOfNights="+noofnights+"&calArrivalDateField="+arridate;
	else
	urlbook+=Id+"&quick=page1&rateAccessCode=*"+ratecode+"&calArrivalDateField="+arridate;
  }
	//alert(urlbook);
	window.open(urlbook);
  
}


//---Date Operation


var yy=myscriptTime.getFullYear();
var mm=myscriptTime.getMonth();
//myscriptTime.setDate(myscriptTime.getDate()+1)
var dd=myscriptTime.getDate();

var startDate=new Date();
var strstartdate=(parseInt(mm)+1)+"/"+dd+"/"+yy; //"4/1/2009";  // mm/dd/yyyy
startDate.setDate(startDate.getDate()+1)

var yy=myscriptTime.getFullYear();
var mm=myscriptTime.getMonth();
var dd=myscriptTime.getDate();
var strenddate=parseInt(mm)+1+"/"+dd+"/"+(parseInt(yy)+1);//"1/1/2011";
//alert(strenddate);
var datediff=1;//Date Difference
var endDate=new Date(strenddate);


var arrMonth=new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
//alert(arrMonth[2]);
var todaydate=new Date();
var date=todaydate.getDate();
var month=todaydate.getMonth();
var year=todaydate.getFullYear();
var noofmonth=24;//no of month
var noofdays=30;





 function getMonthName(s)
            {
            if(s==0)
            return "JAN";
             if(s==1)
            return "FEB";
             if(s==2)
            return "MAR";
             if(s==3)
            return "APR";
             if(s==4)
            return "MAY";
            if(s==5)
            return "JUN";
             if(s==6)
            return "JUL";
              if(s==7)
            return "AUG";
             if(s==8)
            return "SEP";
             if(s==9)
            return "OCT";
             if(s==10)
            return "NOV";
             if(s==11)
            return "DEC";
           }
//populatemonth("date","month",strstartdate);
//populatemonth("dateOut","monthOut",strstartdate);
function populatemonth(ctrd,ctrm,stdate)
{

document.getElementById(ctrm).options.length=null;
 //document.getElementById(ctrm).options.length=null;
 var sdate=new Date(stdate); 
  sdate.setDate(1);
 temenddate=new Date(strenddate);
 if(ctrd.indexOf('Out')!=-1)
 {
 temenddate.setDate(temenddate.getDate()+datediff);
 }
    for(i=0;i<=noofmonth;i++)
    {  

     document.getElementById(ctrm).options[i]=new Option(getMonthName(sdate.getMonth())+" "+sdate.getFullYear(),sdate.getMonth()+":"+sdate.getFullYear());
     if(temenddate.getMonth()==sdate.getMonth() && temenddate.getFullYear()==sdate.getFullYear())
     break;
     sdate.setMonth(sdate.getMonth()+1);
    // alert(startDate);
    }
}


prepopulatedates('date',strstartdate);
prepopulatedates('dateOut',strstartdate);

//var datandyear=document.getElementById(ctrm).options[document.getElementById(ctrm).selectedIndex].value;
//var datyear=datandyear.split(":");
//if(stdate.getMonth()==parseInt(datyear[0]) && parseInt(datyear[1])==stdate.getFullYear())
//{
//var newdate=curDate;
//newdate.setDate(newdate.getDate()+1)
//}
//else
//var newdate=new Date((parseInt(datyear[0])+1)+"/"+1+"/"+datyear[1]);
function prepopulatedates(ctrd,stdt)
{
 
    var stdate=new Date(stdt);
    if(ctrd.indexOf('Out')!=-1)
    {
        stdate.setDate(stdate.getDate()+parseInt(datediff))
       populatemonth("dateOut","monthOut",stdate);
        populatedate(stdate,ctrd);
        
    }
    else
    {
       populatemonth("date","month",stdate);
       populatedate(stdate,ctrd);
       
    }

}

function onchangepopulateIndate()
{

  var selIndate=getSelectedDate1("date","month");
  populatedate(selIndate,"date","onchange");
  changeDate("date","month"); 
   
    
}

function getSelectedDate1(ctrd,ctrm)
{
//var newdate=new Date((parseInt(datyear[0])+1)+"/"+document.getElementById(ctrd).options[document.getElementById(ctrd).selectedIndex].text+"/"+datyear[1]);
var curDate=new Date(strstartdate);
var datandyear=document.getElementById(ctrm).options[document.getElementById(ctrm).selectedIndex].value;
var datyear=datandyear.split(":");
if(curDate.getMonth()==parseInt(datyear[0]) && parseInt(datyear[1])==curDate.getFullYear())
var newdate=curDate;
else
var newdate=new Date((parseInt(datyear[0])+1)+"/"+1+"/"+datyear[1]);
return newdate;
}

function getSelectedDateChange(ctrd,ctrm)
{
var datandyear=document.getElementById(ctrm).options[document.getElementById(ctrm).selectedIndex].value;
var datyear=datandyear.split(":");
var newdate=new Date((parseInt(datyear[0])+1)+"/"+1+"/"+datyear[1]);
return newdate;
}


function onchangepopulateOutdate()
{
var selOutdate=getSelectedDateChange("dateOut","monthOut");
var selIndate=getSelectedDate("date","month");

populatedateOut(selOutdate,selIndate,"dateOut","onchange");
//RevchangeDate("dateOut","monthOut");
}
function populatedateOut(selDate,selIndates,ctrd,type)
{


document.getElementById(ctrd).options.length=null;
var strtdate=new Date(strstartdate);
var tempenddate=new Date(strenddate);
//alert(selDate.getMonth()+"Select")
//alert(strtdate.getMonth()+"Start");

if(type=="onchange")
{
   
 
    if(selDate.getMonth()==selIndates.getMonth() && selDate.getFullYear()==selIndates.getFullYear())
    selDate.setDate(selIndates.getDate()+datediff);
    else
    selDate.setDate(1);
    
  
    
 }   
   var selIsndate=getSelectedDate1("date","month");
          if(ctrd.indexOf('Out')==-1)
             selIsndate=getSelectedDateChange("date","month");
          else
              selIsndate.setDate(selIsndate.getDate()+1)
      
            document.getElementById(ctrd).length=null;
  
       for(j=0;j<=31;j++)
        {
        document.getElementById(ctrd).options[j]=new Option(selDate.getDate(),selDate.getDate());
//        if(tempenddate.getMonth()==selDate.getMonth() && tempenddate.getDate()==selDate.getDate() && tempenddate.getFullYear()==selDate.getFullYear())
//        {
//         
//         
//          var cnt=1;
//           for(y=0;y<=tempenddate.getDate();y++)
//           {
//         
//                document.getElementById(ctrd).options[y]=new Option(selIsndate.getDate(),selIsndate.getDate());
//                var mon1=selIsndate.getMonth();
//                selIsndate.setDate(selIsndate.getDate()+1)
//                if(tempenddate.getMonth()!=selIsndate.getMonth())
//                break;
//           }
//        break
//        }
          var mon=selDate.getMonth();
        selDate.setDate(selDate.getDate()+1)
        if(mon!=selDate.getMonth())
        return;
        }
 }

function revpopulatedate(selDate,ctrd,type)
{
document.getElementById(ctrd).options.length=null;
var strtdate=new Date(strstartdate);
var tempenddate=new Date(strenddate);
//alert(selDate.getMonth()+"Select")
//alert(strtdate.getMonth()+"Start");
if(ctrd.indexOf('Out')!=-1)
 {
 tempenddate.setDate(tempenddate.getDate()+datediff);
 }
if(type=="onchange")
{
    if(ctrd.indexOf('Out')==-1)
    {
    if(selDate.getMonth()!=strtdate.getMonth())
    selDate.setDate(1);
    else
    selDate.setDate(1);
    }
    
    else
    {
    // if(selDate.getMonth()!=strtdate.getMonth())
    // selDate.setDate(strtdate.getDate()+datediff);
    //  else
    selDate.setDate(strtdate.getDate()+datediff);
    
    if(selDate.getMonth()==tempenddate.getMonth())
    selDate.setDate(tempenddate.getDate());
   // tempenddate.setDate(tempenddate.getDate()+datediff);
    }
    
 }   
       for(j=0;j<=31;j++)
        {
        document.getElementById(ctrd).options[j]=new Option(selDate.getDate(),selDate.getDate());
        if(tempenddate.getMonth()==selDate.getMonth() && tempenddate.getDate()==selDate.getDate())
        {
        break
        }
        var mon=selDate.getMonth();
        selDate.setDate(selDate.getDate()+1)
        if(mon!=selDate.getMonth())
        return;
        }
 }



function populatedate(selDate,ctrd,type)
{


document.getElementById(ctrd).options.length=null;
var strtdate=new Date(strstartdate);
var tempenddate=new Date(strenddate);
//alert(selDate.getMonth()+"Select")
//alert(strtdate.getMonth()+"Start");
if(ctrd.indexOf('Out')!=-1)
 {
 tempenddate.setDate(tempenddate.getDate()-3);

 }
if(type=="onchange")
{
    if(ctrd.indexOf('Out')==-1)
    {
    if(selDate.getMonth()==strtdate.getMonth())
  selDate.setDate(strtdate.getDate());
    else
     selDate.setDate(1);
    
     
   
    }
    else
    {
    if(selDate.getMonth()==strtdate.getMonth())
    selDate.setDate(1);
    else
    selDate.setDate(strtdate.getDate()+datediff);
    
    
    if(selDate.getMonth()==tempenddate.getMonth())
    selDate.setDate(tempenddate.getDate());
   // tempenddate.setDate(tempenddate.getDate()+datediff);
    }
    
 }   
  
       for(j=0;j<=31;j++)
        {
        document.getElementById(ctrd).options[j]=new Option(selDate.getDate(),selDate.getDate());
        if(tempenddate.getMonth()==selDate.getMonth() && tempenddate.getDate()==selDate.getDate() && tempenddate.getFullYear()==selDate.getFullYear())
        {
         
          var selIsndate=getSelectedDate1("date","month");
          if(ctrd.indexOf('Out')==-1)
             selIsndate=getSelectedDateChange("date","month");
          else
              selIsndate.setDate(selIsndate.getDate()+1)
      
            document.getElementById(ctrd).length=null;
          var cnt=1;
           for(y=0;y<=tempenddate.getDate();y++)
           {
         
                document.getElementById(ctrd).options[y]=new Option(selIsndate.getDate(),selIsndate.getDate());
                var mon1=selIsndate.getMonth();
                selIsndate.setDate(selIsndate.getDate()+1)
                if(tempenddate.getMonth()!=selIsndate.getMonth())
                break;
           }
        break
        }
          var mon=selDate.getMonth();
        selDate.setDate(selDate.getDate()+1)
        if(mon!=selDate.getMonth())
        return;
        }
 }

function getSelectedDate(ctrd,ctrm)
{

var curDate=new Date(strstartdate);
var datandyear=document.getElementById(ctrm).options[document.getElementById(ctrm).selectedIndex].value;
var datyear=datandyear.split(":");
if(curDate.getMonth()==parseInt(datyear[0]+1) && parseInt(datyear[1])==curDate.getFullYear())
var newdate=curDate;
else
var newdate=new Date((parseInt(datyear[0])+1)+"/"+document.getElementById(ctrd).options[document.getElementById(ctrd).selectedIndex].text+"/"+datyear[1]);
return newdate;
}


function changeDate(datelist,monthlist)
{

    var ArrDate=document.f1.month.value;
 var DepDate=document.f1.monthOut.selectedIndex;
 var ArArr=new Array();
 ArArr=ArrDate.split(":");
 var mm=parseInt(ArArr[0])+1;

 var yy=ArArr[1];
 var dd=parseInt(document.f1.date.value);
 
 if(parseInt(myscriptTime.getMonth())+1==mm && parseInt(myscriptTime.getFullYear())+1==yy && dd>parseInt(myscriptTime.getDate())-2)
	{
	//alert("O");
	var dt=new Date(myscriptTime.getFullYear()+1,myscriptTime.getMonth(),myscriptTime.getDate());
	var ndt=new Date(dt.setDate(dt.getDate()-1));
	var mName=getMonthName(ndt.getMonth());
	alert("Arrival Date Should be less than "+parseInt(ndt.getDate())+"-"+mName.toUpperCase()+"-"+ndt.getFullYear());
	document.f1.date.value=1;
	return false;


	}

    var datandyear=document.getElementById(monthlist).options[document.getElementById(monthlist).selectedIndex].value;
    var datyear=datandyear.split(":");
    var newdate=new Date((parseInt(datyear[0])+1)+"/"+(parseInt(document.getElementById(datelist).options[document.getElementById(datelist).selectedIndex].text))+"/"+datyear[1]);
    var stdati=new Date(strstartdate);
    prepopulatedates('dateOut',newdate);
    newdate.setDate(stdati.getDate());
    var selIndates=getSelectedDate("date","month");
    
}


function RevchangeDate(datelist,monthlist)
{

    var selOutdates=getSelectedDate("dateOut","monthOut");
    selOutdates.setDate(selOutdates.getDate()-datediff)
    var mn=getMonthName(selOutdates.getMonth());
    var yr=selOutdates.getFullYear();
    var mnyr=mn+" "+yr;
    //alert(mnyr);
    currform1=document.f1;
		for(i=0;i<currform1.month.options.length;i++)
		{
		
			if (currform1.month.options[i].text ==mnyr){
			
				currform1.month.options[i].selected = true;
				break;}
		}
  var sendate=getSelectedDate("date","month");
  //alert(sendate);
  populatedate(sendate,"date","onchange");
			for(i=0;i<currform1.date.options.length;i++)
		{
		
			if (currform1.date.options[i].text ==selOutdates.getDate()){
			
				currform1.date.options[i].selected = true;
				break;}
		}
	
}

function revprepopulatedates(ctrd,stdt)
{

    var stdate=new Date(stdt);
    if(ctrd.indexOf('Out')!=-1)
    {
           populatemonth("dateOut","monthOut",stdate);
        revpopulatedate(stdate,ctrd);
        
    }
    else
    {
     stdate.setDate(stdate.getDate()-parseInt(datediff))
       populatemonth("date","month",stdate);
        revpopulatedate(stdate,ctrd);
   
       
    }

}


function changemonth(ctrd,ctrm)
{
mnt=document.getElementById(ctrm).options[document.getElementById(ctrm).selectedIndex].value;
dt=document.getElementById(ctrd).options[document.getElementById(ctrd).selectedIndex].value;
var datyear=mnt.split(":");
//if(isLastDate(dt,datyear[0],datyear[1])=="true")
//document.getElementById("monthOut").value=(parseInt(mnt)+1)+":"+datyear[1];
//else
document.getElementById("monthOut").value=document.getElementById("month").value;
}
showchild();
