//Function for Amenities Show And Hide
function show_hide_amenities(id,imgid)
{
    var status = "hidden";
    if(document.getElementById(id)!=null)
    {
   
        if ( document.getElementById(id).style.visibility == status)
        {
            showDiv(id);
            var ele =  document.getElementById(imgid);
            if(ele!=null)
                ele.src = "/App_Themes/DefaultV4/images/arrow_up_16.gif"; 
            return ;
        }
        else
        {
            hideDiv(id);
            
            var ele =  document.getElementById(imgid);
            if(ele!=null)
                ele.src = "/App_Themes/DefaultV4/images/arrow_down_16.gif";  
            return;
        }
    }
    else
    {
        return;
    }
    
}
//Function for Amenities Show And Hide Ends Here

//Function for Inclusions Show And Hide
function show_hide_inclusions(id)
{
    var status = "hidden";
    if ( document.getElementById(id).style.visibility == status)
    {
        showDiv(id);
        return false;
    }
    else
    {
        hideDiv(id);
        return false;
    }       
}
//Function for Inclusions Show And Hide Ends Here

//Function for shippingAddress Show And Hide

function show_hide_DivOnCheckChange(idChkBox,divId)
{
    var checkBox = document.getElementById(idChkBox);
    
    if (document.getElementById(idChkBox).checked == true)
    {
        hideDiv(divId);
        return false;
    }
    else
    {
        showDiv(divId);
        return false;
    }       
}

//Function for Show And Hide travel Modes Divs
function show_hide_travelmode(control,id)
{
    var chkbox = document.getElementById(control);
    if(chkbox.checked == true)
    {
        showDiv(id);
        return false;
    }
    else
    {
        hideDiv(id);
        toggleAllChildValidators(false,document.getElementById(id));
        return false;
    }    
}

function show_hide_Car_travelmode(control,id,dropOffValidatorId)
{
    var chkbox = document.getElementById(control);
    if(chkbox.checked == true)
    {
        showDiv(id);
        return false;
    }
    else
    {
        hideDiv(id);
        toggleAllChildValidators(false,document.getElementById(id));
        return false;
    }    
}

function show_hide_Air_travelmode(control,id)
{
    var chkbox = document.getElementById(control);
    if(chkbox.checked == true)
    {
        showDiv(id);
        return false;
    }
    else
    {
        hideDiv(id);
        toggleAllChildValidators(false,document.getElementById(id));
        return false;
    }    
}

//Function To show hide rooms for vacation
function showRoomsVacation(drpRoomsId,divRoom1,divRoom2)
{
   if(document.getElementById(drpRoomsId) != null)
   {
         var drpRooms = document.getElementById(drpRoomsId);
         if(drpRooms.value == "1")
         {
            showDiv(divRoom1);
            hideDiv(divRoom2);
         }
         else if(drpRooms.value == "2")
         {
            showDiv(divRoom1);
            showDiv(divRoom2);
         }         
   }
}

//Function To show hide children age drp downs for vacation
function showChildAgesVacation(drpChildCntId,divChild1,divChild2,divChild3,divChild4,divChild5,divChild6)
{
   if(document.getElementById(drpChildCntId) != null)
   {
        var drpChildCnt = document.getElementById(drpChildCntId);
        if(drpChildCnt.value == "1")
        {
            showDiv(divChild1);
            hideDiv(divChild2);
            hideDiv(divChild3);
            hideDiv(divChild4);
            hideDiv(divChild5);
            hideDiv(divChild6);         
        } 
        else if(drpChildCnt.value == "2")
        {
            showDiv(divChild1);
            showDiv(divChild2);
            hideDiv(divChild3);
            hideDiv(divChild4);
            hideDiv(divChild5);
            hideDiv(divChild6); 
        }
        else if(drpChildCnt.value == "3")
        {
            showDiv(divChild1);
            showDiv(divChild2);
            showDiv(divChild3);
            hideDiv(divChild4);
            hideDiv(divChild5);
            hideDiv(divChild6); 
        }
         else if(drpChildCnt.value == "4")
        {
            showDiv(divChild1);
            showDiv(divChild2);
            showDiv(divChild3);
            showDiv(divChild4);
            hideDiv(divChild5);
            hideDiv(divChild6); 
        }
        else if(drpChildCnt.value == "5")
        {
            showDiv(divChild1);
            showDiv(divChild2);
            showDiv(divChild3);
            showDiv(divChild4);
            showDiv(divChild5);
            hideDiv(divChild6); 
        }
        else if(drpChildCnt.value == "6")
        {
            showDiv(divChild1);
            showDiv(divChild2);
            showDiv(divChild3);
            showDiv(divChild4);
            showDiv(divChild5);
            showDiv(divChild6); 
        }
        else
        {
            hideDiv(divChild1);
            hideDiv(divChild2);
            hideDiv(divChild3);
            hideDiv(divChild4);
            hideDiv(divChild5);
            hideDiv(divChild6);  
        }
   }
}



//Function for Amenities Show And Hide Ends Here
function showRules(url,windowname,w,h){
var win = null;
var setvalues = 'height='+h+',width='+w+',top=100,left=100,scrollbars=yes,resizable=no,,menubar=no,toolbar=no,status=no'
var win = window.open(url,windowname,setvalues)
}
function chkDropDownSelection(id) {
    if(document.getElementById(id)==null)
        return;
	var dropdownValue = document.getElementById(id).value;
	if(dropdownValue == '')
	{
		alert('Specify Reason Codes for all Policy Exceptions.');
		return false;        
	}
	return; 
   }

// force left and right sides of content be of equal height.
function matchheight(colA, colB) {

	var colAheight=0;
	var colBheight=0;
	c1=document.getElementById(colA);
	
	if(c1==null)
	  return;
	
	if(c1.offsetHeight) { 
		colAheight=c1.offsetHeight;
	} else 
	if(c1.style.pixelHeight) { 
		colAheight=c1.style.pixelHeight; 
	} 
	
	c2=document.getElementById(colB);
	if(c2.offsetHeight) { 
		colBheight=c2.offsetHeight; 		
	}  
	else 
	if(c2.style.pixelHeight) { 
		colBheight=c2.style.pixelHeight;
	} 
	if (colAheight < colBheight)
	{	
		document.getElementById(colA).style.height = colBheight + 'px';
		document.getElementById(colB).style.height = colBheight + 'px';
	}


}


function toggleFooter(testid,id,id1)
{
document.getElementById(testid).checked=true;
  if(document.getElementById(id1).checked==true)
  {
	document.getElementById(id1).checked=true;
	document.getElementById(id).checked=false;
	document.getElementById("divPassager").style.visibility="visible";
	document.getElementById("divPassager").style.display="block";
	document.getElementById("divPassager1").style.visibility="visible";
	document.getElementById("divPassager1").style.display="block";
  }
  else if(document.getElementById(id).checked==true)
  {
	document.getElementById(id).checked=true;
	document.getElementById(id1).checked=false;
	document.getElementById("divPassager").style.visibility="hidden";
	document.getElementById("divPassager").style.display="none";
	document.getElementById("divPassager1").style.visibility="hidden";
	document.getElementById("divPassager1").style.display="none";
  }
}
function showAmenities(id,id1)
{
   document.getElementById(id).style.display = "block"; 
   document.getElementById(id).style.visibility = "visible"; 
	  return; 
}
function hideAmenities(id,id1)
{

document.getElementById(id).style.display = "none"; 
document.getElementById(id).style.visibility = "hidden";
	  return; 
}

function hideRoomListCtrls(rowIds,id1,id2) 
{
    
    if(rowIds!=null)
    {  var idArray=new Array();
        idArray=rowIds.split(",");
        for(var cnt=0;cnt<idArray.length-1;cnt++)
        {
		document.getElementById(idArray[cnt]).style.display = "none"; 
		document.getElementById(idArray[cnt]).style.visibility = "hidden";
	    }
	}
   if(document.getElementById(id1)!=null)
	{
		document.getElementById(id1).style.display = "none"; 
		document.getElementById(id1).style.visibility = "hidden";		
	}	
	if(document.getElementById(id2)!=null)
	{
		document.getElementById(id2).style.display = ""; 
		document.getElementById(id2).style.visibility = "visible";		
	}	
   return; 
   }
function showRoomListCtrls(rowIds,id1,id2)
 {
    if(rowIds!=null)
    {
    var idArray=new Array();
    idArray=rowIds.split(",");
        for(var cnt=0;cnt<idArray.length-1;cnt++)
        {
		document.getElementById(idArray[cnt]).style.display = ""; 
		document.getElementById(idArray[cnt]).style.visibility = "visible";		
	    }
	}
	if(document.getElementById(id1)!=null)
	{
		document.getElementById(id1).style.display = "none"; 
		document.getElementById(id1).style.visibility = "hidden";		
	}	
	if(document.getElementById(id2)!=null)
	{
		document.getElementById(id2).style.display = ""; 
		document.getElementById(id2).style.visibility = "visible";		
	}	
	return; 
}

function selectAllCompChk(chkBoxIds) 
{
    if(chkBoxIds!=null)
    {  var idArray=new Array();
        idArray=chkBoxIds.split(",");
        for(var cnt=0;cnt<idArray.length-1;cnt++)
        {
		document.getElementById(idArray[cnt]).checked=true;
	    }
	}
}
function clearAllCompChk(chkBoxIds) 
{
    if(chkBoxIds!=null)
    {  var idArray=new Array();
        idArray=chkBoxIds.split(",");
        for(var cnt=0;cnt<idArray.length-1;cnt++)
        {
		document.getElementById(idArray[cnt]).checked=false;
	    }
	}
}

function hideDiv(id) {

	if(document.getElementById(id)!=null)
	{
		document.getElementById(id).style.display = "none"; 
		document.getElementById(id).style.visibility = "hidden";
	}
	return; 
   }
   
function showDiv(id) {

	if(document.getElementById(id)!=null)
	{
		document.getElementById(id).style.display = "block"; 
		document.getElementById(id).style.visibility = "visible";		
	}	

	return; 
}

function hideDivByName(parentDivId,id) 
{
	if(document.getElementsByName(id)!=null)
	{
	    var div= new Array();
        div= document.getElementById(parentDivId).getElementsByTagName('div');
		for(var i=0;i<div.length;i++)
		{
		if(div.item(i).getAttribute('name')==id)
		{
		
		div.item(i).style.display = "none"; 
		div.item(i).style.visibility = "hidden";
		}
		}
	}
	return; 
   }
   
function showDivByName(parentDivId,id) {
	if(document.getElementsByName(id)!=null)
	{
		var div= new Array();
		div= document.getElementById(parentDivId).getElementsByTagName('div');
		for(var i=0;i<div.length;i++)
		{
		if(div.item(i).getAttribute('name')==id)
		{
		div.item(i).style.display = "block"; 
		div.item(i).style.visibility = "visible";
		}
		}
	}
	return; 
}

function SetView(id,curView)
{
    if(document.getElementById(id)!=null)
    {
     document.getElementById(id).value=curView;
    }
}   

function showAndExpandRight(id) 
{
	if(document.getElementById(id)!=null)
	{
	    document.getElementById(id).style.display = "block"; 
		document.getElementById(id).style.visibility = "visible";
		if(document.getElementById(id).offsetHeight)
		{
	        var pixels= document.getElementById("container-right").style.height;
	        pixels = pixels.toString();    	    
	        var height = parseFloat(pixels.substring(0, pixels.length - 2));
	        var idHeight = parseFloat(document.getElementById(id).offsetHeight);
	        height = height + idHeight;
	        if(!isNaN(height))
	            document.getElementById("container-right").style.height = height + 'px';
	    }
    }
	return; 
}

function hideAndCollapseRight(id) {

	if(document.getElementById(id)!=null)
	{
//	    if(document.getElementById(id).offsetHeight)
//		{
//		    var pixels= document.getElementById("container-right").style.height;
//		    pixels = pixels.toString();    	    
//	        var height = parseFloat(pixels.substring(0, pixels.length - 2));
//	        var idHeight = parseFloat(document.getElementById(id).offsetHeight);
//	        height = height - idHeight;
//	        if(!isNaN(height))
//	            document.getElementById("container-right").style.height = height + 'px';
//	    }
		document.getElementById(id).style.display = "none"; 
		document.getElementById(id).style.visibility = "hidden";
	}
	return; 
   }

   
function showTableRow(id) {

    var browser=navigator.appName;

	if(document.getElementById(id)!=null)
	{
	    if (browser.indexOf("Microsoft") >= 0) 
	    	document.getElementById(id).style.display = "block"; 
        else
	    	document.getElementById(id).style.display = "table-row"; 
        
		document.getElementById(id).style.visibility = "visible"; 
		
	}	
	
	return; 
}

function showTableRowAndExpandRight(id) {

    var browser=navigator.appName;

	if(document.getElementById(id)!=null)
	{
	    if (browser.indexOf("Microsoft") >= 0) 
	    	document.getElementById(id).style.display = "block"; 
        else
	    	document.getElementById(id).style.display = "table-row"; 
        
		document.getElementById(id).style.visibility = "visible"; 
		
//		if(document.getElementById(id).offsetHeight)
//		{
//		
//	        var pixels= document.getElementById("container-right").style.height;
//	        pixels = pixels.toString();    	    
//	        var height = parseFloat(pixels.substring(0, pixels.length - 2));
//	        var idHeight = parseFloat(document.getElementById(id).offsetHeight);
//	        height = height + idHeight;
//	        height=height+0;
//	        if(!isNaN(height))
//	            document.getElementById("container-right").style.height = height + 'px';
//	    }
	}	
	
	return; 
}


function InitControl(id,id1)   
{
  if(document.getElementById(id)!=null)
  { 
	  var idAir=id.replace('_hidSelDiv','_imgSelAir');
	  var idHotel=id.replace('_hidSelDiv','_imgSelHotel');
	  var idCar=id.replace('_hidSelDiv','_imgSelCar');
	  
   var selection=document.getElementById(id).value;
   var values=selection.split("|");
   selection=values[0];
   var subOption=values[1];
   
   if(document.getElementById("flightdiv")!=null)
        document.getElementById("flightdiv").style.display = "none"; 
   if(document.getElementById("hoteldiv")!=null)
        document.getElementById("hoteldiv").style.display = "none"; 
   if(document.getElementById("cardiv")!=null)     
        document.getElementById("cardiv").style.display = "none"; 
   if(selection == "Air") {
      document.getElementById("flightdiv").style.visibility = "visible"; 
	  document.getElementById("flightdiv").style.display = "block";       
	  ShowAir(idAir,idHotel,idCar);
	  if(subOption=="RT")
	    ShowRT();
      if(subOption=="OW")
		ShowOW();
	  if(subOption=="MF")
		ShowMF();
   }
   else if(selection == "Hotel") {
	  document.getElementById("hoteldiv").style.visibility = "visible"; 
	  document.getElementById("hoteldiv").style.display = "block"; 
	  ShowHotel(idAir,idHotel,idCar);
	  if(subOption=="C")
		ShowHC();
	  if(subOption=="Z")
		ShowHZ();
	  if(subOption=="A")
		ShowHA();
   }
   else if(selection == "Car") {
	  document.getElementById("cardiv").style.visibility = "visible"; 
	  document.getElementById("cardiv").style.display = "block"; 
	  ShowCar(idAir,idHotel,idCar);
	  var checked=(eval('document.getElementById("'+id1+'").checked'));
	  if(checked)
	  {
	  var moreOptions=subOption.split("_");
	  subOption=moreOptions[0];	  
	  }
	  
	  if(subOption=="C")
		ShowCAP();
	  if(subOption=="Z")
		ShowCZP();
	  if(subOption=="A")
		ShowCAP();
	  if(id1!=null)
	  {
		newShowDropOff(id1);
	  }
	  if(checked)
	  {
		  subOption=moreOptions[1];
		  if(subOption=="C")
			ShowCAD();
		  if(subOption=="Z")
			ShowCZD();
		  if(subOption=="A")
			ShowCAD();
	  }
	}
  }
}

function newShowDropOff(name) 
{
   if((eval('document.getElementById("'+name+'").checked'))) {
	  document.getElementById("divDropOff").style.display = "Block"; 
	  document.getElementById("divDropOff").style.visibility = "visible"; 
	  showDiv('droplocSpace');
	  }
   else {
	  document.getElementById("divDropOff").style.display = 'none'; 
	  hideDiv('droplocSpace');
	  }
   }

function showView(ctlName) 
{
   if(document.getElementById("chkDiffDropOff").checked)
	{
		 document.getElementById("divDropOff").style.display = 'block'; 
		 document.getElementById("divDropOff").style.visibility = 'visible'; 
		 document.getElementById(ctlName).value="true";
	}
   else
	{
	  document.getElementById("divDropOff").style.display = 'none'; 
	  document.getElementById(ctlName).value="false";
	}
}
 
function showViewDrop(ctlName) 
{
		if(document.getElementById("divDropOff")!=null)
		{
		 document.getElementById("divDropOff").style.display = 'block'; 
		 document.getElementById("divDropOff").style.visibility = 'visible'; 
		 document.getElementById(ctlName).value="true";
		 document.getElementById("chkDiffDropOff").checked="true";
		}
}   

function hideReturn(id) {
   document.getElementById("divRet").style.display = "none"; 
   document.getElementById("divRetTime").style.display = "none"; 
   document.getElementById("divlbReturn").style.display = 'none'; 
   document.getElementById("divlbReturn").style.visibility = 'hidden'; 
   document.getElementById("lnkAirOne").style.color = 'Blue'; 
   document.getElementById("lnkAirRound").style.color = '#336699'; 
   document.getElementById(id).value="OneWay";
   return; 
   }
function showReturn(id) {
   document.getElementById("divRet").style.display = "block"; 
   document.getElementById("divRetTime").style.display = "block"; 
   document.getElementById("divRet").style.visibility = "visible"; 
   document.getElementById("divRetTime").style.visibility = "visible"; 
   document.getElementById("divlbReturn").style.display = 'block'; 
   document.getElementById("divlbReturn").style.visibility = 'visible'; 
   document.getElementById("lnkAirRound").style.color = 'Blue'; 
   document.getElementById("lnkAirOne").style.color = '#336699'; 
   document.getElementById(id).value="RoundTrip";
   return; 
   }

function toggleTravelDetailDiv(divId,dropDownId,value) {

	var drpTravelType = document.getElementById(dropDownId);
	var divTravelDetail = document.getElementById(divId);
	
	if(divTravelDetail != null)
	{
		if(drpTravelType != null && drpTravelType.value == value)
		  {
			toggleAllChildValidators(true,divTravelDetail);
			//showDiv(divTravelDetail.id);
		  }
		else
		{
			toggleAllChildValidators(false,divTravelDetail);
			//hideDiv(divTravelDetail.id);
		}
	}
	
   return; 
 }

function toggleCountryValidatorStatus(dropdownID, control) 
{
    if(control == null)
		return;
		
	var drpCountry = document.getElementById(dropdownID);
	if(drpCountry == null)
	    return;
	    
	if(drpCountry.value != 'US' && drpCountry.value != 'CA' && drpCountry.value != 'AU')
	{	
		toggleAllChildValidators(false, control)
	}
	if(drpCountry.value == 'US' || drpCountry.value == 'CA' || drpCountry.value == 'AU')
	{	
	    
		toggleAllChildValidators(true, control)
	}
}

//Toggle status of all child validator controls in the control tree
function toggleAllChildValidators(status, control) 
{
	if(control == null)
		return;
	
	//check if the control is a validation control
	if(control.controltovalidate != null)
	{
		ValidatorEnable(control,status)
	}
	
	for(var i=0; i < control.childNodes.length; i++)
	{
		toggleAllChildValidators(status, control.childNodes[i]);
	}
} 

//Hides an ajax PopupExtender control popup
function hidePopup(popupBehaviorId)
{
	$find(popupBehaviorId).hidePopup();
}



function checkDateControls(ctlMonthId, ctlDayId, ctlYearId)
{
	var ctlMonth = document.getElementById(ctlMonthId);
	var ctlDay = document.getElementById(ctlDayId);
	var ctlYear = document.getElementById(ctlYearId);
	
	if(ctlMonth == null || ctlDay == null || ctlYear == null)
		return false;
		
	 return checkDate(ctlMonth.value,ctlDay.value, ctlYear.value);
}

function checkDate(month, day , year)
{
	if(month == null || day == null || year == null || month == "" || day == "" || year=="")
		return false;
	
	var dayPattern = new RegExp("^[0-3]{0,1}[0-9]$");
	var monthPattern = new RegExp("0?[1-9]|(1[012])");	
	var yearPattern = new RegExp("19|20[0-9]{2}");
		 
	if(!month.match(monthPattern)  || ! day.match(dayPattern) || !year.match(yearPattern))
		return false;

	var inputDate;
	month = month - 1;
	inputDate=new Date(year,month,day);
	
	return ( (day==inputDate.getDate())
			 && (month == inputDate.getMonth())
			 && (year==inputDate.getFullYear()) );

}

//takes the date in the format mm/dd/yyyy
function validateDate(dateString)
{
    var dateArray = dateString.split("/",3);
    return checkDate(dateArray[0],dateArray[1],dateArray[2]);
}

var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {an = 1; DH = 1;}}} function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];}
function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}
function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return null;}
function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}
function popUp(evt,oi) {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}}


//hides the div and disables all the child validators
function hideDivDisableValidators(divId)
{
	var divTraveler = document.getElementById(divId);
	
	if(divTraveler != null)
		toggleAllChildValidators(false,divTraveler);
	hideDiv(divId);
}

//shows the div and enables all the child validators
function showDivEnableValidators(divId)
{
	showDiv(divId);
	var divTraveler = document.getElementById(divId);
	
	if(divTraveler != null)
		toggleAllChildValidators(true,divTraveler);
}

function showSearch(id,module)
{
    var idAir=id.replace('_hidSelDiv','_imgSelAir');
    var idHotel=id.replace('_hidSelDiv','_imgSelHotel');
    var idCar=id.replace('_hidSelDiv','_imgSelCar');
	  
	if(module=="AIR")
	{
	    ShowAir(idAir,idHotel,idCar);	    
	}
	else if(module=="CAR")    
	{
		ShowCar(idAir,idHotel,idCar);
	}
	else if(module=="HOTEL")    
	{
		ShowHotel(idAir,idHotel,idCar);
	}
}

function ShowRT(rdoCal)
 {
    showDiv("divPackage");        	
    if(document.getElementById(rdoCal)!=null && document.getElementById(rdoCal).checked ==true) 
    {
        hideDiv('mcDown');
        showDiv('owTop');
        hideDiv('owDown');
        hideDiv('divRt');
        showDiv('owrt');
        showDiv('airCombineBox');
        showDiv('divDur');
        showDiv('divTrpLth');
        showDiv('combine');
        showDiv('horzLine');
    }
    else
    {
        hideDiv('mcDown');
        showDiv('owTop');
        showDiv('owDown');
        showDiv('divRt');
        showDiv('owrt');
        showDiv('airCombineBox');
        hideDiv('divDur');
        showDiv('divTrpLth');
         showDiv('combine');
         showDiv('horzLine');
    }
 }
 
 function ShowOW(rdoCal)
 {
    hideDiv("divPackage");        
    
    if(document.getElementById(rdoCal)!=null && document.getElementById(rdoCal).checked ==true) 
    {
        hideDiv('mcDown');
        showDiv('owTop');
        hideDiv('owDown');
        hideDiv('divRt');
        showDiv('owrt');
        showDiv('airCombineBox');
        showDiv('divDur');
        hideDiv('divTrpLth');
        showDiv('horzLine');
        showDiv('combine');
    }
    else
    {
         hideDiv('mcDown');
         showDiv('owTop');
         showDiv('owDown');
         showDiv('airCombineBox');
         showDiv('owrt');
         hideDiv('divRt');
         hideDiv('divDur');
         hideDiv('divTrpLth');
         showDiv('combine');
         showDiv('horzLine');
    }
 }
 
 
 
 
 
 function showOWorRT(rdoRT,rdoOW)
 {
   
    if(document.getElementById(rdoRT)!=null && document.getElementById(rdoRT).checked ==true) 
    {
        ShowRT('');
    }
    else if(document.getElementById(rdoOW)!=null && document.getElementById(rdoOW).checked ==true)
    {
        ShowOW('');
    }
 }
 
 function ShowMF()
 {
     hideDiv("divPackage");        
     showDiv('mcDown');
     hideDiv('owTop');
     hideDiv('owDown');
     hideDiv('divRt');
     hideDiv('airCombineBox');
     hideDiv('owrt');
     hideDiv('moreflights2');
     showDiv('moreflights1');
     hideDiv('divDur');
     hideDiv('combine');
     hideDiv('horzLine');
 }
  function ShowMFHome()
 {
    
     showDiv('divMultiFlight');
     hideDiv('divRoundTrip');
     
 }
 function ShowRTHome()
 {
     showDiv('divRoundTrip');
     showDiv('divReturnDate');
     hideDiv('divMultiFlight');
 
 
 }
 function ShowOWHome()
 {
    showDiv('divRoundTrip');
    hideDiv('divReturnDate');
    hideDiv('divMultiFlight');    
 }

  
 function ShowHC()
 {
 showDiv('HC');
 hideDiv('HA');
 hideDiv('HZ');
 }
 
 function ShowHA()
 {
 showDiv('HA');
 hideDiv('HC');
 hideDiv('HZ');
 }
 
 function ShowHZ()
 {
 showDiv('HZ');
 hideDiv('HA');
 hideDiv('HC');
 }
  
 function ShowCCP()
 {
 showDiv('CCP');
 hideDiv('CAP');
 hideDiv('CZP');
 }
 
 function ShowCAP()
 {
 showDiv('CAP');
 hideDiv('CCP');
 hideDiv('CZP');
 }
 
 function ShowCZP()
 {
 showDiv('CZP');
 hideDiv('CAP');
 hideDiv('CCP');
 }
 
 function ShowCCD()
 {
 showDiv('CCD');
 hideDiv('CAD');
 hideDiv('CZD');
 }
 
 function ShowCAD()
 {
 showDiv('CAD');
 hideDiv('CCD');
 hideDiv('CZD');
 }
 
 function ShowCZD()
 {
	 showDiv('CZD');
	 hideDiv('CAd');
	 hideDiv('CCD');
 }
 
 function ShowAir(idAir,idHotel,idCar)
 {
	 Reset(idAir,idHotel,idCar);
	 if(document.getElementById(idAir)==null)
	    return;
	 var src=document.getElementById(idAir).src;
	 document.getElementById(idAir).src=src.replace('selArrowRight','selArrowDown');
	 showDiv('flightdiv');
	 hideDiv('hoteldiv');
	 hideDiv('cardiv');
 }
 
 function ShowHotel(idAir,idHotel,idCar)
 {
	 Reset(idAir,idHotel,idCar);
	 if(document.getElementById(idHotel)==null)
	    return;
	 var src=document.getElementById(idHotel).src;
	 document.getElementById(idHotel).src=src.replace('selArrowRight','selArrowDown');
	 hideDiv('flightdiv');
	 showDiv('hoteldiv');
	 hideDiv('cardiv');
 }
 
 function ShowCar(idAir,idHotel,idCar)
 {
	 Reset(idAir,idHotel,idCar);
	 if(document.getElementById(idCar)==null)
	    return;	 
	 var src=document.getElementById(idCar).src;
	 document.getElementById(idCar).src=src.replace('selArrowRight','selArrowDown');
	 hideDiv('flightdiv');
	 hideDiv('hoteldiv');
	 showDiv('cardiv');
 }
 
 function ClearError()
 {
     if(document.getElementById('errMsg')!=null)
     {
        document.getElementById('errMsg').style.visibility="hidden";
     }
 }
 
 function Reset(idAir,idHotel,idCar)
 {
 if(document.getElementById(idAir)!=null)
 {
 var srcAir=document.getElementById(idAir).src; 
 document.getElementById(idAir).src=srcAir.replace('selArrowDown','selArrowRight');
 }
 
 if(document.getElementById(idHotel)!=null)
 {
 var srcHotel=document.getElementById(idHotel).src;
 document.getElementById(idHotel).src=srcHotel.replace('selArrowDown','selArrowRight');
 }
 
 if(document.getElementById(idCar)!=null)
 {
 var srcCar=document.getElementById(idCar).src;
 document.getElementById(idCar).src=srcCar.replace('selArrowDown','selArrowRight');
 }
 }
 
 function empty()  {return;}
 
  
function toggleDiv(id) {

	var divToToggle= document.getElementById(id);
	if(divToToggle == null)
		return;

	if (divToToggle.style.visibility=='hidden')
	{ 	divToToggle.style.visibility='visible';
		divToToggle.style.display=''; 
	}
	else
	{ 	divToToggle.style.visibility='hidden';
		divToToggle.style.display='none'; 
	}

	return;
}


function showDivAt(id,xpos,ypos) {
	//document.getElementById(id).style.z-index=-1;
	//document.getElementById(id).style.filter=mask();
	document.getElementById(id).style.position='absolute';
	document.getElementById(id).style.left=xpos + 'px';
	document.getElementById(id).style.top=ypos + 'px';
	document.getElementById(id).style.display='block';
	document.getElementById(id).style.visibility='visible';
	return;
}

function showSectionDiv(divid,section) {
	var ypos = document.getElementById(section).offsetTop;
	var xpos = 0;
	showDivAt(divid,xpos,ypos);
	return;
}

//x position changed
function showSectionDiv1(divid,section) {
	var ypos = document.getElementById(section).offsetTop;
	var xpos =500;
	showDivAt(divid,xpos,ypos);
	return;
}

function ToggleChildInputControls(control,status)
{

	if(control == null)
		return;
	
	//check if the control is a validation control
	if((control.tagName == "INPUT" || control.tagName == "SELECT") && control.disabled != null)
	{
		control.disabled = status;
	}
	else
	{
		for(var i=0; i < control.childNodes.length; i++)
			ToggleChildInputControls(control.childNodes[i],status);
	}
	
	return;
} 


// Home V4 Page.

function SetUniqueRadioButton(nameregex,current,lblCurTicketPrice,lblUnusedTicketPrice,lblTotalPrice,lblFinalPrice,lblUnusedTicket,divUnUsedTicket,lblAgentFee,lblAirLineExchangeFee)
{
   re = new RegExp(nameregex);
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
         if (re.test(elm.name))
         {
            elm.checked = false;
         }
      }
   }
   current.checked = true;
   document.getElementById(lblAgentFee).style["visibility"]="visible";
   document.getElementById(lblAgentFee).style["display"]="block";
   document.getElementById(lblAirLineExchangeFee).style["visibility"]="visible";
   document.getElementById(lblAirLineExchangeFee).style["display"]="block";
   document.getElementById(lblUnusedTicket).style["visibility"]="visible";
   document.getElementById(lblUnusedTicket).style["display"]="block";
   document.getElementById(divUnUsedTicket).style["visibility"]="visible";
   document.getElementById(divUnUsedTicket).style["display"]="block";
  
  var currentTicketPrice, unusedTktPrice,agentFee,airLineExchangeFee,totalAmount,finalPrice;
  
  if(document.all)
  {
    currentTicketPrice=document.getElementById(lblCurTicketPrice).innerText;
    unusedTktPrice=document.getElementById(lblUnusedTicketPrice).innerText;
    agentFee=document.getElementById(lblAgentFee).innerText;
    airLineExchangeFee=document.getElementById(lblAirLineExchangeFee).innerText;
   }
   else
   {
    currentTicketPrice=document.getElementById(lblCurTicketPrice).textContent;
    unusedTktPrice=document.getElementById(lblUnusedTicketPrice).textContent;
    agentFee=document.getElementById(lblAgentFee).textContent;
    airLineExchangeFee=document.getElementById(lblAirLineExchangeFee).textContent;
   }
  
   currentTicketPrice=currentTicketPrice.substring(1,currentTicketPrice.length);
   currentTicketPrice =  currentTicketPrice.replace(/^\s+/g,'');
   unusedTktPrice=unusedTktPrice.substring(1,unusedTktPrice.length);
   agentFee =  agentFee.replace(/^\s+/g,'');
   agentFee=agentFee.substring(1,agentFee.length);
   airLineExchangeFee =  airLineExchangeFee.replace(/^\s+/g,'');
   airLineExchangeFee=airLineExchangeFee.substring(1,airLineExchangeFee.length);
  
  
   totalAmount=(currentTicketPrice-unusedTktPrice);
   
   if(totalAmount<0)
   {
   totalAmount=0;
   }
   
   finalPrice =(parseFloat(totalAmount)+parseFloat(agentFee)+parseFloat(airLineExchangeFee));
   if(document.all)
   {
     document.getElementById(lblUnusedTicket).innerText=formatCurrency(unusedTktPrice);
     document.getElementById(lblTotalPrice).innerText=formatCurrency(totalAmount);
     document.getElementById(lblFinalPrice).innerText=formatCurrency(finalPrice);
   }
   else
   {
     document.getElementById(lblUnusedTicket).textContent=formatCurrency(unusedTktPrice);
     document.getElementById(lblTotalPrice).textContent  =formatCurrency(totalAmount);
     document.getElementById(lblFinalPrice).textContent  =formatCurrency(finalPrice);
   }
   
}
function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}
function tabSelect(sel, total, name){
	var name2 = 'tabs_' + name;
	for(var i=1;i <= total;i++) {
		if (i == sel)  	{
			showDiv('data_' + name + i);
			document.getElementById(name2).className = name + i + '-selected';
		}
		else
			hideDiv('data_' + name + i);
	}
	if(name=='fnc')
	    switch(sel)
	    {
	      case 1:
	             showDiv('flightdiv');
	             hideDiv('hoteldiv');
	             hideDiv('cardiv');
	             break;
	      case 2:
	             hideDiv('flightdiv');
	             showDiv('hoteldiv');
	             hideDiv('cardiv');
	             break;
	      case 3:
	            hideDiv('flightdiv');
	            hideDiv('hoteldiv');
	            showDiv('cardiv');  
	    }
}

function homePageTabSelect(sel,total,name,divFlight,divHotel,divCar, divCruise, divPackage, divRental, divVacation)
{    
    
	var name2 = 'tabs_' + name;
	for(var i=1;i <= total;i++) {
		if (i == sel)  	
		{		   
		    if(document.getElementById(name2)!=null)
		        document.getElementById(name2).className = name + i + '-selected';
		}
	}
	if(name=='fnc')
	{
	    hideDiv(divFlight);
	    hideDiv(divHotel);
	    hideDiv(divCar);
	    hideDiv(divCruise);
	    hideDiv(divPackage);
	    hideDiv(divRental);
	    hideDiv(divVacation);
	    switch(sel)
	    {
	      case 1:
	             showDiv(divFlight);
	             break;
	      case 2:
	             showDiv(divHotel);
	             break;
	      case 3:
	            showDiv(divCar);  
	            break;
	      case 4:
	             showDiv(divCruise);
	             break;
	      case 5:
	             showDiv(divPackage);
	             break;
	      case 6:
	            showDiv(divRental);  
	            break;
	      case 7:
	            showDiv(divVacation);  
	            break;
	    }
	}
}

 function PopupWindow(url)
    { 
    
	  var newwindow = window.open(url,'name','height=600,width=800,left=250,top=50,resizable=yes,scrollbars=yes');
	    if (window.focus) {newwindow.focus();}
    }


var popWin=''; 
function CheckFlightGateInfo(airLineId,flightSourceId,flightDestId,flightNumId,travelDateId,travelTimeId,journeyTypeId)
{
    var airline='';
    hideDiv('divChkFlightError');
   if(! ValidateSourceDestination(flightSourceId,flightDestId))return false;
    if(document.getElementById(airLineId))
    {
        airline = document.getElementById(airLineId).value.replace(/^\s+|\s+$/g,"");
        if(airline=='none')
        {
          showDiv('divChkFlightError');
          var divError =   document.getElementById('divChkFlightError');
         
          divError.innerHTML='Please Select Airline';
          return false;
        }
        flightSource = document.getElementById(flightSourceId).value;
        flightDest = document.getElementById(flightDestId).value;
        flightNum = document.getElementById(flightNumId).value;
        travelDate = document.getElementById(travelDateId).value;
        travelTime = document.getElementById(travelTimeId).value;
        journeyType = document.getElementById(journeyTypeId);// Arrival/Departure .
    }
    var url="common/CheckFlights.aspx?Action=GateInfo";
    url+="&Airline="+airline;
    url+="&Source="+flightSource;
    url+="&Dest="+flightDest;
    url+="&FNum="+flightNum;
    url+="&TDate="+travelDate;
    url+="&TTime="+travelTime;
    url+="&JType="+journeyType.checked;
 
    popWin = window.open(url,'flightstatus','height=600,width=800,left=250,top=50,resizable=yes,scrollbars=yes');
	        if (window.focus) {popWin.focus();}

    return false;
}

function CheckFlightChkIn(airLineId)
{
    var airline='';
    hideDiv('divChkFlightError');
    if(document.getElementById(airLineId))
    {
        airline = document.getElementById(airLineId).value.replace(/^\s+|\s+$/g,"");
        if(airline=='none')
        {
          showDiv('divChkFlightError');
          var divError =   document.getElementById('divChkFlightError');
         
          divError.innerHTML='Please Select Airline';
          return false;
        }
    }
    var url="common/CheckFlights.aspx?Action=CheckIn";
    url+="&Airline="+airline;
    popWin = window.open(url,'flightstatus','height=600,width=800,left=250,top=50,resizable=yes,scrollbars=yes');
	            if (window.focus) {popWin.focus();}
    return false;
}

function CheckFlightStatusNotice(airLineId,sourceId,destinationId)
{
    var airline='';
    hideDiv('divChkFlightError');
    if(document.getElementById(airLineId))
    {
        airline = document.getElementById(airLineId).value.replace(/^\s+|\s+$/g,"");
        if(airline=='none')
        {
          showDiv('divChkFlightError');
          var divError =   document.getElementById('divChkFlightError');
         
          divError.innerHTML='Please Select one Airline';
          return false;
        }
    }
   
        var url="common/CheckFlights.aspx?Action=StatusNotice";
        url+="&Airline="+airline;
        popWin = window.open(url,'flightstatus','height=600,width=800,left=250,top=50,resizable=yes,scrollbars=yes');
	                if (window.focus) {popWin.focus();}
        return false;
   
}

function ValidateSourceDestination(sourceId,destinationId)
{
    var source = document.getElementById(sourceId);
    var destination = document.getElementById(destinationId);
     hideDiv('divChkFlightError');
  
    if(source.value.length >3 ||destination.value.length >3 )
    {
          showDiv('divChkFlightError');
          var divError =   document.getElementById('divChkFlightError');
          divError.innerHTML='Length of Source and Destination code should not be more than 3 characters.';
          return false;
    }
    return true;
}

function ShowAuditSettings(cbxId,url)
{
    var cbxAuditSet = document.getElementById(cbxId);
    if(cbxAuditSet.checked)
    {
       PopupWindowAuditSettings(url)
    }
}

function PopupWindowAuditSettings(url)
{
      var newwindow = window.open(url,'name','height=650,width=640,left=250,top=50,resizable=yes,scrollbars=yes');
	    if (window.focus) {newwindow.focus();}
}

function ToggleDDLControls(srcControlId,controlIDList)
{
    var status = null;
    if(srcControlId !=null)
    {
        var cntrl = document.getElementById(srcControlId);
        status = !cntrl.checked;
    }
    else
        return false;
    
   if(controlIDList!=null)
    {  
        var idArray=new Array();
        idArray=controlIDList.split(",");
        for(var cnt=0;cnt<idArray.length;cnt++)
        {
		    document.getElementById(idArray[cnt]).disabled = status;
	    }
	}
}
function OpenAuctionVacation(url,controlIDList)
{
  url += "?"+GetQuerryString(controlIDList);
  var newwindow = window.open(url,'name','height=650,width=707,left=250,top=50,resizable=yes,scrollbars=yes');
	    if (window.focus) {newwindow.focus();}
}
function GetQuerryString(controlIDList)
{
    var cbxIdList = controlIDList.split(',');
    var querryString = "";
    
    for(var i =0; i<cbxIdList.length;i++)
    {
        var chkBox =  document.getElementById(cbxIdList[i]);
      
        switch(i)
        {
            case 0:
                if(chkBox.checked)
                    querryString += "Flight=true&";
                else
                    querryString += "Flight=false&";
            break;
            case 1:
                if(chkBox.checked)
                    querryString += "Hotel=true&";
                 else
                    querryString += "Hotel=false&";
            break;
            case 2:
                if(chkBox.checked)
                    querryString += "Car=true&";
                else
                    querryString += "Car=false&";
            break;
            case 3:
                if(chkBox.checked)
                    querryString += "Cruise=true&";
                else
                    querryString += "Cruise=false&";
            break;
            case 4:
                if(chkBox.checked)
                    querryString += "Package=true";
                else
                    querryString += "Package=false";
            break;
        }
    }
        return querryString;
}


function SetSelection(id,value)
{
if(document.getElementById(id)!=null)
    document.getElementById(id).value=value;
//alert(id)
//alert(value);
}


function onPackageSelection(hotelId,airId,tdId,airlineNameId)
{
    if(document.getElementById(tdId)!=null)
        document.getElementById(tdId).style.backgroundColor='#7CD5F5';
    if(document.getElementById(hotelId)!=null)
        document.getElementById(hotelId).style.backgroundColor='#7CD5F5';
    if(document.getElementById(airId)!=null)
        document.getElementById(airId).style.backgroundColor='#7CD5F5';
     if(document.getElementById(airlineNameId)!=null)
        document.getElementById(airlineNameId).style.visibility='visible';
}

function offPackageSelection(hotelId,airId,tdId,airlineNameId)
{
    if(document.getElementById(tdId)!=null)
        document.getElementById(tdId).style.backgroundColor='White';
    if(document.getElementById(hotelId)!=null)
        document.getElementById(hotelId).style.backgroundColor='White';
    if(document.getElementById(airId)!=null)
        document.getElementById(airId).style.backgroundColor='White';
    if(document.getElementById(airlineNameId)!=null)
        document.getElementById(airlineNameId).style.visibility='hidden';
}

function SetHidFieldDTSelect(setValue, hidFieldId)
{
    if(document.getElementById(hidFieldId)!=null)
        document.getElementById(hidFieldId).value=setValue;    
}

function SetChkBoxHidFieldDTSelect(setValue,checkBoxClicked, hidFieldId)
{
    var existing='';
    if(document.getElementById(hidFieldId)!=null)
    {
        existing=document.getElementById(hidFieldId).value;    
    }
    if(checkBoxClicked.checked)
    {
        var currString=new String(existing);        
        var index=currString.search(setValue);
        existing+='|'+setValue;        
    }
    else
    {
        var currString=new String(existing);        
        var index=currString.search(setValue);
        if(index>-1)
        {
            var newList='';
            var selectedItems=currString.split('|'); 
            for(var i=0;i<selectedItems.length;i++)
            {
                if(selectedItems[i]!=setValue)
                {
                    newList+=selectedItems[i]+'|';
                }
            }
            existing=newList;
       }
    }

    if(document.getElementById(hidFieldId)!=null)
    {
        document.getElementById(hidFieldId).value=existing;
    }    
}

function ChangeTabClass(id, classname)
{
    document.getElementById('tabflights').className = "wvtabstop";
    document.getElementById('tabhotels').className = "wvtabstop";
    document.getElementById('tabcars').className = "wvtabstop";
    
    document.getElementById('tabcruises').className = "wvtabsspan";
    document.getElementById('tabpackages').className = "wvtabsspan";
    document.getElementById('tabactivity').className = "wvtabsspan";
    document.getElementById('tabvacations').className = "wvtabsspan";
    
    document.getElementById(id).className = classname;       
}

function GetHeight(id)
{
    var heights = new Array();
    heights[0] = '500';
    heights[1] = '480';
    heights[2] = '640';
    
    var list = document.getElementsByName(document.getElementById(id).name);
    for(i=0;i<list.length;i++)
    {
        if(list[i].checked == true)
            return heights[i];
    }
    return heights[0];
}


function TogglePickQuickCarSearchDivs(drpCarPickUpCarAt,divCarPickCity,divCarPickAirport) 
{
    if(drpCarPickUpCarAt!=null)
    {
        var carDrpList =document.getElementById(drpCarPickUpCarAt);
        if(carDrpList!=null)
        {
            var selectedIndex =carDrpList.selectedIndex;
            var selectedValue = carDrpList.options[selectedIndex].value; 
            if(selectedValue!=null)
            {
                if(selectedValue=='Airport')
                {
                    showDiv(divCarPickAirport);
                    hideDiv(divCarPickCity);                        
                }
                if(selectedValue=='City')
                {
                    showDiv(divCarPickCity);
                    hideDiv(divCarPickAirport);            
                }
            }
        }
    }
}

function QuickCarSearchDropDisplay(drpCarSearchCritria,divCity,divAirport,divAttraction,divZipCode,divRadius)
{

    if(drpCarSearchCritria!=null)
    {
    
        var carDrpList =document.getElementById(drpCarSearchCritria);
        if(carDrpList!=null)
        {
            var selectedIndex =carDrpList.selectedIndex;
            if(selectedIndex==0)
                hideDiv(divRadius);
            else
                showDiv(divRadius);
        }
    }
    QuickCarSearchDivsDisplay(drpCarSearchCritria,divCity,divAirport,divAttraction,divZipCode);
}

function QuickCarSearchDivsDisplay(drpCarSearchCritria,divCity,divAirport,divAttraction,divZipCode) 
{
   
    if(drpCarSearchCritria!=null)
    {
    
        var carDrpList =document.getElementById(drpCarSearchCritria);
        if(carDrpList!=null)
        {
            var selectedIndex =carDrpList.selectedIndex;
            var selectedValue = carDrpList.options[selectedIndex].value; 
            if(selectedValue!=null)
            {
                if(selectedValue=='Airport')
                {
                    showDiv(divAirport);
                    hideDiv(divCity);  
                    hideDiv(divAttraction);
                    hideDiv(divZipCode);                      
                }
               else if(selectedValue=='City')
                {
                    showDiv(divCity);
                    hideDiv(divAirport);  
                    hideDiv(divAttraction);
                    hideDiv(divZipCode);              
                }
                else if(selectedValue=='Attraction')
                {
                    showDiv(divAttraction);
                    hideDiv(divAirport);  
                    hideDiv(divCity);
                    hideDiv(divZipCode);              
                }
                else if(selectedValue=='ZipCode')
                {
                    showDiv(divZipCode);
                    hideDiv(divAirport);  
                    hideDiv(divAttraction);
                    hideDiv(divCity);              
                }
                else
                {
                    hideDiv(divZipCode);
                    hideDiv(divAirport);  
                    hideDiv(divAttraction);
                    hideDiv(divCity);                 
                    
                }
                
//                if(selectedValue=='SameAsPickUp')
//                {
//                    hideDiv(divAirport);
//                    hideDiv(divCity);  
//                    hideDiv(divAttraction);
//                    hideDiv(divZipCode);                      
//                }
                
            }
        }
    }
}


function ToggleDropQuickCarSearchDivs(drpCarDropOffCarAt, divCarDropCity, divCarDropAirport) 
{
   if(drpCarDropOffCarAt!=null)
    {
        var carDrpList =document.getElementById(drpCarDropOffCarAt);
        if(carDrpList!=null)
        {
            var selectedIndex =carDrpList.selectedIndex;
            var selectedValue = carDrpList.options[selectedIndex].value; 
            if(selectedValue!=null)
            {
                if( selectedValue == 'Airport')
                {
                    showDiv(divCarDropAirport);
                    hideDiv(divCarDropCity);                        
                }
                if( selectedValue == 'City')
                {
                    showDiv(divCarDropCity);
                    hideDiv(divCarDropAirport);            
                }
            }
        }
    }
}

function ToggleHotelQuickSearchDivs(drpHotelSearch, divHotelCity, divHotelAirport, divHotelZipCode) 
{
   if(drpHotelSearch!=null)
    {
        var drpListHotelSearch =document.getElementById(drpHotelSearch);
        if(drpListHotelSearch!=null)
        {
            var selectedIndex =drpListHotelSearch.selectedIndex;
            var selectedValue = drpListHotelSearch.options[selectedIndex].value; 
            if(selectedValue!=null)
            {
                if(selectedValue=='Airport')
                {
                    showDiv(divHotelAirport);
                    hideDiv(divHotelCity);
                    hideDiv(divHotelZipCode);                         
                }
                else if(selectedValue=='City')
                {
                    showDiv(divHotelCity);
                    hideDiv(divHotelAirport);
                    hideDiv(divHotelZipCode);             
                }
                else if(selectedValue=='ZipCode')
                {
                    showDiv(divHotelZipCode);
                    hideDiv(divHotelCity); 
                    hideDiv(divHotelAirport);            
                }
            }
        }
    }
}

function ToggleAirQuickSearchDivs(drpAirSearchType, returnDateDiv) 
{
    if(drpAirSearchType!=null)
    {
        var drpListAirSearchType = document.getElementById(drpAirSearchType);
        if(drpListAirSearchType!=null)
        {
            var selectedIndex =drpListAirSearchType.selectedIndex;
            var selectedValue = drpListAirSearchType.options[selectedIndex].value; 
            if(selectedValue!=null)
            {
                if(selectedValue=='RT')
                {
                    showDiv(returnDateDiv);
                }
                else if(selectedValue=='OW')
                {
                    hideDiv(returnDateDiv);             
                }
            }
        }
    }
}


//Function To Toggle Hotel Search Divs in Home Page.....
function ToggleHotelSearchDivs(drpHotelSearch,redirectFlag,ctlWhereValidatorId,locatioIds) 
{
    if(drpHotelSearch!=null)
    {
        var hotelDrpList =document.getElementById(drpHotelSearch);
        var ctlWhereValidator =(ctlWhereValidatorId!= null)?document.getElementById(ctlWhereValidatorId):null;
        var locationTxtIds = (typeof(locatioIds)!='undefined'|| locatioIds != null)?locatioIds.split(','):null;
        var cityId = "";
        var airportId = ""; 
        var zipCodeId = "";
        var attractionId = "";
        var addressId = "";
        var controlTovalidateId = "";
        var errorMsg ="";
        if(locationTxtIds != null && locationTxtIds.length>0)
        {
            for(var i=0;i<locationTxtIds.length;i++)
            {
                if(locationTxtIds[i].indexOf('City')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        cityId = locations[1];
                }
                if(locationTxtIds[i].indexOf('Airport')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        airportId = locations[1];
                }
                if(locationTxtIds[i].indexOf('Address')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        addressId = locations[1];
                }
                if(locationTxtIds[i].indexOf('Attraction')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        attractionId = locations[1];
                }
                if(locationTxtIds[i].indexOf('ZipCode')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        zipCodeId = locations[1];
                }
            }
        }
        if(hotelDrpList!=null)
        {
            var selectedIndex =hotelDrpList.selectedIndex;
            var selectedValue = hotelDrpList.options[selectedIndex].value; 
            if(selectedValue!=null)
            {
                hideDiv('divHotelAtAttraction');
                hideDiv('divHotelAtCity');
                hideDiv('divHotelAtAirport');
                hideDiv('divHotelAtZipCode');
                hideDiv('divHotelAtAddress');
                
                 switch(selectedValue)
                 {
                    case "Airport":
                        showDiv('divHotelAtAirport');
                        if(airportId != "")
                        {
                            controlTovalidateId = airportId;
                            errorMsg = "Airport Location required.";
                        }
                        break;
                    case "ZipCode":
                        showDiv('divHotelAtZipCode');
                        if(zipCodeId != "")
                        {
                            controlTovalidateId = zipCodeId;
                            errorMsg = "Zip code required.";
                        }
                        break;
                    case "City":
                        showDiv('divHotelAtCity');
                        if(cityId != "")
                        {
                            controlTovalidateId = cityId;
                            errorMsg = "City location required.";
                        }
                        break;
                    case "Attraction":
                        showDiv('divHotelAtAttraction');
                        if(attractionId != "")
                        {
                            controlTovalidateId = attractionId;
                            errorMsg = "Attraction location required.";
                        }
                        break;
                    case "Address":
                        showDiv('divHotelAtAddress');
                        if(addressId != "")
                        {
                            controlTovalidateId = addressId;
                            errorMsg = "Address location required.";
                         }
                        if(redirectFlag==true)
                            location.href = "Hotel/Search.aspx?SrcMode=Address";
                        break;
                 }
            }
            if(controlTovalidateId !="")
            {
                ctlWhereValidator.controltovalidate =controlTovalidateId;
                ctlWhereValidator.errormessage = errorMsg;
            }
        }
    }
}
//Function To Toggle Hotel Search Divs in Home Page.....Ends Here

//Function To Toggle Car Search Divs Pick Up in Home Page.....
function ToggleCarSearchDivsPickUp(drpCarSearchPickUp,redirectFlag,ctlWhereValidatorId,locatioIds) 
{
    if(drpCarSearchPickUp!=null)
    {
        var ctlWhereValidator =(ctlWhereValidatorId!= null)?document.getElementById(ctlWhereValidatorId):null;
        var locationTxtIds = (typeof(locatioIds)!='undefined'|| locatioIds != null)?locatioIds.split(','):null;
        var cityId = "";
        var airportId = "";
        var zipCodeId = "";
        var attractionId = "";
        var addressId = "";
        var controlTovalidateId = "";
        var errorMsg ="";
        if(locationTxtIds != null && locationTxtIds.length>0)
        {
            for(var i=0;i<locationTxtIds.length;i++)
            {
                if(locationTxtIds[i].indexOf('City')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        cityId = locations[1];
                }
                if(locationTxtIds[i].indexOf('Airport')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        airportId = locations[1];
                }
                if(locationTxtIds[i].indexOf('Address')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        addressId = locations[1];
                }
                if(locationTxtIds[i].indexOf('Attraction')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        attractionId = locations[1];
                }
                if(locationTxtIds[i].indexOf('ZipCode')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        zipCodeId = locations[1];
                }
            }
        }
        var carDrpList =document.getElementById(drpCarSearchPickUp);
        if(carDrpList!=null)
        {
            var selectedIndex =carDrpList.selectedIndex;
            var selectedValue = carDrpList.options[selectedIndex].value; 
             if(selectedValue!=null)
            {
                hideDiv('divCarAtAttractionPickUp');
                hideDiv('divCarAtCityPickUp');
                hideDiv('divCarAtAirportPickUp');
                hideDiv('divCarAtZipCodePickUp');
                hideDiv('divCarAtAdressPickUp');
                switch(selectedValue)
                 {
                    case "Airport":
                        showDiv('divCarAtAirportPickUp');
                        if(airportId != "")
                        {
                            controlTovalidateId = airportId;
                            errorMsg = "Airport Location required.";
                        }
                        break;
                    case "ZipCode":
                        showDiv('divCarAtZipCodePickUp');
                        if(zipCodeId != "")
                        {
                            controlTovalidateId = zipCodeId;
                            errorMsg = "Airport Location required.";
                        }
                        break;
                    case "City":
                        showDiv('divCarAtCityPickUp');
                        if(cityId != "")
                        {
                            controlTovalidateId = cityId;
                            errorMsg = "Airport Location required.";
                        }
                        break;
                    case "Attraction":
                        showDiv('divCarAtAttractionPickUp');
                        if(attractionId != "")
                        {
                            controlTovalidateId = attractionId;
                            errorMsg = "Airport Location required.";
                        }
                        break;
                    case "Address":
                        showDiv('divCarAtAdressPickUp');
                        if(addressId != "")
                        {
                            controlTovalidateId = addressId;
                            errorMsg = "Airport Location required.";
                        }
                        if(redirectFlag==true)
                            location.href = "Car/Search.aspx?SrcMode=Address";
                        break;
                 }
            }
        }
        if(controlTovalidateId !="")
        {
            ctlWhereValidator.controltovalidate =controlTovalidateId;
            ctlWhereValidator.errormessage = errorMsg;
        }
    }
}
//Function To Toggle Car Search PickUp Divs in Home Page.....


//Function To Toggle Car Search Divs Drop Up in Home Page.....
function ToggleCarSearchDivsDropoff(drpCarSearchDropoff,redirectFlag,ctlWhereValidatorId,locatioIds) 
{
    if(drpCarSearchDropoff!=null)
    {
        var ctlWhereValidator =(ctlWhereValidatorId!= null)?document.getElementById(ctlWhereValidatorId):null;
        var locationTxtIds = (typeof(locatioIds)!='undefined'|| locatioIds != null)?locatioIds.split(','):null;
        var cityId = "";
        var airportId = "";
        var zipCodeId = "";
        var attractionId = "";
        var addressId = "";
        var controlTovalidateId = "";
        var errorMsg ="";
        if(locationTxtIds != null && locationTxtIds.length>0)
        {
            for(var i=0;i<locationTxtIds.length;i++)
            {
                if(locationTxtIds[i].indexOf('City')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        cityId = locations[1];
                }
                if(locationTxtIds[i].indexOf('Airport')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        airportId = locations[1];
                }
                if(locationTxtIds[i].indexOf('Address')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        addressId = locations[1];
                }
                if(locationTxtIds[i].indexOf('Attraction')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        attractionId = locations[1];
                }
                if(locationTxtIds[i].indexOf('ZipCode')!=-1)
                {
                    var locations = locationTxtIds[i].split('=');
                    if(locations != null && locations.length>1)
                        zipCodeId = locations[1];
                }
            }
        }
        var carDrpList =document.getElementById(drpCarSearchDropoff);
        if(carDrpList!=null)
        {
            toggleAllChildValidators(true, ctlWhereValidator);
            var selectedIndex =carDrpList.selectedIndex;
            var selectedValue = carDrpList.options[selectedIndex].value; 
             if(selectedValue!=null)
            {
                    hideDiv('divCarAtAttractionDropoff');
                    hideDiv('divCarAtCityDropoff');
                    hideDiv('divCarAtAirportDropoff');
                    hideDiv('divCatAtZipCodeDropoff');
                    hideDiv('divCarAtSameAsPickUp');
                    hideDiv('divCarAtAddressDropoff');
                    
                    switch(selectedValue)
                    {
                    case "Same as pickup":
                        showDiv('divCarAtSameAsPickUp');
                        toggleAllChildValidators(false, ctlWhereValidator)
                        break;
                    case "Airport":
                        showDiv('divCarAtAirportDropoff');
                        if(airportId != "")
                        {
                            controlTovalidateId = airportId;
                            errorMsg = "Airport Location required.";
                        }
                        break;
                    case "ZipCode":
                        showDiv('divCatAtZipCodeDropoff');
                        if(zipCodeId != "")
                        {
                            controlTovalidateId = zipCodeId;
                            errorMsg = "Airport Location required.";
                        }
                        break;
                    case "City":
                        showDiv('divCarAtCityDropoff');
                        if(cityId != "")
                        {
                            controlTovalidateId = cityId;
                            errorMsg = "Airport Location required.";
                        }
                        break;
                    case "Attraction":
                        showDiv('divCarAtAttractionDropoff');
                        if(attractionId != "")
                        {
                            controlTovalidateId = attractionId;
                            errorMsg = "Airport Location required.";
                        }
                        break;
                    case "Address":
                        showDiv('divCarAtAddressDropoff');
                        if(addressId != "")
                        {
                            controlTovalidateId = addressId;
                            errorMsg = "Airport Location required.";
                        }
                        if(redirectFlag==true)
                            location.href = "Car/Search.aspx?SrcMode=Address";
                        break;
                    }
            }
        }
        if(controlTovalidateId !="")
        {
            ctlWhereValidator.controltovalidate =controlTovalidateId;
            ctlWhereValidator.errormessage = errorMsg;
        }
    }
}


/*handling Water Mark for date text boxes */
function OnFocus(elementId, defaultText)
{ 
   if (document.getElementById(elementId).value == defaultText)
   {
      document.getElementById(elementId).className = "normal";
      document.getElementById(elementId).value = "";
   }
}
function OnBlur(elementId, defaultText)
{
   var textValue = document.getElementById(elementId).value;

   if (textValue == defaultText || textValue.length == 0)
   {
      document.getElementById(elementId).className = "watermark";
      document.getElementById(elementId).value = defaultText;
   }
   else
      document.getElementById(elementId).className = "normal";
}

function OpenPopupWindow(url) 
{
    popWindow = window.open(url, "mywindow", "location=1,status=1,scrollbars=1,resizable=1,toolbar=1,menubar=1,height=auto,width=auto");
    return false;
}

function OpenDreamTripPopupWindow(url) 
{
    //popWindow = window.open(url, "mywindow", "location=1,status=1,scrollbars=1,resizable=1,toolbar=1,menubar=1,height=700,width=700");
    popWindow = window.open(url,'mywindow','height=650,width=1050,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,location=yes');
    return false;
}



function PopulatePaxDetails(chkBoxSelf,hidTitle,hidFName,hidMName,hidLName,hidEmail,hidAge,drpTitle,txtFName,txtMName,txtLName,txtEmail,txtEmailConfirm,drpAge,memberId,divPushToProfileOuterDivId,divPushToProfileInnerDivId,txtId,hidSuffix,drpSuffix,hidGender,drpGender,hidBDateDD,drpDate,hidBDateMM,drpMonth,hidBDateYYYY,drpYear)
{
    var memberIds=[];
    var txtIds=[];
    var pushToProfileOuterDivIds=[];
    var pushToProfileInnerDivIds=[];
    memberIds=memberId.split(',');
    txtIds=txtId.split(',');
    pushToProfileOuterDivIds=divPushToProfileOuterDivId.split(',');
    pushToProfileInnerDivIds=divPushToProfileInnerDivId.split(',');
    
    if(pushToProfileInnerDivIds!=null)
        {
        for(var i=0;i<pushToProfileInnerDivIds.length;i++)
            {
                if(pushToProfileInnerDivIds[i]!=null)
                     hideDiv(pushToProfileInnerDivIds[i]);
             } 
         
         }
    
    if(document.getElementById(chkBoxSelf).checked==true)
    {
        document.getElementById(txtFName).value = document.getElementById(hidFName).value;
        document.getElementById(txtMName).value = document.getElementById(hidMName).value;
        document.getElementById(txtLName).value = document.getElementById(hidLName).value;
        document.getElementById(txtEmail).value = document.getElementById(hidEmail).value;
        document.getElementById(txtEmailConfirm).value = document.getElementById(hidEmail).value;
        document.getElementById(drpAge).value = document.getElementById(hidAge).value;  
        if(document.getElementById(hidSuffix).value == "")
         {document.getElementById(drpSuffix).value = "";}
        else
         {document.getElementById(drpSuffix).value = document.getElementById(hidSuffix).value;}
        if(document.getElementById(hidGender).value == "")
        {
            document.getElementById(drpGender).value = "";
        }
        else
        {
            document.getElementById(drpGender).value = document.getElementById(hidGender).value;
        }          
        document.getElementById(drpDate).value = document.getElementById(hidBDateDD).value;  
        document.getElementById(drpMonth).value = document.getElementById(hidBDateMM).value;  
        document.getElementById(drpYear).value = document.getElementById(hidBDateYYYY).value;  
        
        
        //Populate Loyalty program number.
        if(txtIds!=null && txtIds.length>0 && memberIds!=null && memberIds.length>0)
        {
            for(var i=0;i<txtIds.length && i<memberIds.length;i++)
            {
                var txtId1=document.getElementById(txtIds[i]);
                if(txtId1!=null)
                {
                    txtId1.value=memberIds[i];
                }
            }
        } 
        if(pushToProfileOuterDivIds!=null)
        {
        for(var i=0;i<pushToProfileOuterDivIds.length;i++)
            {
                if(pushToProfileOuterDivIds[i]!=null)
                     showDiv(pushToProfileOuterDivIds[i]);
             } 
         
         }
    }
    else
    {
        document.getElementById(txtFName).value = "";
        document.getElementById(txtMName).value = "";
        document.getElementById(txtLName).value = "";
        document.getElementById(txtEmail).value = "";
        document.getElementById(txtEmailConfirm).value = "";
        
        var drpSuffix = document.getElementById(drpSuffix);
        if(drpSuffix != null)
            drpSuffix.selectedIndex = 0;
        var drpGender = document.getElementById(drpGender);
        if(drpGender != null)
            drpGender.selectedIndex = 0;
        var drpDate = document.getElementById(drpDate);
        if(drpDate != null)
            drpDate.selectedIndex = 0;
        var drpMonth = document.getElementById(drpMonth);
        if(drpMonth != null)
            drpMonth.selectedIndex = 0;
        var drpYear = document.getElementById(drpYear);
        if(drpYear != null)
            drpYear.selectedIndex = 0;      
        var drpEleAge = document.getElementById(drpAge);
        if(drpEleAge != null)
            drpEleAge.selectedIndex = 0;
          if(txtIds!=null && txtIds.length>0)
        {
            for(var i=0;i<txtIds.length;i++)
            {
                var txtId1=document.getElementById(txtIds[i]);
                if(txtId1!=null)
                    txtId1.value="";
            }
        }
        if(pushToProfileOuterDivIds!=null)
        {
        for(var i=0;i<pushToProfileOuterDivIds.length;i++)
            {
                if(pushToProfileOuterDivIds[i]!=null)
                     hideDiv(pushToProfileOuterDivIds[i]);
             } 
         
         }
    }      
}

function SetVacationDestCity(elem,hidFldId)
{
    document.getElementById(hidFldId).value = elem.options[elem.selectedIndex].value;
}

 function ClearChkBox(id,count,status)
    {
        ctlId = id.substring(0,id.length-1);
        for(var i=0;i<count;i++)
        {
            var chkBox = document.getElementById(ctlId+(i+1));
            if(chkBox !=null)
            {
                if(status =="true")
                    chkBox.checked = false;
                else
                    chkBox.checked = true;
            }
        }     
    }
   function ToggleDivDisplay(divId)
    {
       var div = document.getElementById(divId);       
        if(div !=null)
        {
          if(div.style.display=="none")
          {
            div.style.display ="block";
            div.style.visibility ="visible";                
          }
          else
          {
            div.style.display ="none";
            div.style.visibility ="hidden";
            
          }
        }
    }
    
    
    function ToggleDisplay(divId,imgId)
    {
       var div = document.getElementById(divId);
        var img = document.getElementById(imgId);
        if(div !=null)
        {
          if(div.style.display=="none")
          {
            div.style.display ="block";
            div.style.visibility ="visible";
            img.style.display ="none";
            img.style.visibility ="hidden";            
          }
          else
          {
            div.style.display ="none";
            div.style.visibility ="hidden";
            img.style.display ="block";
            img.style.visibility ="visible";
          }
        }
    }
    function ToggleDivImageDisplay(divId,imgId,imgExpandedId)
    {
       var div = document.getElementById(divId);
        var img = document.getElementById(imgId);
        var imgExpanded = document.getElementById(imgExpandedId);
        if(div !=null)
        {
          if(div.style.display=="none")
          {
            div.style.display ="block";
            div.style.visibility ="visible";
            img.style.display ="none";
            img.style.visibility ="hidden"; 
            imgExpanded.style.display ="block";
            imgExpanded.style.visibility ="visible";
                       
          }
          else
          {
            div.style.display ="none";
            div.style.visibility ="hidden";
            img.style.display ="block";
            img.style.visibility ="visible";
            imgExpanded.style.display ="none";
            imgExpanded.style.visibility ="hidden";
          }
        }
    }
    function ToggleDisplayOnly(checkBoxId,divId)
    {
      var id=document.getElementById(checkBoxId);
       var div = document.getElementById(divId);
        if(div !=null && id!=null)
        {
          if(id.checked)
          {
            div.style.display ="block";
            div.style.visibility ="visible";           
          }
          else
          {
            div.style.display ="none";
            div.style.visibility ="hidden";          
          }
        }
    }
    

function AillinesNoPreference(lstSelectedAir)
{

     var lstSelectedAirlines=document.getElementById(lstSelectedAir);
     
     if(lstSelectedAirlines!=null)
     {
        if(lstSelectedAirlines.options.length>1)
        {
            for(i=0;i<lstSelectedAirlines.options.length;i++)
            {
                if(lstSelectedAirlines.options[i].text=="No Preference")
                {
                    lstSelectedAirlines.options[i]=null;
                    lstSelectedAirlines.selectedIndex=-1;
                }
            }          
        }
        
     }
      
    if(lstSelectedAirlines.options.length==0)
    {
    
        lstSelectedAirlines.options[0]=new Option("No Preference",null);
    }
    return false;

}                             
                                  
                                  /* SOURCE FILE: selectbox.js */

// HISTORY
// ------------------------------------------------------------------
// June 12, 2003: Modified up and down functions to support more than
//                one selected option
/*
DESCRIPTION: These are general functions to deal with and manipulate
select boxes. Also see the OptionTransfer library to more easily 
handle transferring options between two lists

COMPATABILITY: These are fairly basic functions - they should work on
all browsers that support Javascript.
*/


// -------------------------------------------------------------------
// hasOptions(obj)
//  Utility function to determine if a select object has an options array
// -------------------------------------------------------------------
function hasOptions(obj) {
	if (obj!=null && obj.options!=null) { return true; }
	return false;
	}

// -------------------------------------------------------------------
// selectUnselectMatchingOptions(select_object,regex,select/unselect,true/false)
//  This is a general function used by the select functions below, to
//  avoid code duplication
// -------------------------------------------------------------------
function selectUnselectMatchingOptions(obj,regex,which,only) {
	if (window.RegExp) {
		if (which == "select") {
			var selected1=true;
			var selected2=false;
			}
		else if (which == "unselect") {
			var selected1=false;
			var selected2=true;
			}
		else {
			return;
			}
		var re = new RegExp(regex);
		if (!hasOptions(obj)) { return; }
		for (var i=0; i<obj.options.length; i++) {
			if (re.test(obj.options[i].text)) {
				obj.options[i].selected = selected1;
				}
			else {
				if (only == true) {
					obj.options[i].selected = selected2;
					}
				}
			}
		}
	}
		
		
function ToggleDrpodownStatus(drp,cardSel,status)
{

    var dropDown=document.getElementById(drp);   
    var cardSelectionOption=document.getElementById(cardSel);   
    if(dropDown!=null)
    {
        if(status==false)
        {
            dropDown.disabled=true;
            cardSelectionOption.value="2";            
        }
        else
        {
            dropDown.disabled=false;
            cardSelectionOption.value="1";    
        }
    }
}
function toggleAllChildValidatorsByID(status,controlid)
{
    var control=document.getElementById(controlid);
    toggleAllChildValidators(status,control);
}
// -------------------------------------------------------------------
// selectMatchingOptions(select_object,regex)
//  This function selects all options that match the regular expression
//  passed in. Currently-selected options will not be changed.
// -------------------------------------------------------------------
function selectMatchingOptions(obj,regex) {
	selectUnselectMatchingOptions(obj,regex,"select",false);
	}
// -------------------------------------------------------------------
// selectOnlyMatchingOptions(select_object,regex)
//  This function selects all options that match the regular expression
//  passed in. Selected options that don't match will be un-selected.
// -------------------------------------------------------------------
function selectOnlyMatchingOptions(obj,regex) {
	selectUnselectMatchingOptions(obj,regex,"select",true);
	}
// -------------------------------------------------------------------
// unSelectMatchingOptions(select_object,regex)
//  This function Unselects all options that match the regular expression
//  passed in. 
// -------------------------------------------------------------------
function unSelectMatchingOptions(obj,regex) {
	selectUnselectMatchingOptions(obj,regex,"unselect",false);
	}
	
// -------------------------------------------------------------------
// sortSelect(select_object)
//   Pass this function a SELECT object and the options will be sorted
//   by their text (display) values
// -------------------------------------------------------------------
function sortSelect(obj) {
	var o = new Array();
	if (!hasOptions(obj)) { return; }
	for (var i=0; i<obj.options.length; i++) {
		o[o.length] = new Option( obj.options[i].text, obj.options[i].value, obj.options[i].defaultSelected, obj.options[i].selected) ;
		}
	if (o.length==0) { return; }
	o = o.sort( 
		function(a,b) { 
			if ((a.text+"") < (b.text+"")) { return -1; }
			if ((a.text+"") > (b.text+"")) { return 1; }
			return 0;
			} 
		);

	for (var i=0; i<o.length; i++) {
		obj.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
		}
	}

// -------------------------------------------------------------------
// selectAllOptions(select_object)
//  This function takes a select box and selects all options (in a 
//  multiple select object). This is used when passing values between
//  two select boxes. Select all options in the right box before 
//  submitting the form so the values will be sent to the server.
// -------------------------------------------------------------------
function selectAllOptions(obj) {
	if (!hasOptions(obj)) { return; }
	for (var i=0; i<obj.options.length; i++) {
		obj.options[i].selected = true;
		}
	}
	
// -------------------------------------------------------------------
// moveSelectedOptions(select_object,select_object[,autosort(true/false)[,regex]])
//  This function moves options between select boxes. Works best with
//  multi-select boxes to create the common Windows control effect.
//  Passes all selected values from the first object to the second
//  object and re-sorts each box.
//  If a third argument of 'false' is passed, then the lists are not
//  sorted after the move.
//  If a fourth string argument is passed, this will function as a
//  Regular Expression to match against the TEXT or the options. If 
//  the text of an option matches the pattern, it will NOT be moved.
//  It will be treated as an unmoveable option.
//  You can also put this into the <SELECT> object as follows:
//    onDblClick="moveSelectedOptions(this,this.form.target)
//  This way, when the user double-clicks on a value in one box, it
//  will be transferred to the other (in browsers that support the 
//  onDblClick() event handler).
// -------------------------------------------------------------------
function moveSelectedOptions(from,to) {
	// Unselect matching options, if required
	
	if (arguments.length>3) 
	{
		var regex = arguments[3];
		if (regex != "") 
		{
			unSelectMatchingOptions(from,regex);
		}
	}
	// Move them over
	if (!hasOptions(from)) { return; }
	for (var i=0; i<from.options.length; i++) 
	{
		var o = from.options[i];
		if (o.selected) 
		{
			if (!hasOptions(to)) 
			{ 
			    var index = 0; 
			} 
			else 
			{ 
			    var index=to.options.length; 
			}
			if(o.text != "No Preference" )
			{
		        to.options[index] = new Option( o.text, o.value, false, false);
		    }
		}
	}
	// Delete them from original
	for (var i=(from.options.length-1); i>=0; i--) {
		var o = from.options[i];
		if (o.selected) {
			from.options[i] = null;
			}
		}
	if ((arguments.length<3) || (arguments[2]==true)) {
		sortSelect(from);
		sortSelect(to);
		}
	from.selectedIndex = -1;
	to.selectedIndex = -1;
	}

// -------------------------------------------------------------------
// copySelectedOptions(select_object,select_object[,autosort(true/false)])
//  This function copies options between select boxes instead of 
//  moving items. Duplicates in the target list are not allowed.
// -------------------------------------------------------------------
function copySelectedOptions(from,to) {
	var options = new Object();
	if (hasOptions(to)) {
		for (var i=0; i<to.options.length; i++) {
			options[to.options[i].value] = to.options[i].text;
			}
		}
	if (!hasOptions(from)) { return; }
	for (var i=0; i<from.options.length; i++) {
		var o = from.options[i];
		if (o.selected) {
			if (options[o.value] == null || options[o.value] == "undefined" || options[o.value]!=o.text) {
				if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
				to.options[index] = new Option( o.text, o.value, false, false);
				}
			}
		}
	if ((arguments.length<3) || (arguments[2]==true)) {
		sortSelect(to);
		}
	from.selectedIndex = -1;
	to.selectedIndex = -1;
	}

// -------------------------------------------------------------------
// moveAllOptions(select_object,select_object[,autosort(true/false)[,regex]])
//  Move all options from one select box to another.
// -------------------------------------------------------------------
function moveAllOptions(from,to) 
{
//    for (var i = 0; i < from.options.length; i++)
//        to.options[i] = new Option(from.options[i].text, from.options[i].value);
//        from.options.length = 0;


// Unselect matching options, if required
    
	if (arguments.length>3) 
	{
		var regex = arguments[3];
		if (regex != "") 
		{
			unSelectMatchingOptions(from,regex);
		}
	}
	// Move them over
	if (!hasOptions(from)) 
	{
	    return; 
	}
	var k= 0;
	for (var i=0; i<from.options.length; i++) 
	{
		var o = from.options[i];
		
			if (!hasOptions(to)) 
			{ 
			    var index = 0;
		    } 
		    else 
		    { 
		        var index=to.options.length; 
		    }
		    if(o.text != "No Preference" )
			{
			    to.options[index] = new Option( o.text, o.value, false, false);
	        }
	}
	// Delete them from original
	for (var i=(from.options.length-1); i>=0; i--) 
	{
		var o = from.options[i];
		
			from.options[i] = null;
		
	}
	if ((arguments.length<3) || (arguments[2]==true)) 
	{
		sortSelect(from);
		sortSelect(to);
	}
	from.selectedIndex = -1;
	to.selectedIndex = -1;
//	selectAllOptions(from);
//	if (arguments.length==2) {
//		moveSelectedOptions(from,to);
//		}
//	else if (arguments.length==3) {
//		moveSelectedOptions(from,to,arguments[2]);
//		}
//	else if (arguments.length==4) {
//		moveSelectedOptions(from,to,arguments[2],arguments[3]);
//		}
	}

// -------------------------------------------------------------------
// copyAllOptions(select_object,select_object[,autosort(true/false)])
//  Copy all options from one select box to another, instead of
//  removing items. Duplicates in the target list are not allowed.
// -------------------------------------------------------------------
function copyAllOptions(from,to) {
	selectAllOptions(from);
	if (arguments.length==2) {
		copySelectedOptions(from,to);
		}
	else if (arguments.length==3) {
		copySelectedOptions(from,to,arguments[2]);
		}
	}

// -------------------------------------------------------------------
// swapOptions(select_object,option1,option2)
//  Swap positions of two options in a select list
// -------------------------------------------------------------------
function swapOptions(obj,i,j) {
	var o = obj.options;
	var i_selected = o[i].selected;
	var j_selected = o[j].selected;
	var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
	var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
	o[i] = temp2;
	o[j] = temp;
	o[i].selected = j_selected;
	o[j].selected = i_selected;
	}
	
// -------------------------------------------------------------------
// moveOptionUp(select_object)
//  Move selected option in a select list up one
// -------------------------------------------------------------------
function moveOptionUp(obj) {
	if (!hasOptions(obj)) { return; }
	for (i=0; i<obj.options.length; i++) {
		if (obj.options[i].selected) {
			if (i != 0 && !obj.options[i-1].selected) {
				swapOptions(obj,i,i-1);
				obj.options[i-1].selected = true;
				}
			}
		}
	}

// -------------------------------------------------------------------
// moveOptionDown(select_object)
//  Move selected option in a select list down one
// -------------------------------------------------------------------
function moveOptionDown(obj) {
	if (!hasOptions(obj)) { return; }
	for (i=obj.options.length-1; i>=0; i--) {
		if (obj.options[i].selected) {
			if (i != (obj.options.length-1) && ! obj.options[i+1].selected) {
				swapOptions(obj,i,i+1);
				obj.options[i+1].selected = true;
				}
			}
		}
	}

// -------------------------------------------------------------------
// removeSelectedOptions(select_object)
//  Remove all selected options from a list
//  (Thanks to Gene Ninestein)
// -------------------------------------------------------------------
function removeSelectedOptions(from) { 
	if (!hasOptions(from)) { return; }
	for (var i=(from.options.length-1); i>=0; i--) { 
		var o=from.options[i]; 
		if (o.selected) { 
			from.options[i] = null; 
			} 
		} 
	from.selectedIndex = -1; 
	} 

// -------------------------------------------------------------------
// removeAllOptions(select_object)
//  Remove all options from a list
// -------------------------------------------------------------------
function removeAllOptions(from) { 
	if (!hasOptions(from)) { return; }
	for (var i=(from.options.length-1); i>=0; i--) { 
		from.options[i] = null; 
		} 
	from.selectedIndex = -1; 
	} 

// -------------------------------------------------------------------
// addOption(select_object,display_text,value,selected)
//  Add an option to a list
// -------------------------------------------------------------------
function addOption(obj,text,value,selected) {
	if (obj!=null && obj.options!=null) {
		obj.options[obj.options.length] = new Option(text, value, false, selected);
		}
	}


/* SOURCE FILE: OptionTransfer.js */

/* 
OptionTransfer.js
Last Modified: 7/12/2004

DESCRIPTION: This widget is used to easily and quickly create an interface
where the user can transfer choices from one select box to another. For
example, when selecting which columns to show or hide in search results.
This object adds value by automatically storing the values that were added
or removed from each list, as well as the state of the final list. 

COMPATABILITY: Should work on all Javascript-compliant browsers.

USAGE:
// Create a new OptionTransfer object. Pass it the field names of the left
// select box and the right select box.
var ot = new OptionTransfer("from","to");

// Optionally tell the lists whether or not to auto-sort when options are 
// moved. By default, the lists will be sorted.
ot.setAutoSort(true);

// Optionally set the delimiter to be used to separate values that are
// stored in hidden fields for the added and removed options, as well as
// final state of the lists. Defaults to a comma.
ot.setDelimiter("|");

// You can set a regular expression for option texts which are _not_ allowed to
// be transferred in either direction
ot.setStaticOptionRegex("static");

// These functions assign the form fields which will store the state of
// the lists. Each one is optional, so you can pick to only store the
// new options which were transferred to the right list, for example.
// Each function takes the name of a HIDDEN or TEXT input field.

// Store list of options removed from left list into an input field
ot.saveRemovedLeftOptions("removedLeft");
// Store list of options removed from right list into an input field
ot.saveRemovedRightOptions("removedRight");
// Store list of options added to left list into an input field
ot.saveAddedLeftOptions("addedLeft");
// Store list of options radded to right list into an input field
ot.saveAddedRightOptions("addedRight");
// Store all options existing in the left list into an input field
ot.saveNewLeftOptions("newLeft");
// Store all options existing in the right list into an input field
ot.saveNewRightOptions("newRight");

// IMPORTANT: This step is required for the OptionTransfer object to work
// correctly.
// Add a call to the BODY onLoad="" tag of the page, and pass a reference to
// the form which contains the select boxes and input fields.
BODY onLoad="ot.init(document.forms[0])"

// ADDING ACTIONS INTO YOUR PAGE
// Finally, add calls to the object to move options back and forth, either
// from links in your page or from double-clicking the options themselves.
// See example page, and use the following methods:
ot.transferRight();
ot.transferAllRight();
ot.transferLeft();
ot.transferAllLeft();


NOTES:
1) Requires the functions in selectbox.js

*/ 
function OT_transferLeft() { moveSelectedOptions(this.right,this.left,this.autoSort,this.staticOptionRegex); this.update(); return false;}
function OT_transferRight() { moveSelectedOptions(this.left,this.right,this.autoSort,this.staticOptionRegex); this.update(); return false;}
function OT_transferAllLeft() { moveAllOptions(this.right,this.left,this.autoSort,this.staticOptionRegex); this.update(); return false;}
function OT_transferAllRight() { moveAllOptions(this.left,this.right,this.autoSort,this.staticOptionRegex); this.update(); return false;}
function OT_saveRemovedLeftOptions(f) { this.removedLeftField = f; }
function OT_saveRemovedRightOptions(f) { this.removedRightField = f; }
function OT_saveAddedLeftOptions(f) { this.addedLeftField = f; }
function OT_saveAddedRightOptions(f) { this.addedRightField = f; }
function OT_saveNewLeftOptions(f) { this.newLeftField = f; }
function OT_saveNewRightOptions(f) { this.newRightField = f; }
function OT_update() {
	var removedLeft = new Object();
	var removedRight = new Object();
	var addedLeft = new Object();
	var addedRight = new Object();
	var newLeft = new Object();
	var newRight = new Object();
	for (var i=0;i<this.left.options.length;i++) {
		var o=this.left.options[i];
		newLeft[o.value]=1;
		if (typeof(this.originalLeftValues[o.value])=="undefined") {
			addedLeft[o.value]=1;
			removedRight[o.value]=1;
			}
		}
	for (var i=0;i<this.right.options.length;i++) {
		var o=this.right.options[i];
		newRight[o.value]=1;
		if (typeof(this.originalRightValues[o.value])=="undefined") {
			addedRight[o.value]=1;
			removedLeft[o.value]=1;
			}
		}
	if (this.removedLeftField!=null) { this.removedLeftField.value = OT_join(removedLeft,this.delimiter); }
	if (this.removedRightField!=null) { this.removedRightField.value = OT_join(removedRight,this.delimiter); }
	if (this.addedLeftField!=null) { this.addedLeftField.value = OT_join(addedLeft,this.delimiter); }
	if (this.addedRightField!=null) { this.addedRightField.value = OT_join(addedRight,this.delimiter); }
	if (this.newLeftField!=null) { this.newLeftField.value = OT_join(newLeft,this.delimiter); }
	if (this.newRightField!=null) { this.newRightField.value = OT_join(newRight,this.delimiter); }
	}
function OT_join(o,delimiter) {
	var val; var str="";
	for(val in o){
		if (str.length>0) { str=str+delimiter; }
		str=str+val;
		}
	return str;
	}
function OT_setDelimiter(val) { this.delimiter=val; }
function OT_setAutoSort(val) { this.autoSort=val; }
function OT_setStaticOptionRegex(val) { this.staticOptionRegex=val; }
function OT_init(theform) {
	this.form = theform;
	if(!theform[this.left]){alert("OptionTransfer init(): Left select list does not exist in form!");return false;}
	if(!theform[this.right]){alert("OptionTransfer init(): Right select list does not exist in form!");return false;}
	this.left=theform[this.left];
	this.right=theform[this.right];
	for(var i=0;i<this.left.options.length;i++) {
		this.originalLeftValues[this.left.options[i].value]=1;
		}
	for(var i=0;i<this.right.options.length;i++) {
		this.originalRightValues[this.right.options[i].value]=1;
		}
	if(this.removedLeftField!=null) { this.removedLeftField=theform[this.removedLeftField]; }
	if(this.removedRightField!=null) { this.removedRightField=theform[this.removedRightField]; }
	if(this.addedLeftField!=null) { this.addedLeftField=theform[this.addedLeftField]; }
	if(this.addedRightField!=null) { this.addedRightField=theform[this.addedRightField]; }
	if(this.newLeftField!=null) { this.newLeftField=theform[this.newLeftField]; }
	if(this.newRightField!=null) { this.newRightField=theform[this.newRightField]; }
	this.update();
	}
// -------------------------------------------------------------------
// OptionTransfer()
//  This is the object interface.
// -------------------------------------------------------------------
function OptionTransfer(l,r) {
	this.form = null;
	this.left=l;
	this.right=r;
	this.autoSort=true;
	this.delimiter=",";
	this.staticOptionRegex = "";
	this.originalLeftValues = new Object();
	this.originalRightValues = new Object();
	this.removedLeftField = null;
	this.removedRightField = null;
	this.addedLeftField = null;
	this.addedRightField = null;
	this.newLeftField = null;
	this.newRightField = null;
	this.transferLeft=OT_transferLeft;
	this.transferRight=OT_transferRight;
	this.transferAllLeft=OT_transferAllLeft;
	this.transferAllRight=OT_transferAllRight;
	this.saveRemovedLeftOptions=OT_saveRemovedLeftOptions;
	this.saveRemovedRightOptions=OT_saveRemovedRightOptions;
	this.saveAddedLeftOptions=OT_saveAddedLeftOptions;
	this.saveAddedRightOptions=OT_saveAddedRightOptions;
	this.saveNewLeftOptions=OT_saveNewLeftOptions;
	this.saveNewRightOptions=OT_saveNewRightOptions;
	this.setDelimiter=OT_setDelimiter;
	this.setAutoSort=OT_setAutoSort;
	this.setStaticOptionRegex=OT_setStaticOptionRegex;
	this.init=OT_init;
	this.update=OT_update;
	}
	
	
	
	
	//Activity price slider
	function sliderHandle(h1, h2, info, sliderType)
	{
        var lowerBound = $get(h1).value;
        var upperBound = $get(h2).value;
        filter(sliderType, lowerBound, upperBound, info);
    }
    function filter(type, lowerBound, upperBound, info) 
    {
    }
        

function redirectWWW()
{   
    document.location.href = "../Common/MyTrips.aspx";    
}


//GOOGLE MAP POPUP SCRIPT STARTS

var BookmarkBox;
var PopUpLat;
var PopUpLang;
var hotelName,hotelAddress;
var docheight,docwidth,scroll_top,scroll_left,ie,standardbody

function ShowCartMapPopUp(lat,lang,name,chain,address,distance,image,description,rating,starts)
{   
    if (BookmarkBox == null )
    {
        BookmarkBox=createWindow();
        document.body.appendChild(BookmarkBox);
    }            
    setSize(BookmarkBox,498,370);
	centerMap(BookmarkBox)	;
	BookmarkBox.innerHTML=getBookmarkText(name,address);		
    GLoadMap(lat,lang,name,chain,address,distance,image,description,rating,starts);
}

function getBookmarkText(name,address)
{	
	var mapText ="<div><div id='map1' class='MapClass' ></div></div>";	
	var tempText="<div class='leftTopCornerI'></div><div class='topStripIGPop'></div><div class='rightTopCornerI'></div><div class='centerStripIGPop'>";	
	tempText= tempText+ "<div style='float:left; width:450px'><div style='font: bold 16px arial; padding-top:5px; padding-left:5px;'>"+name+ "</div><div style='font: bold 12px arial; padding-left:5px;'>"+address+"</div></div>";
	tempText= tempText + "<div style='padding-top:5px; '><a href='javascript:void(0);' style='font: bold 12px arial; color:red'  onClick=closeMap('BookmarkBox');><img alt='' src='../App_Themes/DefaultV4/images/buttons/Close_Button.png'/></a></div><div class='clear'></div>"	;
	tempText= tempText + mapText;	
	tempText= tempText+"</div><div class='clear'></div><div class='leftBottomCornerI' style='margin-top: -2px;'></div>";
    tempText= tempText+"<div class='bottomStripIGMap' style='margin-top: -2px;'></div><div class='rightBottomCornerI' style='margin-top: -2px;'></div>";		
	return tempText;
}
function GLoadMap(lat,lang,name,chain,address,distance,image,description,rating,starts)
{       
    if (GBrowserIsCompatible()) 
	{	    		
		gmap1 = new GMap2(document.getElementById("map1"));		
		gmap1.setCenter(new GLatLng(lat,lang), 13);				
		gmap1.addControl(new GMapTypeControl());				
	    gmap1.addControl(new GLargeMapControl());												
	} 
	else 
	{
		var map = document.getElementById("map1");
		map.innerHTML = "You cannot use this browser.<br />";
	}    
    var point = new GLatLng(lat,lang);                                                        
    gmap1.addOverlay(createMarker(point,name,chain,address,distance,image,description,rating,starts));	        
}
function setSize(wnObj, w, h)
{ 
	wnObj.style.width=parseInt(w) + "px";
	wnObj.style.height=parseInt(h) + "px";
}
function centerMap(wnObj)
{	    
	getWindowData();
	wnObj.style.left=scroll_left+(docwidth-wnObj.offsetWidth)/2+"px" ;
	wnObj.style.top=scroll_top+(docheight-wnObj.offsetHeight)/2+"px" ;
}

function closeMap(obj) 
{        
    BookmarkBox =null;
    var sucbox=document.getElementById(obj);
    if (sucbox) 
    {
        document.body.removeChild(sucbox);
        suchbox=null;
    }
}

function createWindow()
{
	var domwindow=document.createElement("div") ;
	domwindow.id="BookmarkBox";
	domwindow.className="DivGPopUpMain";
    return domwindow;
}

function getWindowData()
{ 
	var ie=document.all && !window.opera
	var domclientWidth=document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 //Preliminary doc width in non IE browsers
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	scroll_top=(ie)? standardbody.scrollTop : window.pageYOffset
	scroll_left=(ie)? standardbody.scrollLeft : window.pageXOffset
	docwidth=(ie)? standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
	docheight=(ie)? standardbody.clientHeight: window.innerHeight
}

function howFarX(destinationObj) 
{
    return parseInt(scroll_left+(docwidth-destinationObj.offsetWidth)/2)
}

function howFarY(destinationObj) 
{
    getWindowData()
    return parseInt((docheight-destinationObj.offsetHeight)/2)
}



//GOOGLE MAP POPUP SCRIPT ENDS

//INDIVIDUAL MAP ON RRoomResults.aspx STARTS
var thumbNailUrl = "http://graphics.rovia.com/Images/HotelThumbnailsV3/";
var baseIcon;


function  ShowSelectedMap(lat,lang,name,chain,address,distance,image,description,rating,starts)
{     
    if (GBrowserIsCompatible()) 
	{	   	    
		gmap3 = new GMap2(document.getElementById("map2"));		
		gmap3.setCenter(new GLatLng(lat ,lang), 9);				
		gmap3.addControl(new GMapTypeControl());						
		gmap3.addControl(new GLargeMapControl());
	} 
	else 
	{
		var map = document.getElementById("gmap1");
		if(map != null)
		    map.innerHTML = "You cannot use this browser.<br />";
	}    
    var point = new GLatLng(lat ,lang);                                                    
    var marker = new GMarker(point);
    gmap3.addOverlay(createMarker(point,name,chain,address,distance,image,description,rating,starts));	
    hideDiv('divMap');
}

function createMarker(point,name,chain,address,distance,image,description,rating,starts) 
{   
    var marker = new GMarker(point);
    var distanceTxt="";
    if (distance != null && distance.Length > 0)
        distanceTxt = distance + " miles";                   
    var hotelImg = clearImage;
    if(image != null && image != "")
    {
        hotelImg = thumbNailUrl + image;
    }                            
    var HotelInfo=
	'<div style="width: 200px; height: 100px; font-family: Futura, Helvetica, Arial, Sans-Serif; ">'+
	'<div style="margin-bottom: 2px; color: Blue; width: 200px; font-size: 13px;">'+
         '<a target="_blank" style="font-weight:bold"  >'+ name +'</a>'+
    '</div>'+
    '<div style="float: left; width: 120px; ">' +            
        '<div style="font-size: 12px; width: 120px;">'+ chain +
        '</div>'+
        '<div style=" font-size: 11px; width: 120px;">'+
            '<div style="width: 120px; font-weight :bold ; color :Black  ">'+
                address+
            '</div>'+
            '<div style="margin-top: 2px; width: 120px;">'+
                '<b>'+ distanceTxt +'</b>'+
            '</div>'+
       '</div>'+
    '</div>'+
    '<div style="float: left; width: 70px; height:80px; margin-left: 4px;">'+
        '<img alt=\"\" src="'+hotelImg+'" style="width: 70px; height:80px " />'+
    '</div>'+
    '</div>';	
    var op = new Sys.StringBuilder();
    var description1="";
    if (description.length > 100)
        description1 = description.substring(0, 100) + "...";                        
    else 
        description1 = description;
    description1.replace("-","'");
    description1.replace("|",",");
    op.append('<div style="font-family: Futura, Helvetica, Arial, Sans-Serif;  width:200px;height: 100px; "> ');    
    op.append("<div>"+  description1 + "</div>");    
    op.append('<div><div style ="float:left" >Star rating : </div>');    
    op.append('<div ><img alt=\"\" src="../App_Themes/DefaultV4/images/icons/mini/star_'+ rating +'.gif" style="padding-top:1px" /></div></div>');
    op.append('<div style =" margin-top :3px; font-size :12px;"> <b>Starts from $'+ starts+'</b> </div> <div style =" margin-top :5px;margin-left :60px;">');
    op.append('</div></div>');    
    //op.append(String.format("<a onclick='Redirect({1},-1);'><input type='image' src='../App_Themes/DefaultV4/images/buttons/SHOW_ROOMS.gif' style='border-width:0px;' /></a></div></div>",sid,allHotelResults[cnt].RP));    
    var Price =op.toString();      
    var infoTabs = [new GInfoWindowTab("Hotel Info", HotelInfo),new GInfoWindowTab("Price", Price)];
    GEvent.addListener(marker, "click", function() 
    {
        marker.openInfoWindowTabsHtml(infoTabs);
    });
    return marker;
}


//INDIVIDUAL MAP ON RRoomResults.aspx ENDS




/****Tab script start**************************************************************************************************/


function ShowRoomList()
{
    hideDiv('divFilm');
    hideDiv('divMap');    
    showDiv('ListView'); 
    showDiv('hoteldetails');
    hideDiv('divVideo');        
}
function ShowFilm()
{
    showDiv('divFilm');
    hideDiv('divMap');
    hideDiv('ListView');
    hideDiv('hoteldetails');
    hideDiv('divVideo');            
}
function ShowMap()
{
    hideDiv('divFilm');
    showDiv('divMap');
    hideDiv('ListView'); 
    hideDiv('hoteldetails');
    hideDiv('divVideo');        
}
function ShowVideo()
{
    
    hideDiv('divFilm');
    showDiv('divVideo');
    hideDiv('ListView'); 
    hideDiv('hoteldetails');
    hideDiv('divMap');          
    
    var builder = new Sys.StringBuilder();
    var popUpUrl = ''; 
    if ( linkType == "T" )
    {
        popUpUrl = baseUrl + "?did=" + did + "&brochureid=" + brochureId +"&mtype=" + mapType  + "&type=vr";         
    }
    else if ( linkType == "V" )
    {
        popUpUrl = baseUrl + "?did=" + did + "&brochureid=" + brochureId +"&mtype=" + mapType + "&type=video" ;         
    }    
    else if ( linkType == "P" )
    {
        popUpUrl = baseUrl + "?did=" + did + "&brochureid=" + brochureId +"&mtype=" + mapType  + "&type=pic";         
    }               
    else 
    {
        popUpUrl = baseUrl + "?did=" + did + "&brochureid=" + brochureId +"&mtype=" + mapType ;         
    }               
    
    var iframe = $get("frameVideo");
    if ( iframe != null )
    {
        iframe.src = popUpUrl;
    }         
}



function HotelListViewSelect()
{
    ShowRoomList();    
    var divHotelListTabTLEle = $get("divHotelListTabTL");
    if ( divHotelListTabTLEle != null)
    {
        divHotelListTabTLEle.className="emptyTabTL";
    }
    var divHotelListTabSEle = $get("divHotelListTabS");
    if (divHotelListTabSEle != null)
    {
        divHotelListTabSEle.className="emptyTabS";
    }
    var divHotelListTabTREle = $get("divHotelListTabTR");
    if ( divHotelListTabTREle != null)
    {
        divHotelListTabTREle.className="emptyTabTR";
    }
    
    var divHotelMatrixTabTLEle = $get("divHotelMatrixTabTL");
    if ( divHotelMatrixTabTLEle != null)
    {
        divHotelMatrixTabTLEle.className="leftTopCornerQ";
    }
    var divHotelMatrixTabSEle = $get("divHotelMatrixTabS");
    if ( divHotelMatrixTabSEle != null )
    {
        divHotelMatrixTabSEle.className="topStripTab";
    }
    var divHotelMatrixTabTREle = $get("divHotelMatrixTabTR");
    if ( divHotelMatrixTabTREle != null )
    {
        divHotelMatrixTabTREle.className="rightTopCornerQ";
    }
    
    var divHotelMapTabTLEle = $get("divHotelMapTabTL");
    if ( divHotelMapTabTLEle != null )
    {
        divHotelMapTabTLEle.className="leftTopCornerQ";
    }
    var divHotelMapTabSEle = $get("divHotelMapTabS");
    if ( divHotelMapTabSEle != null )
    {
        divHotelMapTabSEle.className="topStripTab";
    }
    var divHotelMapTabTREle = $get("divHotelMapTabTR");
    if ( divHotelMapTabTREle != null )
    {
        divHotelMapTabTREle.className="rightTopCornerQ";
    }    
    
    var divHotelVideoTabTLEle = $get("divHotelVideoTabTL");
    if ( divHotelVideoTabTLEle  != null )
    {
        divHotelVideoTabTLEle.className="leftTopCornerQ";
    }
    var divHotelVideoTabSEle = $get("divHotelVideoTabS");
    if ( divHotelVideoTabSEle != null )
    {
        divHotelVideoTabSEle.className="topStripTab";
    }    
    var divHotelVideoTabTREle = $get("divHotelVideoTabTR");
    if (  divHotelVideoTabTREle != null )
    {
        divHotelVideoTabTREle.className="rightTopCornerQ";
    }
    
    OnTabSelectHideArrow(0);
    
    
    var divHotelListTabBorderEle = $get("divHotelListTabBorder");
    if (  divHotelListTabBorderEle  != null )
    {
        divHotelListTabBorderEle.className="ActiveTabBorder";
    }
    var divHotelMatrixTabBorderEle = $get("divHotelMatrixTabBorder");
    if (  divHotelMatrixTabBorderEle  != null  ) 
    {
        divHotelMatrixTabBorderEle.className="InActiveTabBorder";
    }
    var divHotelMapTabBorderEle = $get("divHotelMapTabBorder");
    if (  divHotelMapTabBorderEle != null )
    {  
        divHotelMapTabBorderEle.className="InActiveTabBorder";
    }
    var divHotelVideoTabBorderEle = $get("divHotelVideoTabBorder");
    if (  divHotelVideoTabBorderEle != null )
    {  
        divHotelVideoTabBorderEle.className="InActiveTabBorder";
    }          
        
    hideDiv('divHotelMatrix');
}



function HotelMatrixViewSelect()
{
    ShowFilm();
    var divHotelListTabTLEle = $get("divHotelListTabTL");
    if ( divHotelListTabTLEle != null)
    {
        divHotelListTabTLEle.className="leftTopCornerQ";
    }    
    var divHotelListTabSEle = $get("divHotelListTabS");    
    if (divHotelListTabSEle != null)
    {
        divHotelListTabSEle.className="topStripTab";
    }    
    var divHotelListTabTREle = $get("divHotelListTabTR");
    if ( divHotelListTabTREle != null)
    {
        divHotelListTabTREle.className="rightTopCornerQ";
    }
    
    var divHotelMatrixTabTLEle = $get("divHotelMatrixTabTL");
    if ( divHotelMatrixTabTLEle != null)
    {
        divHotelMatrixTabTLEle.className="emptyTabTL";
    }    
    var divHotelMatrixTabSEle = $get("divHotelMatrixTabS");
    if ( divHotelMatrixTabSEle != null )
    {
        divHotelMatrixTabSEle.className="emptyTabS";
    }        
    var divHotelMatrixTabTREle = $get("divHotelMatrixTabTR");
    if ( divHotelMatrixTabTREle  != null )
    {
        divHotelMatrixTabTREle.className="emptyTabTR";
    }
    
        
    var divHotelMapTabTLEle = $get("divHotelMapTabTL");
    if ( divHotelMapTabTLEle  != null )
    {
        divHotelMapTabTLEle.className="leftTopCornerQ";
    }
    var divHotelMapTabSEle = $get("divHotelMapTabS");
    if ( divHotelMapTabSEle != null )
    {
        divHotelMapTabSEle.className="topStripTab";
    }    
    var divHotelMapTabTREle = $get("divHotelMapTabTR");
    if (  divHotelMapTabTREle != null )
    {
        divHotelMapTabTREle.className="rightTopCornerQ";
    }
    
    
    var divHotelVideoTabTLEle = $get("divHotelVideoTabTL");
    if ( divHotelVideoTabTLEle  != null )
    {
        divHotelVideoTabTLEle.className="leftTopCornerQ";
    }
    var divHotelVideoTabSEle = $get("divHotelVideoTabS");
    if ( divHotelVideoTabSEle != null )
    {
        divHotelVideoTabSEle.className="topStripTab";
    }    
    var divHotelVideoTabTREle = $get("divHotelVideoTabTR");
    if (  divHotelVideoTabTREle != null )
    {
        divHotelVideoTabTREle.className="rightTopCornerQ";
    }
    
    OnTabSelectHideArrow(1);    
    
    var divHotelListTabBorderEle = $get("divHotelListTabBorder");       
    if (  divHotelListTabBorderEle  != null )
    {
        divHotelListTabBorderEle.className="InActiveTabBorder";
    }
    var divHotelMatrixTabBorderEle = $get("divHotelMatrixTabBorder");
    if (  divHotelMatrixTabBorderEle  != null  ) 
    {
        divHotelMatrixTabBorderEle.className="ActiveTabBorder";
    }
    var divHotelMapTabBorderEle = $get("divHotelMapTabBorder");
    if (  divHotelMapTabBorderEle != null )
    {   
        divHotelMapTabBorderEle.className="InActiveTabBorder";
    }
    var divHotelVideoTabBorderEle = $get("divHotelVideoTabBorder");
    if (  divHotelVideoTabBorderEle != null )
    {  
        divHotelVideoTabBorderEle.className="InActiveTabBorder";
    }
    
    showDiv('divHotelMatrix');
}
function HotelMapViewSelect()
{
    ShowMap();
    var divHotelListTabTLEle = $get("divHotelListTabTL");
    if ( divHotelListTabTLEle != null)
    {
        divHotelListTabTLEle.className="leftTopCornerQ";
    }
    var divHotelListTabSEle = $get("divHotelListTabS");
    if (divHotelListTabSEle != null)
    {
        divHotelListTabSEle.className="topStripTab";
    }
    var divHotelListTabTREle = $get("divHotelListTabTR");
    if ( divHotelListTabTREle != null)
    {
        divHotelListTabTREle.className="rightTopCornerQ";
    }
    
    
    var divHotelMatrixTabTLEle = $get("divHotelMatrixTabTL");
    if ( divHotelMatrixTabTLEle != null)
    {
        divHotelMatrixTabTLEle.className="leftTopCornerQ";
    }
    var divHotelMatrixTabSEle = $get("divHotelMatrixTabS");
    if ( divHotelMatrixTabSEle != null )
    {
        divHotelMatrixTabSEle.className="topStripTab";
    }
    var divHotelMatrixTabTREle = $get("divHotelMatrixTabTR");
    if ( divHotelMatrixTabTREle  != null )
    {
        divHotelMatrixTabTREle.className="rightTopCornerQ";
    }
    
    
    var divHotelMapTabTLEle = $get("divHotelMapTabTL");
    if ( divHotelMapTabTLEle  != null )
    {
        divHotelMapTabTLEle.className="emptyTabTL";
    }
    var divHotelMapTabSEle = $get("divHotelMapTabS");
    if ( divHotelMapTabSEle  != null )
    {
        divHotelMapTabSEle.className="emptyTabS";
    }
    var divHotelMapTabTREle = $get("divHotelMapTabTR");
    if ( divHotelMapTabTREle  != null )
    {
        divHotelMapTabTREle.className="emptyTabTR";
    }
    
    var divHotelVideoTabTLEle = $get("divHotelVideoTabTL");
    if ( divHotelVideoTabTLEle  != null )
    {
        divHotelVideoTabTLEle.className="leftTopCornerQ";
    }
    var divHotelVideoTabSEle = $get("divHotelVideoTabS");
    if ( divHotelVideoTabSEle != null )
    {
        divHotelVideoTabSEle.className="topStripTab";
    }    
    var divHotelVideoTabTREle = $get("divHotelVideoTabTR");
    if (  divHotelVideoTabTREle != null )
    {
        divHotelVideoTabTREle.className="rightTopCornerQ";
    }
    
    
    OnTabSelectHideArrow(2);
    
    
    var divHotelListTabBorderEle = $get("divHotelListTabBorder");
    if ( divHotelListTabBorderEle  != null )
    {
        divHotelListTabBorderEle.className="InActiveTabBorder";
    }
    var divHotelMatrixTabBorderEle = $get("divHotelMatrixTabBorder");
    if ( divHotelMatrixTabBorderEle  != null )
    {
        divHotelMatrixTabBorderEle.className="InActiveTabBorder";
    }
    var divHotelMapTabBorderEle = $get("divHotelMapTabBorder");
    if ( divHotelMapTabBorderEle  != null )
    {
        divHotelMapTabBorderEle.className="ActiveTabBorder";
    }
    var divHotelVideoTabBorderEle = $get("divHotelVideoTabBorder");
    if (  divHotelVideoTabBorderEle != null )
    {  
        divHotelVideoTabBorderEle.className="InActiveTabBorder";
    }
    
}


function HotelVideoViewSelect()
{   
    ShowVideo(); 
    var divHotelListTabTLEle = $get("divHotelListTabTL");
    if ( divHotelListTabTLEle != null)
    {
        divHotelListTabTLEle.className="leftTopCornerQ";
    }
    var divHotelListTabSEle = $get("divHotelListTabS");
    if ( divHotelListTabSEle != null)
    {
        divHotelListTabSEle.className="topStripTab";
    }
    var divHotelListTabTREle = $get("divHotelListTabTR");
    if ( divHotelListTabTREle != null)
    {
        divHotelListTabTREle.className="rightTopCornerQ";
    }
    
    
    var divHotelMatrixTabTLEle = $get("divHotelMatrixTabTL");
    if ( divHotelMatrixTabTLEle != null)
    {
        divHotelMatrixTabTLEle.className="leftTopCornerQ";        
    }     
    var divHotelMatrixTabSEle = $get("divHotelMatrixTabS");
    if ( divHotelMatrixTabSEle != null)
    {
        divHotelMatrixTabSEle.className="topStripTab";
    }
    var divHotelMatrixTabTREle = $get("divHotelMatrixTabTR");
    if ( divHotelMatrixTabTREle != null)
    {
        divHotelMatrixTabTREle.className="rightTopCornerQ";
    }
    
    
     var divHotelMapTabTLEle = $get("divHotelMapTabTL");
    if ( divHotelMapTabTLEle  != null )
    {
        divHotelMapTabTLEle.className="leftTopCornerQ";
    }
    var divHotelMapTabSEle = $get("divHotelMapTabS");
    if ( divHotelMapTabSEle != null )
    {
        divHotelMapTabSEle.className="topStripTab";
    }    
    var divHotelMapTabTREle = $get("divHotelMapTabTR");
    if (  divHotelMapTabTREle != null )
    {
        divHotelMapTabTREle.className="rightTopCornerQ";
    }
    
        
    var divHotelVideoTabTLEle = $get("divHotelVideoTabTL");
    if ( divHotelVideoTabTLEle  != null )
    {
        divHotelVideoTabTLEle.className="emptyTabTL";
    }
    var divHotelVideoTabSEle = $get("divHotelVideoTabS");
    if ( divHotelVideoTabSEle != null )
    {
        divHotelVideoTabSEle.className="emptyTabS";
    }    
    var divHotelVideoTabTREle = $get("divHotelVideoTabTR");
    if (  divHotelVideoTabTREle != null )
    {
        divHotelVideoTabTREle.className="emptyTabTR";
    }
    
    OnTabSelectHideArrow(3);
    
    var divHotelListTabBorderEle = $get("divHotelListTabBorder");
    if ( divHotelListTabBorderEle != null)
    {
        divHotelListTabBorderEle.className="InActiveTabBorder";
    }
    var divHotelMatrixTabBorderEle = $get("divHotelMatrixTabBorder");
    if ( divHotelMatrixTabBorderEle != null)
    {
        divHotelMatrixTabBorderEle.className="InActiveTabBorder";
    }
    var divHotelMapTabBorderEle = $get("divHotelMapTabBorder");
    if ( divHotelMapTabBorderEle != null)
    {
        divHotelMapTabBorderEle.className="InActiveTabBorder";    
    }
    var divHotelVideoTabBorderEle = $get("divHotelVideoTabBorder");
    if ( divHotelVideoTabBorderEle  != null )
    {
        divHotelVideoTabBorderEle.className="ActiveTabBorder";
    }        
}

//function HotelListViewSelect()
//{   
//    ShowRoomList();    
//    var divHotelListTabTLEle = $get("divHotelListTabTL");
//    divHotelListTabTLEle.className="emptyTabTL";
//    var divHotelListTabSEle = $get("divHotelListTabS");
//    divHotelListTabSEle.className="emptyTabS";
//    var divHotelListTabTREle = $get("divHotelListTabTR");
//    divHotelListTabTREle.className="emptyTabTR";
//    
//    var divHotelMatrixTabTLEle = $get("divHotelMatrixTabTL");
//    divHotelMatrixTabTLEle.className="leftTopCornerQ";
//    var divHotelMatrixTabSEle = $get("divHotelMatrixTabS");
//    divHotelMatrixTabSEle.className="topStripTab";
//    var divHotelMatrixTabTREle = $get("divHotelMatrixTabTR");
//    divHotelMatrixTabTREle.className="rightTopCornerQ";
//    
//    var divHotelMapTabTLEle = $get("divHotelMapTabTL");
//    divHotelMapTabTLEle.className="leftTopCornerQ";
//    var divHotelMapTabSEle = $get("divHotelMapTabS");
//    divHotelMapTabSEle.className="topStripTab";
//    var divHotelMapTabTREle = $get("divHotelMapTabTR");
//    divHotelMapTabTREle.className="rightTopCornerQ";
//    
//    
//    OnTabSelectHideArrow(0);
//    
//    
//    var divHotelListTabBorderEle = $get("divHotelListTabBorder");
//    divHotelListTabBorderEle.className="ActiveTabBorder";
//    var divHotelMatrixTabBorderEle = $get("divHotelMatrixTabBorder");
//    divHotelMatrixTabBorderEle.className="InActiveTabBorder";
//    var divHotelMapTabBorderEle = $get("divHotelMapTabBorder");
//    divHotelMapTabBorderEle.className="InActiveTabBorder";
//    hideDiv('divHotelMatrix');
//    
//}

//function HotelMatrixViewSelect()
//{
//    ShowFilm();
//    var divHotelListTabTLEle = $get("divHotelListTabTL");
//    divHotelListTabTLEle.className="leftTopCornerQ";
//    var divHotelListTabSEle = $get("divHotelListTabS");
//    divHotelListTabSEle.className="topStripTab";
//    var divHotelListTabTREle = $get("divHotelListTabTR");
//    divHotelListTabTREle.className="rightTopCornerQ";
//    
//    var divHotelMatrixTabTLEle = $get("divHotelMatrixTabTL");
//    divHotelMatrixTabTLEle.className="emptyTabTL";
//    var divHotelMatrixTabSEle = $get("divHotelMatrixTabS");
//    divHotelMatrixTabSEle.className="emptyTabS";
//    var divHotelMatrixTabTREle = $get("divHotelMatrixTabTR");
//    divHotelMatrixTabTREle.className="emptyTabTR";
//    
//    var divHotelMapTabTLEle = $get("divHotelMapTabTL");
//    divHotelMapTabTLEle.className="leftTopCornerQ";
//    var divHotelMapTabSEle = $get("divHotelMapTabS");
//    divHotelMapTabSEle.className="topStripTab";
//    var divHotelMapTabTREle = $get("divHotelMapTabTR");
//    divHotelMapTabTREle.className="rightTopCornerQ";
//    
//    OnTabSelectHideArrow(1);
//    
//    var divHotelListTabBorderEle = $get("divHotelListTabBorder");
//    divHotelListTabBorderEle.className="InActiveTabBorder";
//    var divHotelMatrixTabBorderEle = $get("divHotelMatrixTabBorder");
//    divHotelMatrixTabBorderEle.className="ActiveTabBorder";
//    var divHotelMapTabBorderEle = $get("divHotelMapTabBorder");
//    divHotelMapTabBorderEle.className="InActiveTabBorder";
//    
//    showDiv('divHotelMatrix');
//    
//    
//}
//function HotelMapViewSelect()
//{
//    ShowMap();
//    var divHotelListTabTLEle = $get("divHotelListTabTL");
//    divHotelListTabTLEle.className="leftTopCornerQ";
//    var divHotelListTabSEle = $get("divHotelListTabS");
//    divHotelListTabSEle.className="topStripTab";
//    var divHotelListTabTREle = $get("divHotelListTabTR");
//    divHotelListTabTREle.className="rightTopCornerQ";
//    
//    var divHotelMatrixTabTLEle = $get("divHotelMatrixTabTL");
//    divHotelMatrixTabTLEle.className="leftTopCornerQ";
//    var divHotelMatrixTabSEle = $get("divHotelMatrixTabS");
//    divHotelMatrixTabSEle.className="topStripTab";
//    var divHotelMatrixTabTREle = $get("divHotelMatrixTabTR");
//    divHotelMatrixTabTREle.className="rightTopCornerQ";
//    
//    var divHotelMapTabTLEle = $get("divHotelMapTabTL");
//    divHotelMapTabTLEle.className="emptyTabTL";
//    var divHotelMapTabSEle = $get("divHotelMapTabS");
//    divHotelMapTabSEle.className="emptyTabS";
//    var divHotelMapTabTREle = $get("divHotelMapTabTR");
//    divHotelMapTabTREle.className="emptyTabTR";
//    
//    OnTabSelectHideArrow(2);
//    
//    var divHotelListTabBorderEle = $get("divHotelListTabBorder");
//    divHotelListTabBorderEle.className="InActiveTabBorder";
//    var divHotelMatrixTabBorderEle = $get("divHotelMatrixTabBorder");
//    divHotelMatrixTabBorderEle.className="InActiveTabBorder";
//    var divHotelMapTabBorderEle = $get("divHotelMapTabBorder");
//    divHotelMapTabBorderEle.className="ActiveTabBorder";    
//    
//}


function OnTabSelectHideArrow(index)
{

    var imgSrt0=document.getElementById("imgHotelListTabArrow");
    var imgSrt1=document.getElementById("imgHotelMatrixTabArrow");
    var imgSrt2=document.getElementById("imgHotelMapTabArrow");
    var imgSrt3=document.getElementById("imgHotelVideoTabArrow");       
   
        if(index==0)
        {
	            
                if(imgSrt0!=null)
                {
                     imgSrt0.style.visibility="hidden";
                     imgSrt0.style.display="none";
                } 
                if(imgSrt1!=null)
                {
                     imgSrt1.style.visibility="";
                     imgSrt1.style.display="";
                }
                if(imgSrt2!=null)
                {
                     imgSrt2.style.visibility="";
                     imgSrt2.style.display="";
                }
                if(imgSrt3!=null)
                {
                     imgSrt3.style.visibility="";
                     imgSrt3.style.display="";
                }
	            
        }
        else if(index==1)
        {    
                if(imgSrt0!=null)
                {
                     imgSrt0.style.visibility="";
                     imgSrt0.style.display="";
	                 
                }
                 if(imgSrt1!=null)
                {
                    imgSrt1.style.visibility="hidden";
                     imgSrt1.style.display="none";
                }
                 if(imgSrt2!=null)
                {
                     imgSrt2.style.visibility="";
                     imgSrt2.style.display="";
                }
                if(imgSrt3!=null)
                {
                     imgSrt3.style.visibility="";
                     imgSrt3.style.display="";
                }
        }
        else if(index==2)
        {    
                if(imgSrt0!=null)
                {
                     imgSrt0.style.visibility="";
                     imgSrt0.style.display="";
	                 
                }
                 if(imgSrt1!=null)
                {
                    imgSrt1.style.visibility="";
                     imgSrt1.style.display="";
                }
                 if(imgSrt2!=null)
                {
                     imgSrt2.style.visibility="hidden";
                     imgSrt2.style.display="none";
                }
                if(imgSrt3!=null)
                {
                     imgSrt3.style.visibility="";
                     imgSrt3.style.display="";
                }
       }
       else if(index==3)
        {    
                if(imgSrt0!=null)
                {
                     imgSrt0.style.visibility="";
                     imgSrt0.style.display="";
	                 
                }
                 if(imgSrt1!=null)
                {
                    imgSrt1.style.visibility="";
                     imgSrt1.style.display="";
                }
                 if(imgSrt2!=null)
                {
                     imgSrt2.style.visibility="";
                     imgSrt2.style.display="";
                }
                if(imgSrt3!=null)
                {
                     imgSrt3.style.visibility="hidden";
                     imgSrt3.style.display="none";
                }
       }

}

/****Tab script end**************************************************************************************************/
/*******************Activity view details link Tab Sript Starts************************/
function ActivityDetailsSelect(divDetails,divPricing,divAdditionalInformation,divPolicies)
{
    var divActivityDetailsTabTLEle = $get("divActivityDetailsTabTL");
    divActivityDetailsTabTLEle.className="emptyTabTL";
    var divActivityDetailsTabSEle = $get("divActivityDetailsTabS");
    divActivityDetailsTabSEle.className="emptyTabS";
    var divActivityDetailsTabTREle = $get("divActivityDetailsTabTR");
    divActivityDetailsTabTREle.className="emptyTabTR";
   
    
    var divActivityAdditionalInfoTabTLEle = $get("divActivityAdditionalInfoTabTL");
    divActivityAdditionalInfoTabTLEle.className="leftTopCornerQ";
    var divActivityAdditionalInfoTabSEle = $get("divActivityAdditionalInfoTabS");
    divActivityAdditionalInfoTabSEle.className="topStripTab";
    var divActivityAdditionalInfoTabTREle = $get("divActivityAdditionalInfoTabTR");
    divActivityAdditionalInfoTabTREle.className="rightTopCornerQ";
    
    var divActivityPoliciesTabTLEle = $get("divActivityPoliciesTabTL");
    divActivityPoliciesTabTLEle.className="leftTopCornerQ";
    var divActivityPoliciesTabSEle = $get("divActivityPoliciesTabS");
    divActivityPoliciesTabSEle.className="topStripTab";
    var divActivityPoliciesTabTREle = $get("divActivityPoliciesTabTR");
    divActivityPoliciesTabTREle.className="rightTopCornerQ";
    
 
 //   ShowDetails();
    OnActivityTabSelectHideArrow(0);
    showDiv(divDetails);
    hideDiv(divPricing);
    hideDiv(divAdditionalInformation);
    hideDiv(divPolicies);
    
    var divActivityDetailsTabBorderEle = $get("divActivityDetailsTabBorder");
    divActivityDetailsTabBorderEle.className="ActiveTabBorder";
    var divActivityAdditionalInfoTabBorderEle = $get("divActivityAdditionalInfoTabBorder");
    divActivityAdditionalInfoTabBorderEle.className="InActiveTabBorder";
    var divActivityPoliciesTabBorderEle = $get("divActivityPoliciesTabBorder");
    divActivityPoliciesTabBorderEle.className="InActiveTabBorder";
}

function ActivityAdditionalInfoSelect(divDetails,divPricing,divAdditionalInformation,divPolicies)
{   
    var divActivityDetailsTabTLEle = $get("divActivityDetailsTabTL");
    divActivityDetailsTabTLEle.className="leftTopCornerQ";
    var divActivityDetailsTabSEle = $get("divActivityDetailsTabS");
    divActivityDetailsTabSEle.className="topStripTab";
    var divActivityDetailsTabTREle = $get("divActivityDetailsTabTR");
    divActivityDetailsTabTREle.className="rightTopCornerQ";
    
  
    
    var divActivityAdditionalInfoTabTLEle = $get("divActivityAdditionalInfoTabTL");
    divActivityAdditionalInfoTabTLEle.className="emptyTabTL";
    var divActivityAdditionalInfoTabSEle = $get("divActivityAdditionalInfoTabS");
    divActivityAdditionalInfoTabSEle.className="emptyTabS";
    var divActivityAdditionalInfoTabTREle = $get("divActivityAdditionalInfoTabTR");
    divActivityAdditionalInfoTabTREle.className="emptyTabTR";
    
    var divActivityPoliciesTabTLEle = $get("divActivityPoliciesTabTL");
    divActivityPoliciesTabTLEle.className="leftTopCornerQ";
    var divActivityPoliciesTabSEle = $get("divActivityPoliciesTabS");
    divActivityPoliciesTabSEle.className="topStripTab";
    var divActivityPoliciesTabTREle = $get("divActivityPoliciesTabTR");
    divActivityPoliciesTabTREle.className="rightTopCornerQ";
    
    OnActivityTabSelectHideArrow(2);
     hideDiv(divDetails);
    hideDiv(divPricing);
    showDiv(divAdditionalInformation);
    hideDiv(divPolicies);

    
    var divActivityDetailsTabBorderEle = $get("divActivityDetailsTabBorder");
    divActivityDetailsTabBorderEle.className="InActiveTabBorder";
    var divActivityAdditionalInfoTabBorderEle = $get("divActivityAdditionalInfoTabBorder");
    divActivityAdditionalInfoTabBorderEle.className="ActiveTabBorder";
    var divActivityPoliciesTabBorderEle = $get("divActivityPoliciesTabBorder");
    divActivityPoliciesTabBorderEle.className="InActiveTabBorder";
   
    
}    
function ActivityPoliciesSelect(divDetails,divPricing,divAdditionalInformation,divPolicies)
{
    var divActivityDetailsTabTLEle = $get("divActivityDetailsTabTL");
    divActivityDetailsTabTLEle.className="leftTopCornerQ";
    var divActivityDetailsTabSEle = $get("divActivityDetailsTabS");
    divActivityDetailsTabSEle.className="topStripTab";
    var divActivityDetailsTabTREle = $get("divActivityDetailsTabTR");
    divActivityDetailsTabTREle.className="rightTopCornerQ";
  
    
    var divActivityAdditionalInfoTabTLEle = $get("divActivityAdditionalInfoTabTL");
    divActivityAdditionalInfoTabTLEle.className="leftTopCornerQ";
    var divActivityAdditionalInfoTabSEle = $get("divActivityAdditionalInfoTabS");
    divActivityAdditionalInfoTabSEle.className="topStripTab";
    var divActivityAdditionalInfoTabTREle = $get("divActivityAdditionalInfoTabTR");
    divActivityAdditionalInfoTabTREle.className="rightTopCornerQ";
    
    var divActivityPoliciesTabTLEle = $get("divActivityPoliciesTabTL");
    divActivityPoliciesTabTLEle.className="emptyTabTL";
    var divActivityPoliciesTabSEle = $get("divActivityPoliciesTabS");
    divActivityPoliciesTabSEle.className="emptyTabS";
    var divActivityPoliciesTabTREle = $get("divActivityPoliciesTabTR");
    divActivityPoliciesTabTREle.className="emptyTabTR";
    
    OnActivityTabSelectHideArrow(3);
    hideDiv(divDetails);
    hideDiv(divPricing);
    hideDiv(divAdditionalInformation);
    showDiv(divPolicies);

    
    var divActivityDetailsTabBorderEle = $get("divActivityDetailsTabBorder");
    divActivityDetailsTabBorderEle.className="InActiveTabBorder";
    var divActivityAdditionalInfoTabBorderEle = $get("divActivityAdditionalInfoTabBorder");
    divActivityAdditionalInfoTabBorderEle.className="InActiveTabBorder";
    var divActivityPoliciesTabBorderEle = $get("divActivityPoliciesTabBorder");
    divActivityPoliciesTabBorderEle.className="ActiveTabBorder";
}   

function OnActivityTabSelectHideArrow(index)
{
    var imgSrt0=document.getElementById("imgActivityDetailsTabArrow");
 
    var imgSrt2=document.getElementById("imgActivityAdditionalInfoTabArrow");
    var imgSrt3=document.getElementById("imgActivityPoliciesTabArrow");
    if(index==0)
    {    
            if(imgSrt0!=null)
            {
                 imgSrt0.style.visibility="hidden";
                 imgSrt0.style.display="none";
            } 
         
            if(imgSrt2!=null)
            {
                 imgSrt2.style.visibility="";
                 imgSrt2.style.display="";
            }
            if(imgSrt3!=null)
            {
                 imgSrt3.style.visibility="";
                 imgSrt3.style.display="";
            } 
    }
    else if(index==1)
    {    
            if(imgSrt0!=null)
            {
                 imgSrt0.style.visibility="";
                 imgSrt0.style.display="";
                 
            }
         
            if(imgSrt2!=null)
            {
                 imgSrt2.style.visibility="";
                 imgSrt2.style.display="";
            }
            if(imgSrt3!=null)
            {
                 imgSrt3.style.visibility="";
                 imgSrt3.style.display="";
            }          
    }
     else if(index==2)
    {    
            if(imgSrt0!=null)
            {
                 imgSrt0.style.visibility="";
                 imgSrt0.style.display="";
                 
            }
           
            if(imgSrt2!=null)
            {
                 imgSrt2.style.visibility="hidden";
                 imgSrt2.style.display="none";
            }
            if(imgSrt3!=null)
            {
                 imgSrt3.style.visibility="";
                 imgSrt3.style.display="";
            }          
    }
     else if(index==3)
    {    
            if(imgSrt0!=null)
            {
                 imgSrt0.style.visibility="";
                 imgSrt0.style.display="";
                 
            }
           
                        if(imgSrt2!=null)
            {
                 imgSrt2.style.visibility="";
                 imgSrt2.style.display="";
            }
            if(imgSrt3!=null)
            {
                 imgSrt3.style.visibility="hidden";
                 imgSrt3.style.display="none";
            }          
    }
}
/*******************Activity view details link Tab Sript Ends**************************/

// CAR ADD CART INDIVIDUAL MAP
function ShowCartMapPopUpCar(lat,lang ,cName,logo,carType,aC,model,address)
{    
    if (BookmarkBox == null )
    {
        BookmarkBox=createWindow();
        document.body.appendChild(BookmarkBox);
    }            
    setSize(BookmarkBox,498,370);
	centerMap(BookmarkBox)	;
	BookmarkBox.innerHTML=getBookmarkText(cName,address);		
    GLoadMap1(lat,lang ,cName,logo,carType,aC,model,address);
}

function GLoadMap1(lat,lang ,cName,logo,carType,aC,model,address)
{       
    if (GBrowserIsCompatible()) 
	{	    		
		gmap1 = new GMap2(document.getElementById("map1"));		
		gmap1.setCenter(new GLatLng(lat,lang), 13);				
		gmap1.addControl(new GMapTypeControl());				
	    gmap1.addControl(new GLargeMapControl());												
	} 
	else 
	{
		var map = document.getElementById("map1");
		map.innerHTML = "You cannot use this browser.<br />";
	}    
    var point = new GLatLng(lat,lang);                                                        
    gmap1.addOverlay(createMarkerForCar(lat,lang ,cName,logo,carType,aC,model,address));	        
}

var clearImage='../App_Themes/DefaultV4/images/clear.gif';
var logoUrl = "http://graphics.rovia.com/Images/CarCompanies/36x36/";
function createMarkerForCar(lat,lang ,cName,strLogo,carType,aC,model,address) 
{       
    var point = new GLatLng(lat,lang);                                                             	
    var marker = new GMarker(point);
    var op = new Sys.StringBuilder();
    
    var logo = clearImage;
    if(strLogo !=null || strLogo !="")logo = logoUrl + strLogo;        
    op.append("<div style='width :200px; height :75px;'><div style='margin-left:79px; '><img src='"+ logo +"' alt='' height='35px' width='42px'  /></div>");    
    op.append("<div style='font-size:12px' >"+cName+"</div>") ;    
    op.append("<div style='font: bold 11px arial;'>"+address+"</div></div>");    
    var HotelInfo=op.toString();    
    var infoTabs = [new GInfoWindowTab("Hotel Info", HotelInfo)];
    GEvent.addListener(marker, "click", function() 
    {
        marker.openInfoWindowTabsHtml(infoTabs);
    });
    return marker;
}
//Account Page Scripts Starts Here
function EnableTextBox(chx,txt)
{
    var chxOther=document.getElementById(chx);
    var txtOther=document.getElementById(txt);
    if(chxOther!=null && txtOther!=null)
    {
        if(chxOther.checked==true)
        {
            txtOther.disabled=false;
        }
        else
        {
            txtOther.disabled=true;
            txtOther.value="";
        }
    }
}
//Account Page Scripts Ends Here
//Waiting image for Vacation.
function ShowWaitImage()
{
    var anc = document.getElementById('btnSearch');     
    anc.click();
}

//scripts used on forms starts here
function ToggleDivRdoDisplay(divId,radioButtonListid)
{

var elementRef = document.getElementById(radioButtonListid);
var radioButtonListArray = elementRef.getElementsByTagName('input');
  hideDiv(divId);
 for (var i=0; i<radioButtonListArray.length; i++)
 {
  var radioButtonRef = radioButtonListArray[i];

  if ( radioButtonRef.checked == true )
  {
   // To get the Value property, use this code:
   if(radioButtonRef.value=="Yes")
   {
       showDiv(divId);
   }
  if(radioButtonRef.value=="No")
   {
   hideDiv(divId);
   }
   if(radioButtonRef.value=="Other")
   {
   showDiv(divId);
   }
  }
 }

}
function ToggleMultipleDivDisplay(divRTId,divMFId,divRTDate,radioButtonListid,reqRetDateID)
{
var elementRef = document.getElementById(radioButtonListid);
var radioButtonListArray = elementRef.getElementsByTagName('input');

 for (var i=0; i<radioButtonListArray.length; i++)
 {
  var radioButtonRef = radioButtonListArray[i];

  if ( radioButtonRef.checked == true )
  {
   // To get the Value property, use this code:
   var divRTElem = document.getElementById('divRTValidation');
   toggleAllChildValidators(false, divRTElem)
   var divMFElem = document.getElementById(divMFId);
   toggleAllChildValidators(false, divMFElem)
   var ctlOWElem = document.getElementById(reqRetDateID);
   //toggleAllChildValidators(true, ctlOWElem)
   if(radioButtonRef.value=="RT" )
   {
       toggleAllChildValidators(true, divRTElem)
       showDiv(divRTId);
       showDiv(divRTDate);
       hideDiv(divMFId);
   }
   if(radioButtonRef.value=="MF")
   {
     toggleAllChildValidators(true, divMFElem)
        hideDiv(divRTId);
        showDiv(divMFId);
   }
   if(radioButtonRef.value=="OW")
   {
     toggleAllChildValidators(true, divRTElem)
     toggleAllChildValidators(false, ctlOWElem)
       showDiv(divRTId);
       hideDiv(divRTDate);
       hideDiv(divMFId);
   }
  }
 }
}
function ToggleSingleDisplay(divid,checkboxid)
{
    var checkBoxctrl=document.getElementById(checkboxid);
    var div=document.getElementById(divid);
    
    if(checkBoxctrl!=null && div!=null)
    {
        toggleAllChildValidators(false, div);
        if(checkBoxctrl.checked)
        {
            showDiv(divid);
        }
        else
        {
            hideDiv(divid);
        }
    }
}

//scripts used on forms ends here
function hide_map_div(div_id)
{
    document.getElementById(div_id).style.display = "none";
}

function SetReadOnly(id)
{   
    if(document.getElementById(id)!=null)
	{
		var txtTarget =document.getElementById(id);
		txtTarget.readOnly=true;
	}	
}
function ResetReadOnly(id)
{   
    if(document.getElementById(id)!=null)
	{
		var txtTarget =document.getElementById(id);
		txtTarget.readOnly=false;
	}	
}

function SetResetReadOnly(chkId,txtId)
{
    if(document.getElementById(chkId)!=null && document.getElementById(txtId)!=null )
	{
	    var txtTarget =document.getElementById(txtId);		
		var chkTarget =document.getElementById(chkId);
		if (chkTarget.checked == true)
		{
		    txtTarget.readOnly=false;
		}
		else
		{
		    txtTarget.readOnly=true;
		}
	}
}
function setAirSelctionHiddenValue(hidSelFldID, sel)
{
    document.getElementById(hidSelFldID).value = sel;
}
//function for CD/PC codes div status in car.
function DiscountCodeDivStatus(rentalComp, discountCode,txtDisCode,divOuterAddDiscountCodeToProfile,divAddToProfileDiv,txtDiscountCodeId)
{
    var company = document.getElementById(rentalComp);
    var DC = document.getElementById(discountCode);
    var txt = document.getElementById(txtDisCode);
    var divCode=document.getElementById(txtDiscountCodeId);
    divCode.value='';
    hideDiv(divAddToProfileDiv);
    if(company.selectedIndex>0 && DC.selectedIndex > 0)
    {
        txt.style.visibility = "visible";
        txt.style.display = "block";
        showDiv(divOuterAddDiscountCodeToProfile);
    }
    else
    {
        txt.style.visibility = "hidden";
        txt.style.display = "none";    
        hideDiv(divOuterAddDiscountCodeToProfile);
    }
}
function HideControlReal(id)

{
    var ctrl = document.getElementById(id); 
    if(ctrl != null)
        ctrl.style.display = 'none';
}

function ChangeBackgroundClass(id, oldClass, newClass)
{
    var mainDiv=document.getElementById('UPnlLogin');
    if(mainDiv == null)
        return;
        
    var divs=mainDiv.childNodes;
    if(divs == null)
        return;
        
    for(var i=0;i<divs.length;i++)
    {
         if(divs[i].className===oldClass)
            divs[i].className=newClass;
    }
}

function Redirect(relUrl)
{
  window.location.href=relUrl;
  return;
}

function SetHotelDescription(desc)
{
     switch(desc)
     {
         case 'Long':
              hideDiv('divShortDesc');
              showDiv('divLongDesc');
              break;
         case 'Short':
              showDiv('divShortDesc');
              hideDiv('divLongDesc');
              break;
      }
}

function CruiseSearch
(               rbtnSearch,
                rbtnDest,
                rbtnLines,
                DdlDestinations,
                txtDepartDate,
                DdlDuration,
                DdlCruiseLine,
                DdlCruiseShip,
                DdlCruiseDestination2,
                DdlCruiseLine2,
                hidCruiseSearchUrl,
                hidCruiseDestUrl,
                hidCruiseLineUrl,
                hidDealerId,
                divError
)
{
    var url = "";
    var baseurl = "";
    var querystring = "";
    ShowCruiseError('')
    
    if($get(hidCruiseSearchUrl).value=='' && $get(hidCruiseDestUrl).value=='' && $get(hidCruiseLineUrl).value=='')
    {
            ShowCruiseError('Cruise base url missing.');  
            return false;   
    }
    
    if($get(rbtnSearch).checked == true)
    {
       if($get(DdlDestinations).value=='')
       {
            ShowCruiseError('Select a destination');
            return false;
       }
            
       baseurl = $get(hidCruiseSearchUrl).value
       querystring += "?triptype=Cruise";
       querystring += "&DestinationID=" + $get(DdlDestinations).value;
       querystring += "&operator=";
       
       var date = $get(txtDepartDate).value;
       
       querystring += "&cruise_month=" + date.substring(0,2);
       querystring += "&cruise_year="+ date.substring(6,10);;
       querystring += "&cruise_duration="+ $get(DdlDuration).value;
       querystring += "&VendorID="+ $get(DdlCruiseLine).value;
       querystring += "&ShipID="+ $get(DdlCruiseShip).value;;
    }
    else if($get(rbtnDest).checked == true)
    {
        if($get(DdlCruiseDestination2).value=='')
        {
            ShowCruiseError('Select a destination');
            return false;
        }
        baseurl = $get(hidCruiseDestUrl).value
        querystring += "?DestinationID="+ $get(DdlCruiseDestination2).value;
    }    
    else if($get(rbtnLines).checked == true)
    {
        if($get(DdlCruiseLine2).value=='')
        {
            ShowCruiseError('Select a Cruise Line');
            return false;
        }
        baseurl = $get(hidCruiseLineUrl).value
        querystring += "?VendorID="+$get(DdlCruiseLine2).value;
    }
    
    querystring = querystring+ "&PIN=" +  $get(hidDealerId).value;
    url=baseurl+querystring;
    window.open(url,'Cruise','height=650,width=1050,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,location=yes');
}

function ShowCruiseError(message)
{
    if(message!='')
    {
        showDiv('divErrorCruise');
        $get('divErrorCruise').innerHTML = message;
    }
    else
        hideDiv('divErrorCruise');
}

function ShowBrowserRecommendationForIE6()
{
    var browser=navigator.appName;
    var b_version=navigator.appVersion ;
    var msg = "Internet Explorer 6 users will not be able to view this website properly. We STRONGLY recommend upgrading to Internet Explorer 7 OR the latest version of Firefox or Safari"
    var hdnMsgDisplayStatus = readCookie("msgDisplay");
    if ((browser == "Microsoft Internet Explorer") && hdnMsgDisplayStatus ==null)
    {
        b_version = b_version.substr(b_version.indexOf('MSIE')+5,3);
        var version=parseFloat(b_version);
        if(version==6)
        {
             alert(msg);
            createCookie("msgDisplay",'true',1);// hdnMsgDisplayStatus.value = 'true';
        }
    }
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	var cookieContent =  name+"="+value+expires+"; path=/";
	document.cookie = cookieContent ;
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function ToggleMFValidation(cbxID,divValidationID)
{
    var cbxElem = document.getElementById(cbxID);
    var divElem = document.getElementById(divValidationID);
    if(cbxElem != null && divElem != null)
    {
        if(cbxElem.checked)
            toggleAllChildValidators(true, divElem);
        else
            toggleAllChildValidators(false, divElem);
    }
}

function ToggleFlightView(rdoBtnID,divRTID,divRetDateID,divMFID)
{
    var btnId = rdoBtnID;
    var selectedRdoBtn = document.getElementById(rdoBtnID);
    var divRTFlight = document.getElementById(divRTID);
    var divOWFlight = document.getElementById(divRetDateID);
    var divMFFlight = document.getElementById(divMFID);
    toggleAllChildValidators(false, document.getElementById(divRTID));
    toggleAllChildValidators(false, document.getElementById(divMFID));
    switch(selectedRdoBtn.value)
    {
        case "rbtnRT":
        showDiv(divRTID);hideDiv(divMFID);showDiv(divRetDateID);showDiv('divReturnTime');
        break;
        case "rbtnOW":
        showDiv(divRTID);hideDiv(divMFID);hideDiv(divRetDateID);hideDiv('divReturnTime');
        break;
        case "rbtnMF":
        hideDiv(divRTID);showDiv(divMFID);hideDiv(divRetDateID);hideDiv('divReturnTime');hideDiv('divMoreFlightsContent');showDiv('divMoreFlights');
        break;
    }
}

function DisableAllGroupValidations(divAirId,divCarId,divHotelId,divCruiseId)
{
    toggleAllChildValidators(false, document.getElementById(divAirId));
    toggleAllChildValidators(false, document.getElementById(divCarId));
    toggleAllChildValidators(false, document.getElementById(divHotelId));
    toggleAllChildValidators(false, document.getElementById(divCruiseId));
}
function ShowDropOffSearchLocation(cbxId, divId)
{
    var cbxCtrl = document.getElementById(cbxId);
    if(cbxCtrl == null || typeof(cbxCtrl)=='undefined') return;
    if(cbxCtrl.checked)hideDiv(divId);
    if(!cbxCtrl.checked)showDiv(divId);
}
function EnableSelectedGroupValidations(cbxAirId,cbxCarId,cbxHotelId,cbxCruiseId,divAirId,divCarId,divHotelId,divCruiseId,cbxSAmeAsPickupId,rbtnRTId,rbtnOWId,rbtnMFId,rfvRetDtId,rfvCarDropLocId)
{

    toggleAllChildValidators(false, document.getElementById(divAirId));
    toggleAllChildValidators(false, document.getElementById(divCarId));
    toggleAllChildValidators(false, document.getElementById(divHotelId));
    toggleAllChildValidators(false, document.getElementById(divCruiseId));
    var cbxAir = document.getElementById(cbxAirId);
    if(cbxAir != null && cbxAir.checked)
    {
        EnableSelectedAirValidation(rbtnRTId,rbtnOWId,rbtnMFId,rfvRetDtId);
    }
    var cbxCar = document.getElementById(cbxCarId);
    if(cbxCar != null && cbxCar.checked)
    {
        toggleAllChildValidators(true, document.getElementById(divCarId));
        var cbxSameAsPickup = document.getElementById(cbxSAmeAsPickupId);
        var rfvCarDropLoc = document.getElementById(rfvCarDropLocId);
        if(cbxSameAsPickup != null && cbxSameAsPickup.checked && rfvCarDropLoc != null)
            toggleAllChildValidators(false, rfvCarDropLoc);
    }
    var cbxHotel = document.getElementById(cbxHotelId);
    if(cbxHotel != null && cbxHotel.checked)
        toggleAllChildValidators(true, document.getElementById(divHotelId));
    var cbxCruise = document.getElementById(cbxCruiseId);
    if(cbxCruise != null && cbxCruise.checked)
        toggleAllChildValidators(true, document.getElementById(divCruiseId));

    return Page_IsValid;
}

function EnableSelectedAirValidation(rbtnRTId,rbtnOWId,rbtnMFId,rfvRetDtId)
{
    var rbtnRT = (rbtnRTId !="")?document.getElementById(rbtnRTId):null;
    var rbtnOW = (rbtnOWId !="")?document.getElementById(rbtnOWId):null;
    var rbtnMF = (rbtnMFId !="")?document.getElementById(rbtnMFId):null;
    var rdoBtnID ="";
    var rfvCtlId=null;
    if(rbtnRT != null  && rbtnRT.checked)
    {
        rdoBtnID = rbtnRTId;
    }
    if(rbtnOW != null && rbtnOW.checked)
    {
        rdoBtnID = rbtnOWId;
        rfvCtlId = rfvRetDtId;
    }
    if(rbtnMF != null && rbtnMF.checked)
    {
        rdoBtnID = rbtnMFId;
    }
     ToggleFlightValidation(rdoBtnID,'divRoundTrip','divReturndate','divMultiFlight',rfvCtlId);
      return Page_IsValid;
}

function ToggleFlightValidation(rdoBtnID,divRTID,divRetDateID,divMFID,ctlRetDateID)
{
    var btnId = rdoBtnID;
    var selectedRdoBtn = document.getElementById(rdoBtnID);
    var divRTFlight = document.getElementById(divRTID);
    var divOWFlight = document.getElementById(divRetDateID);
    var divMFFlight = document.getElementById(divMFID);
    
    var ctlRetDate = null;
    if(ctlRetDateID !=null)
    var ctlRetDate = document.getElementById(ctlRetDateID);
    
    toggleAllChildValidators(false, divRTFlight)
    toggleAllChildValidators(false, divMFFlight)
        
    switch(selectedRdoBtn.value)
    {
        case "rbtnRT":
        toggleAllChildValidators(true, divRTFlight)
        break;
        case "rbtnOW":
        toggleAllChildValidators(true, divRTFlight)
        if(ctlRetDate !=null)
        toggleAllChildValidators(false, ctlRetDate)
        break;
        case "rbtnMF":
        toggleAllChildValidators(true, divMFFlight);
        break;
    }
}
function ToggleCruiseRequestValidation(cbxFlightID,divFlightID,cbxHotelID,divHotelID)
{

    var cbxFlight = (cbxFlightID !="")?document.getElementById(cbxFlightID):null;
    var cbxHotel = (cbxHotelID !="")?document.getElementById(cbxHotelID):null;
    
    if(divFlightID != "")
        toggleAllChildValidators(false, document.getElementById(divFlightID));
    if(divHotelID != "")
        toggleAllChildValidators(false, document.getElementById(divHotelID));

    if(cbxFlight != null  && cbxFlight.checked)
    {
        toggleAllChildValidators(true, document.getElementById(divFlightID));
        showDiv(divFlightID);
    }
    if(cbxHotel != null  && cbxHotel.checked)
    {
        toggleAllChildValidators(true, document.getElementById(divHotelID));
        showDiv(divHotelID);
    }
    var divError = document.getElementById('divErrorMsg');
    var isValid = Page_IsValid && (divError.style.visibility !='visible');
    return isValid;
}

function GetNumberOfNights(departDate,ReturnDate)
{
    // The number of milliseconds in one day
    var ONE_DAY = 1000 * 60 * 60 * 24

    // Convert both dates to milliseconds
    var date1_ms = departDate.getTime()
    var date2_ms = ReturnDate.getTime()
    if(date1_ms>date2_ms) return 0;
    // Calculate the difference in milliseconds
    var difference_ms = Math.abs(date2_ms - date1_ms)
    
    // Convert back to days and return
    return Math.round(difference_ms/ONE_DAY)

}

function GetDateFromText(textDate)
{
    if(textDate != "")
    {
       var dateTokens = textDate.split('/');
       if(dateTokens.length == 3)
       {
             var myDate=new Date(dateTokens[2],dateTokens[0]-1,dateTokens[1]);
             return myDate;
       }
    }
    return null;
}

function validateAlphanumeric(txtBoxId)
{
    var txtBoxEle = document.getElementById(txtBoxId);
    if(txtBoxEle!=null)
    {
    var check="\"[a-zA-Z0-9]*?\""
    var temp="\"" +txtBoxEle.value + "\"";
    txtBoxEle.value=txtBoxEle.value.replace('\"','');
    var match = temp.match(check);
    if(match == null)
    {
    txtBoxEle.value = txtBoxEle.value.replace(/[^a-zA-Z0-9]+/g,'');
    return false;
    }
    }
}

function ToggleProfileAddressType(ddlId, divStdAddr, divMltAddr)
{
    var ddlEle = document.getElementById(ddlId);
    if(ddlEle!=null)
    {
        if(ddlEle.value == 'Military')
        {
            showDiv(divMltAddr);
            hideDiv(divStdAddr);
        }
        else
        {
            hideDiv(divMltAddr);
            showDiv(divStdAddr);
        }
    }
}

function DisableValidators(ddlId, val1, val2)
{
     var val1Ele = document.getElementById(val1);
     var val2Ele = document.getElementById(val2);
     
     var ddlEle = document.getElementById(ddlId);
     
     if(val1Ele!=null && val2Ele!=null)
     {
        if(ddlEle.value == 'Military')
        {
            ValidatorEnable(val1Ele, false); 
            ValidatorEnable(val2Ele, false); 
        }
        else
        {
            ValidatorEnable(val1Ele, true); 
            ValidatorEnable(val2Ele, true); 
        }
     }
}


function CheckIfExistingData(txtNewInformation, hidExistingInformation, divAddToProfile, divPushToProfileOuterDiv, hdnFieldDivIds, chxPushToProfileId, chxSelfClientId) {
    
    var divIds = document.getElementById(hdnFieldDivIds);
    var divIdStr = '';
    if (divIds != null) {divIdStr = divIds.value};
    hideDiv(divAddToProfile);
    var chxSelf = document.getElementById(chxSelfClientId);

    if (chxSelf != null && chxSelf.checked) {
        showDiv(divPushToProfileOuterDiv);
        if (divIdStr == '') {divIds.value = divPushToProfileOuterDiv + '|' + divAddToProfile}
        else {divIds.value = divIdStr + '|' + divPushToProfileOuterDiv + '|' + divAddToProfile}
    }

    if (chxSelf != null && !chxSelf.checked) {
        hideDiv(divAddToProfile);
        return;
    }

    var matchFound = false;
    var newNumber = document.getElementById(txtNewInformation);
    var existingNumbers = document.getElementById(hidExistingInformation);
    var ctrlChxPushToProfile = document.getElementById(chxPushToProfileId);
    if (existingNumbers.value.trim().length == 0 && newNumber.value.trim().length > 0) {
        showDiv(divAddToProfile);
        if (hdnFieldDivIds != null) {
            if (divIdStr == '') {divIds.value = divPushToProfileOuterDiv + '|' + divAddToProfile}
        else {divIds.value = divIdStr + '|' + divPushToProfileOuterDiv + '|' + divAddToProfile}
        }
    }
    else {
        hideDiv(divAddToProfile);
        if (newNumber.value.length > 0) {
            var existingNumbersList = existingNumbers.value.split(',');
            for (var i = 0; i < existingNumbersList.length; i++) {
                if (newNumber.value.toLowerCase() == existingNumbersList[i].toLowerCase()) {
                    matchFound = true;
                    break;
                }
            }
            if (!matchFound) {
                showDiv(divPushToProfileOuterDiv);
                showDiv(divAddToProfile);
                if (divIdStr == '') {divIds.value = divPushToProfileOuterDiv + '|' + divAddToProfile}
                 else {divIds.value = divIdStr + '|' + divPushToProfileOuterDiv + '|' + divAddToProfile}
            }
        }
    }
}

function CheckIfDiscountCodeExist(txtNewInformation,hidExistingInformation, divAddToProfile,chxPushToProfileId,drpDiscountType,drpCarCompanies) 
 {
 
    hideDiv(divAddToProfile);
    var matchFound = false;
    var newNumber = document.getElementById(txtNewInformation);
    var existingNumbers = document.getElementById(hidExistingInformation);
    var ctrlChxPushToProfile = document.getElementById(chxPushToProfileId);
    var selCarCompIndex=$get(drpCarCompanies).selectedIndex;
    var selCarCompany=$get(drpCarCompanies).options[selCarCompIndex].value;
    var IndexValue = $get(drpDiscountType).selectedIndex;
    var discountType = $get(drpDiscountType).options[IndexValue].text;
    ctrlChxPushToProfile.checked=false;
    if (existingNumbers.value.trim().length == 0 && newNumber.value.trim().length>0)
     {
        showDiv(divAddToProfile);
      }
    else {
        hideDiv(divAddToProfile);
        if (newNumber.value.length > 0)
         {
         var checkNumber=discountType+'|'+selCarCompany+'|'+newNumber.value;
            var existingNumbersList = existingNumbers.value.split(',');
            for (var i = 0; i < existingNumbersList.length; i++) {
                if (checkNumber.toLowerCase() == existingNumbersList[i].toLowerCase()) {
                    matchFound = true;
                    break;
                }
            }
            if (!matchFound) 
            {
                showDiv(divAddToProfile);
            }
        }
    }
}


function ShowPushToProfileDivs(divIdList)
{ 

    var divIds=[];
    divIds=divIdList.split('|');
     if(divIds!=null)
        {
        for(var i=0;i<divIds.length;i++)
            {
                if(divIds[i]!=null)
                     showDiv(divIds[i]);
             } 
         }
}

//Function for Amenities Show And Hide Ends Here
function OpenWindow(url,windowname,w,h){
var win = null;
var setvalues = 'height='+h+',width='+w+',top=50,left=100,scrollbars=yes,resizable=yes,,menubar=no,toolbar=no,status=no'
var win = window.open(url,windowname,setvalues)
}

function UpdateTotalPrice(chkBoxId, amount, lblTotalAmountId, lblTotalAmountLableId, isOnlyCar, divCCsection,divFOPSection, divInsuranceParent, lblState, lblZipCode, isSoftCashAvailable) {   
    var divInsuranceParentEle =document.getElementById(divInsuranceParent);
    var result = false;
    if(divInsuranceParentEle!=null)
        result = IsAnyCheckBoxChecked(divInsuranceParentEle);


    if (isSoftCashAvailable == 'true' || isSoftCashAvailable == 'True') {
    // Don nothing
    }
    else {
        if ((isOnlyCar == "True" || isOnlyCar == "true") && !result) {
            hideDiv(divCCsection);

        }
        else {
            showDiv(divCCsection);

        }
    }
    if (document.getElementById(chkBoxId).checked == true)
    {
        
        var oldTotal = document.getElementById(lblTotalAmountId).value;
        var newTotal = parseFloat(oldTotal) + parseFloat(amount);
        newTotal = newTotal.toFixed(2);
        document.getElementById(lblTotalAmountId).value = newTotal;
        document.getElementById(lblTotalAmountLableId).innerHTML  =  FormatCurrencyWithCommas(String.format("${0:0,00.0}",newTotal));
    }
    else
    {
        var oldTotal = document.getElementById(lblTotalAmountId).value;
        var newTotal = parseFloat(oldTotal)-parseFloat(amount);
        newTotal = newTotal.toFixed(2);
        document.getElementById(lblTotalAmountId).value = newTotal;
        document.getElementById(lblTotalAmountLableId).innerHTML  =  FormatCurrencyWithCommas(String.format("${0:0,00.0}",newTotal));
    }       
    
      
      var lblStateEle =document.getElementById(lblState);
      var lblZipCodeEle =document.getElementById(lblZipCode);
      
      if(divInsuranceParentEle!=null && lblStateEle!=null && lblZipCodeEle!=null)
      {
          //var imgPathState = "<img src=\"../App_Themes/DefaultV4/images/icons/question.gif\" style=\"cursor: pointer;\" onmouseover=\"ShowInfo_StateClick(this);\" onmouseout=\"hideDiv('divRequiredInfo');\" alt=\"\" />";
          //lblStateEle.innerHTML = "State/Province* (Enter state code)" + imgPathState;    
          
          if(result == true)
          {
            //lblStateEle.innerHTML = "State/Province*";
            lblZipCodeEle.innerHTML = "Zip code*";
          }
          else
          {
            
            var imgPathZip = "<img src=\"../App_Themes/DefaultV4/images/icons/question.gif\" style=\"cursor: pointer;\" onmouseover=\"ShowInfo_ZipClick(this);\" onmouseout=\"hideDiv('divZipInfo');\" alt=\"\" />";
            
            lblZipCodeEle.innerHTML = "Zip code* " + imgPathZip;
          }
          
      }
      
    
}

function DisplayInsuranceSection(divTravelInsuranceSectionId, rdoFOPSoftCashId)
{

    rdoFOPSoftCashIdEle = document.getElementById(rdoFOPSoftCashId);
    if(rdoFOPSoftCashIdEle!=null && rdoFOPSoftCashIdEle.checked)
    {
        hideDiv(divTravelInsuranceSectionId);
    }
    else
    {
        showDiv(divTravelInsuranceSectionId);
    }
}

function IsAnyCheckBoxChecked(divInsuranceParentEle)
{ 
   if(divInsuranceParentEle!=null)
   {
        var inputs = divInsuranceParentEle.getElementsByTagName("input");
        if (inputs.length>0)
        {
            
            for (i=0; i<=inputs.length;i++)
            {
                if(inputs[i]!=null && inputs[i].type=="checkbox")
                {
                    var chk=$get(inputs[i].id);
                    if(chk.checked == true)
                    {
                        return true;
                    }
                }
            }
         }
    }
    return false;
}

function FormatCurrencyWithCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

var mediaAvailable = 'FALSE';
var linkType = '';

function HideShowMultiMedia()
{                    
    if ( mediaAvailable !=  null )
    {
        if( mediaAvailable == 'TRUE' )
        {
            var divMedia = document.getElementById("divHotelContent");
            if ( divMedia != null ) 
            {
                divMedia.style.display = '';
            }
        }
        if( mediaAvailable == 'FALSE' )
        {
            var divMedia = document.getElementById("divHotelContent");
            if ( divMedia != null ) 
            {
                divMedia.style.display = 'none';
            }
        }
    }
    else
    {
         var divMedia = document.getElementById("divHotelContent");
         if ( divMedia != null ) 
         {
                divMedia.style.display = '';
         }
    }
}

function PopulateShippingAddress(add1,add2,city,state,zip,country,phNum,cbxId)
{
    var divShipAdd = document.getElementById('ShipAddressDetails');
    if(divShipAdd == null) return;
    var shipAddInputElements = divShipAdd.getElementsByTagName('input');  
    var cbxSelf = document.getElementById(cbxId);
    for(var i=0;i<shipAddInputElements.length;i++)
    {
        var elem = shipAddInputElements.item(i);
        if(elem.type =='text')
        {
            if(elem.id.indexOf('txtAddLine1')>-1)
	        {
	            elem.value = (cbxSelf.checked)?add1:"";
	        }
	        if(elem.id.indexOf('txtAddLine2')>-1)
	        {
	            elem.value = (cbxSelf.checked)?add2:"";
	        }
	        if(elem.id.indexOf('txtCity')>-1)
	        {
	            elem.value = (cbxSelf.checked)?city:"";
	        }
	        if(elem.id.indexOf('txtState')>-1)
	        {
	            elem.value = (cbxSelf.checked)?state:"";
	        }
	        if(elem.id.indexOf('txtZipCode')>-1)
	        {
	            elem.value = (cbxSelf.checked)?zip:"";
	        }
	        if(elem.id.indexOf('txtPhoneNo')>-1)
	        {
	            elem.value = (cbxSelf.checked)?phNum:"";
	        }
	    }
    }
}

//Validates the credit card expiration date to be valid
function validateCreditCardExpiry(currentMonth, currentYear, drpMonthId, drpYearId)
{
    if(document.getElementById(drpYearId).value == currentYear)
    {
        if(document.getElementById(drpMonthId).value < currentMonth)
        {
            alert('You cannot select a past Expiration Date.');
            document.getElementById(drpMonthId).value = currentMonth;
        }
    }
}

function creditCardSelectionChanged(ddlCC,divContainer,objCC){
    divContainer = document.getElementById(divContainer);
    var ccElmt = divContainer.getElementsByTagName("input");
    if(objCC==undefined ||  objCC.length<1)
       return;
    var isCard=false;   
    var card;
    if(ddlCC.selectedIndex>0)
        isCard=true;
     if(isCard)   
        card = objCC[ddlCC.selectedIndex-1];
        
    var countryCode = "";
    var stateCode = ""
    if(card!=null && card.BA!=null) 
    { 
        if(card.BA.Cnt!=null)
            countryCode = card.BA.Cnt;
        if(card.BA.S!=null)
            stateCode = card.BA.S;
    }
    
    if(countryCode==null || countryCode=="")
        countryCode = "US";
    
    for(var i=0;i<ccElmt.length;i++)
    {
        var elem = ccElmt.item(i);
        if(elem.type=='text')
        {
            if(elem.id.indexOf('txtCardNo')>-1){
                if(isCard){
                    elem.value=card.cc.cn;
                    elem.onblur();
                }else
                    elem.value='';
            }    
            if(elem.id.indexOf('txtName')>-1){
                if(isCard)
                    elem.value=card.cc.name;
                else
                    elem.value='';
            }        
            if(elem.id.indexOf('txtAddLine1')>-1){
                if(isCard)
                    elem.value=card.BA.A1;
                 else
                    elem.value='';
            }   
            if(elem.id.indexOf('txtAddLine2')>-1){
                if(isCard)
                    elem.value=card.BA.A2;
                else
                    elem.value='';
            }
            if(elem.id.indexOf('txtCity')>-1){
                if(isCard)
                   elem.value=card.BA.C;
                else
                    elem.value='';
            }
            if(countryCode.toUpperCase()!="US")
            {
                
                if(elem.id.indexOf('txtState')>-1){
                    if(isCard)
                        elem.value=card.BA.S;
                    else
                        elem.value='';
                }   
            }
            if(elem.id.indexOf('txtZipCode')>-1){
                if(isCard)
                    elem.value=card.BA.Z;
                else
                    elem.value='';
            }
            if(elem.id.indexOf('txtPhoneCode')>-1){
                if(isCard)
                   elem.value=card.BA.PhC;
                else
                    elem.value='';
            }
            if(elem.id.indexOf('txtPhoneNo')>-1){
                if(isCard)
                   elem.value=card.BA.Ph;                        
                else
                    elem.value='';
            }
        }
     }
     
     ccElmt = divContainer.getElementsByTagName("select");  
     for(var i=0;i<ccElmt.length;i++)
     {
        var elem = ccElmt.item(i);
        if(elem.id.indexOf('drpMonth')>-1){
            if(isCard)
                elem.value = card.cc.EM;
            else
                elem.value='select';
        }
        
        if(elem.id.indexOf('ddlAddressType')>-1){
            if(isCard && card.BA.T!='' )
                elem.value = card.BA.T;
            else
                elem.value='Standard';
            
            elem.onchange();    
        }    
        if(elem.id.indexOf('drpYear')>-1){
            if(isCard)
               elem.value=card.cc.EY;
            else
                elem.value='select';
        }
        
        
        if(elem.id.indexOf('drpState')>-1)
        {
            if(countryCode.toUpperCase()=="US")
            {   
                if(isCard)
                    elem.value=stateCode;
                else
                   elem.value='select'; 
               
            }
            else if(!isCard)
                elem.value='select'; 
       }
            
        
        if(elem.id.indexOf('drpCountry')>-1){
            if(isCard)
                elem.value=card.BA.Cnt;
            else
                elem.value='US';
        }
    }
    
    ccStateDivElmt = divContainer.getElementsByTagName("div");  
    var drpStateId =null;
    var divTxtStateId = null;
    for(var i=0;i<ccStateDivElmt.length;i++)
    {
        var elem = ccStateDivElmt.item(i);
        if(elem.id.indexOf('divTxtState')>-1){
            divTxtStateId = elem.id;
        }
        
        if(elem.id.indexOf('divDrpState')>-1){
            drpStateId = elem.id;
        }
     }  
    if(countryCode.toUpperCase()=="US")
    {  
        showDiv(drpStateId);
        hideDiv(divTxtStateId);
    }
    else
    {
        hideDiv(drpStateId);
        showDiv(divTxtStateId);
    }
       
//    hideDiv(divAddToProfile);
}

function toggleBillingAddressStateInput(drpCountryId, drpStateId, divTxtStateId)
{
    var drpCountryIdEle = document.getElementById(drpCountryId);
    if(drpCountryIdEle!=null)
    {
        if(drpCountryIdEle.value ==  "US" || drpCountryIdEle.value == "us")
        {
           showDiv(drpStateId);
            hideDiv(divTxtStateId);
        }
        else
        {
           hideDiv(drpStateId);
           showDiv(divTxtStateId);
        }
    }
}

function ManageState(drpCountry, drpState, txtState, rfvState)
{
// debugger;
//    var drpCountryId = document.getElementById(drpCountry);
//    var drpStatedrpId = document.getElementById(drpState);
//    var txtStatetxtId = document.getElementById(txtState);
//    var rfvStateId = document.getElementById(rfvState);
//    
//    var selectedCountry = drpCountryId.value;
//    if(selectedCountry == "US" || selectedCountry == 'us')
//    {
//        drpStatedrpId.style.visibility = "visible";
//        drpStatedrpId.style.display = "block"; 
//        txtStatetxtId.style.visibility = "hidden";
//        txtStatetxtId.style.display = "none";
//        rfvStateId.disable = false;           
//  
//    else    
//    {
//         drpStatedrpId.style.visibility = "hidden";
//        drpStatedrpId.style.display = "none"; 
//        txtStatetxtId.style.visibility = "visible";
//        txtStatetxtId.style.display = "block";
//        rfvStateId.disable = false;           
//    }   
}


function AddCarCodesToGrid(gridId, drpCarCompanyId, txtCDCodeId, txtPCCodeId, hidCarCodesId, divErrorId, hidCodesId)
{
    var drpCarCompanyEle = $get(drpCarCompanyId);
    var txtCDCodeEle = $get(txtCDCodeId);
    var txtPCCodeEle = $get(txtPCCodeId);
    var hidCarCodesEle = $get(hidCarCodesId);
    var divErrorEle = $get(divErrorId);
    var hidCodesEle = $get(hidCodesId);//Contains all codes entered by user. Format : CompanyCode|CD|PC^CompanyCode|CD|PC^.....
    
    var carCompany = drpCarCompanyEle.options[drpCarCompanyEle.selectedIndex].innerHTML;
    var trId = 'tr' + drpCarCompanyEle.value;
    var entriesArray = hidCodesEle.value.split("^");
    var currCodeCount = entriesArray.length - 1;
    
    if(drpCarCompanyEle.selectedIndex == 0)
    {
        showDiv(divErrorId);
        divErrorEle.innerHTML = "Please select the car company."
    }
    else if(txtCDCodeEle.value=="" && txtPCCodeEle.value=="")
    {
        showDiv(divErrorId);
        divErrorEle.innerHTML = "Please enter at least one discount code."
    }
    else if(AlreadyEnteredCarCompanyForCarCodes(entriesArray, drpCarCompanyEle.value))
    {
        showDiv(divErrorId);
        divErrorEle.innerHTML = "Sorry! You cannot add codes for same car company again."
    }
    else if(currCodeCount >= 6)
    {
        showDiv(divErrorId);
        divErrorEle.innerHTML = "Sorry! You cannot add more than 6 entries."
    }
    else
    {
        //Clear error text
        divErrorEle.innerHtml = "";
        hideDiv(divErrorId);
        gridtbody = "#"+ gridId + ' tbody';
        
        //Add row to existing table
        $(gridtbody).append("<tr id='"+trId +"'>" +
							"<td style=\'padding-left:10px;\'>" + carCompany +"</td>" + 
							"<td style=\'padding-left:10px;\'>" + txtCDCodeEle.value + "</td>" + 
							"<td style=\'padding-left:10px;\'>" + txtPCCodeEle.value + "</td>" + 
							"<td style=\'padding-left:20px;\'><a href='' onclick=\"return RemoveElement('"+trId+"', '"+drpCarCompanyEle.value+"' ,'"+hidCodesId+"')\">Remove</a></td>" +
							"</tr>");
							
		//Add entry to hiddenfield
		hidCodesEle.value += drpCarCompanyEle.value + "|" + txtCDCodeEle.value + "|" + txtPCCodeEle.value + "^";
							
        //Clear all current discount code textbox-dropdown values							
		drpCarCompanyEle.selectedIndex = 0;					
		txtCDCodeEle.value = "";
		txtPCCodeEle.value = "";
		
		
		
	}
	
}

function RemoveElement(trId, companyCode, hidCodesId)
{
    //Remove row from table
    var jQueryId = "#" +trId;
    $(jQueryId).remove();
    
    //Remove the entry from of hidden field.
    var hidCodesEle = $get(hidCodesId);
    entriesArray = hidCodesEle.value.split("^");
    
    if(entriesArray==null || companyCode==null || companyCode == "")
        return false;
        
    var newEntriesArray= new Array();
    var newInd = 0;
    for(ind=0; ind<entriesArray.length; ind++)
    {
        if(!entriesArray[ind].startsWith(companyCode))
            newEntriesArray[newInd++] = entriesArray[ind];
    }
    
    var updatedCarCodes = "";
    for(ind=0; ind<newEntriesArray.length; ind++)
    {
        if(newEntriesArray[ind]!=null && newEntriesArray[ind]!="")
            updatedCarCodes+=newEntriesArray[ind]+"^";
    }
    hidCodesEle.value = updatedCarCodes;
    return false;
}

function AlreadyEnteredCarCompanyForCarCodes(entriesArray, companyCode)
{
    if(entriesArray==null || companyCode==null || companyCode == "")
        return false;
    for(ind=0; ind<entriesArray.length; ind++)
    {
        if(entriesArray[ind].startsWith(companyCode))
            return true;
    }
    return false;
}
function ToggleDisneyQuoteDiv(rdoBtnLstDisneyVacationType,divDisneyVacationInfo)
{
    hideDiv(divDisneyVacationInfo);
    var elementRef = document.getElementById(rdoBtnLstDisneyVacationType);
    var radioButtonListArray = elementRef.getElementsByTagName('input');
    for (var i = 0; i < radioButtonListArray.length; i++) 
    {
        var radioButtonRef = radioButtonListArray[i];
        if (radioButtonRef.checked == true) 
        {
            showDiv(divDisneyVacationInfo);
        }
    }
}

//scripts used on forms starts here
function ToggleDivDisplayOnSelection(radioButtonListid,divId) {
    var elementRef = document.getElementById(radioButtonListid);
    var radioButtonListArray = elementRef.getElementsByTagName('input');
    hideDiv(divId);
    for (var i = 0; i < radioButtonListArray.length; i++) {
        var radioButtonRef = radioButtonListArray[i];
        if (radioButtonRef.checked == true) {
            // To get the Value property, use this code:
            if (radioButtonRef.value == "Yes") {
                showDiv(divId);
            }
            if (radioButtonRef.value == "No") {
                hideDiv(divId);
            }
        }
    }
}

function CheckExpiryDate(source, arguments) {
    var yy = document.getElementById(document.getElementById(source.id).attributes["MyYear"].value);
    var mm = document.getElementById(document.getElementById(source.id).attributes["MyMonth"].value);

    if (yy.value == "" || mm.value == "") {
        arguments.IsValid = false;
        mm.focus();
    }
    else {
        var d = new Date();
        if (yy.value == d.getFullYear() && mm.value < (d.getMonth() + 1)) {
            arguments.IsValid = false;
            mm.focus();
        }
    }
}

function CheckExpiryDateOnChange(yyid, mmid, vid) {
    var yy = document.getElementById(yyid);
    var mm = document.getElementById(mmid);
    var validator = document.getElementById(vid);
    var d = new Date();

    if (yy.value == "" || mm.value == "") {
        validator.style.display = '';
    }
    else if (yy.value == d.getFullYear() && mm.value < (d.getMonth() + 1)) {
        validator.style.display = '';
    }
    else {
        validator.style.display = 'none';
    }
}

function OnFormOfPaymentChanged(rdoFOPSoftCashId, divCreditCardId, divSoftCashId)
{
    var rdoFOPSoftCashIdEle = document.getElementById(rdoFOPSoftCashId);
    if(rdoFOPSoftCashIdEle!=null)
    {
        if(rdoFOPSoftCashIdEle.checked)
        {
            hideDiv(divCreditCardId);
            showDiv(divSoftCashId);
        }
        else
        {
            showDiv(divCreditCardId);
            hideDiv(divSoftCashId);
        }
    }      
}

function SetCCPaymentMethod(rdoFOPCCId, rdoFOPSoftCashId)
{
    var rdoFOPSoftCashIdEle = document.getElementById(rdoFOPSoftCashId);
    var rdoFOPCCIdEle = document.getElementById(rdoFOPCCId);
    if(rdoFOPSoftCashIdEle!=null && rdoFOPCCIdEle!=null)
    {
        rdoFOPCCIdEle.checked = true;
        rdoFOPSoftCashIdEle.checked = false;
    }  
       
}

function HideShowView(hideDivId, showDivId) {

    var hideDiv = document.getElementById(hideDivId.toString());
    hideDiv.style.display = 'none';

    $("#" + showDivId).slideDown('fast');
}
