﻿var s1,s2,s3,s4;
var count=0;
var beachOffLen,cityOffLen,skiOffLen,minSlider,maxSlider;
var _minP,_maxP;
var _length=false;
var filesadded = '';
function CreateXmlHttp()
{    var XmlHttp;
	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
	return XmlHttp;
}
function footerCall(type)
{   
   AjaxHomeRequest("FD",parseInt(type))   
}
function IsPostBack()
{   
    _$("ctl00_plhBody_hdnPostBack").value = '0';
}
function HomePageCall()
{   
    var TabValue= _$("ctl00_plhBody_hdnTabValue").value; 
    if(TabValue=='0')
    {
        if(_$("skiset2") != null) {_$("skiset2").style.display="none";}
        AjaxHomeRequest("SO",0);
        AjaxHomeRequest("H",0); 
        beach_tab.className="active_tab";
        //ski_tab.className="inactive_tab_right";
        city_tab.className="inactive_tab_right";
        var dealDiv=_$("test");
        dealDiv.className='show';         
        var Blabel=_$("price_label");
        Blabel.className='border'; 
        var pselect = _$("price_select"); 
        pselect.className = 'show';             
        _minP='50';
        _maxP='100';
        InitiliazeSlider('price_label','price_select','min_slider','max_slider',(Math.floor(_minP)),(Math.ceil(_maxP)),'0');               
    }
    else if(TabValue=='1')
    {
        if(_$("skiset2") != null) {_$("skiset2").style.display="none";}
        AjaxHomeRequest("SO",1);			       
        AjaxHomeRequest("H",1);
        AjaxHomeRequest("CF",1);          
        beach_tab.className="inactive_tab";
        //ski_tab.className="inactive_tab_right";
        city_tab.className="active_tab";  
    }
    else if(TabValue=='2')
    {
        if(_$("skiset2") != null) {_$("skiset2").style.display="block";}
        AjaxHomeRequest("SO",2);
	    AjaxHomeRequest("H",2);
        AjaxHomeRequest("CF",2);          
        //ski_tab.className="active_tab";
        beach_tab.className="inactive_tab_right";
        city_tab.className="inactive_tab";
    }    
    if(_$("ctl00_plhBody_hdnPostBack").value == '0')
    {
        _$("ctl00_plhBody_hdnPostBack").value = '1';
        _offerBox();  	
    }   	
}
function AjaxHomeRequest(req,type)
{    
     var TabValue= _$("ctl00_plhBody_hdnTabValue").value; 
     var theDate = new Date();
     if(type=="DIDYOUMEAN")
     {
        var requestUrl = "/Search/AjaxImpl.aspx?page=ind&sq="+req+"&dt="+ theDate.getTime();
     }
     else
     {
        var requestUrl = "/Search/AjaxImpl.aspx?page="+req+"&type="+type+"&dt="+ theDate.getTime();
     }
        var XmlHttp = CreateXmlHttp();
         if(XmlHttp)
	     {
		    XmlHttp.onreadystatechange = function()
		     { 
                if(XmlHttp.readyState == 4)
                {
	                if(XmlHttp.status == 200)
	                {
	                    if(req=="SO")
	                    {
	                        if(type=='0' )
	                        {
	                            _$("ctl00_plhBody_hdnSpOfferBeach").value=XmlHttp.responseText;
	                            if(TabValue=='0')
	                            {
	                                 SpecialOffer(XmlHttp.responseText,type,true); 	                                 
	                            }	                            
	                        }
	                        if(type=='1' )
	                        {
	                             _$("ctl00_plhBody_hdnSpOfferCity").value=XmlHttp.responseText; 
	                             if(TabValue=='1')
	                             {
	                                 SpecialOffer(XmlHttp.responseText,type,true); 
	                             }    	                        
	                        }
	                        if(type=='2' )
	                        {
	                            _$("ctl00_plhBody_hdnSpOfferSki").value=XmlHttp.responseText; 
	                             if(TabValue=='2')
	                             {
	                                 SpecialOffer(XmlHttp.responseText,type,true); 
	                             }    	                      
	                        }
	                    }
	                    else if(req=="H")
	                    {
	                        if(type=='0')
	                        {
	                         _$("ctl00_plhBody_hdnBeachDODXml").value=XmlHttp.responseText;
	                             if(TabValue=='0')
	                             {
	                                HomeDealOfDay(XmlHttp.responseText,true,type);	                            
	                             }                        
                             }
                             else if(type=='1')
                             {
                               _$("ctl00_plhBody_hdnCityVFXml").value=XmlHttp.responseText;
                               if(TabValue=='1')
	                             {
	                                HomeVF(XmlHttp.responseText,true,type); 
	                             }
                              }
                              else 
                              {
                                 _$("ctl00_plhBody_hdnSkiVFXml").value=XmlHttp.responseText;
                                  if(TabValue=='2')
	                             {
	                                HomeVF(XmlHttp.responseText,true,type); 
	                             }                               
                               }
	                    }
	                    else if(req=="FD")
	                    {	                        
	                        if(type=='0')
	                        {
	                            _$("ctl00_Footer1_hdnBeachFD").value=XmlHttp.responseText;
	                           if(TabValue=='0')
	                           {
	                             FeaturedDestination(XmlHttp.responseText,type); 
	                           }	                            
	                        }
	                        else if(type=='1')
	                        {	                          
	                            _$("ctl00_Footer1_hdnCityFD").value=XmlHttp.responseText; 
	                            if(TabValue=='1')
	                           {
	                             FeaturedDestination(XmlHttp.responseText,type); 
	                           }    	                       
	                        }
	                       else 
	                        {	                           
	                            _$("ctl00_Footer1_hdnSkiFD").value=XmlHttp.responseText; 
	                            if(TabValue=='2')
	                           {
	                             FeaturedDestination(XmlHttp.responseText,type); 
	                           }    	                         
	                        }
	                    }
	                    else if(req=="CF")
	                    {
	                        if(type=='0')
	                        {
	                           _$("ctl00_plhBody_hdnCFavBeach").value=XmlHttp.responseText;
	                         if(TabValue=='0')
	                             {
	                               CustomerFavourites(XmlHttp.responseText,type); 
	                             }                           
	                        }
	                        else if(type=='1')
	                        {
	                            _$("ctl00_plhBody_hdnCFavCity").value=XmlHttp.responseText;
	                             if(TabValue=='1')
	                             {
	                               CustomerFavourites(XmlHttp.responseText,type); 
	                             }
	                        }	
	                        else
	                        {
	                            _$("ctl00_plhBody_hdnCFavSki").value=XmlHttp.responseText;
    	                          if(TabValue=='2')
	                             {
	                               CustomerFavourites(XmlHttp.responseText,type); 
	                             }	
	                        }
	                    }
	                    else if(req=="TRF")
	                    {
	                        _$("ctl00_plhBody_hdnTrfRes").value=XmlHttp.responseText;
	                        transfer(XmlHttp.responseText);
	                    }
	                    else if(type=="DIDYOUMEAN")
	                    {
	                          SetMeanDestination(XmlHttp.responseText); 
	                    }	                
	                }	                
                }
                var sPath = window.location.pathname;
                var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
                if(sPage!="PriceResult.aspx")
                {
                  sFooter();                  
                }
	        }    		
		    XmlHttp.open("GET", requestUrl,  true);    		
		    XmlHttp.send(null);	
	     }    
}
function SpecialOffer(_OfferXml,type,_sflag)
{
    var div , a , img , div1, table, tbdy,div3,div4,div5,spn,img1,frwd,bkwd,lnkdiv,smDiv,linkref;
    var _ndOffer,_nddesc,_ndOffers;              
    if(_OfferXml!="")
    {
       if(CheckForValidObject(_OfferXml))
       {
           if(type=='0')
            {
                _$("ctl00_plhBody_hdnSpOfferBeach").value="";
                _$("ctl00_plhBody_hdnSpOfferBeach").value=_OfferXml;
            }
            else if(type=='1')
            {
                _$("ctl00_plhBody_hdnSpOfferCity").value="";
                _$("ctl00_plhBody_hdnSpOfferCity").value=_OfferXml;
            }
            else
            {
                _$("ctl00_plhBody_hdnSpOfferSki").value="";
                _$("ctl00_plhBody_hdnSpOfferSki").value=_OfferXml;
            }
            var _xmlDoc = Sarissa.getDomDocument();               
            _xmlDoc = (new DOMParser()).parseFromString(_OfferXml, "text/xml");            
            _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
            _xmlDoc.setProperty("SelectionLanguage", "XPath");
            _ndOffers = _xmlDoc.selectNodes("Ofs/DV");
            if(type=='0')
            {
                beachOffLen=_ndOffers.length-1;
            }
            else if(type=='1')
            {
                cityOffLen=_ndOffers.length-1;
            }
            else
            {
                skiOffLen=_ndOffers.length-1;
            }
            if(_ndOffers.length > 0)
             {  
                if(count <= _ndOffers.length-1)
                {  
                    _ndOffer=_ndOffers[count].selectSingleNode("I");
                    _nddesc =_ndOffers[count].selectSingleNode("TI");
                    
                    div=_$("beach_offer");                                  
                    img=_$('image');
                    if(CheckForValidObject(_ndOffer))
                    {
                        if(_ndOffer.getAttribute("u")!="")
                        {
                            img.src=_ndOffer.getAttribute("u").replace("&amp;","&");
                        }
                        img.title=_ndOffer.getAttribute("n");
                        img.alt=_ndOffer.getAttribute("a");
                        img.width='564';
                        img.height='210';
                        a=document.createElement('A');
                        linkref = "/Search/cheap-hotels/"+(RepSpecialChar(_nddesc.getAttribute("hname"))).replace(/ /g,'-').replace(/&/g,'and')+"/"+_nddesc.getAttribute("hid")+"-"+type+".aspx";
                        a.href= linkref;
                        a.appendChild(img);
                        div.appendChild(a);
                    }
                    div1=_$("Content");
                    div1.innerHTML="";
                     if ( div1.hasChildNodes())
                     {
                         while ( div1.childNodes.length >= 1 )
                         { 
                            div1.removeChild( div1.firstChild ); 
                         } 
                     }
                    div1.className='ampliar_horz';
                    var a2=document.createElement('A');
                    a2.href= linkref;
                    a2.style.textDecoration='none';
                    div5=document.createElement('div');
                    div5.className="contentDiv";
                    div5.style.cursor = 'hand';
                    var lbl=document.createElement('Label');
                    lbl.className="offer_main_text";
                    lbl.innerHTML=_nddesc.getAttribute("t");
                    div5.appendChild(lbl);
                    smDiv=document.createElement('DIV');
                    smDiv.className="offer_small_text";
                    spn=document.createElement('Span');
                    spn.style.color="#FED100";
                    if(_nddesc.getAttribute("cr")!="")
                    {
                        spn.innerHTML="<BR>"+"User rating "+parseInt(_nddesc.getAttribute("cr"))+"% ";
                    }
                    else
                    {
                        spn.innerHTML="<BR>"+"User rating 0% ";
                    }
                    smDiv.appendChild(spn);
                    div5.appendChild(smDiv);
                    smDiv.innerHTML +="&nbsp;"+_nddesc.getAttribute("r")+" star,  ";
                    smDiv.innerHTML +="&nbsp;"+_nddesc.getAttribute("b")+"  ";
                    div5.appendChild(smDiv);
                    a2.appendChild(div5);
                    div1.appendChild(a2);
                    var a3=document.createElement('A');
                    a3.href= linkref;
                    a3.style.textDecoration = 'none' ;
                    div3=document.createElement('div');
                    div3.className="price";
                    div3.style.cursor = 'hand';
                    div3.innerHTML +="from only<br>"+ "&pound;"+parseFloat(_nddesc.getAttribute("p")).toFixed(2)+"&nbsp;";
                    a3.appendChild(div3);
                    div1.appendChild(a3);
        	        
        	        if(_sflag==false)
			        {
			            if(_ndOffers.length > 1)
			            {
	                        div4=document.createElement('DIV');
	                        div4.className="price_icon";
	                        a=document.createElement('A');
	                        a.href="javascript: NextOffer('"+type+"');";
                	       
			                img1=document.createElement('IMG');
		                    img1.src="images/homepage/offer_button.gif";
		                    a.appendChild(img1);
			                div4.appendChild(a);
			                div1.appendChild(div4);
			            }
   			        }
       	           div.appendChild(div1);
			    }
           if(_sflag==true)
           {
               if(count > _ndOffers.length-1)
               {
                    _sflag=false;
                    if(type=='0')
                    {   
                         clearTimeout(s1);
                         count=0;
                         SpecialOffer(_$("ctl00_plhBody_hdnSpOfferBeach").value,0,false);
                    }
                    else if(type=='1')
                    {
                         clearTimeout(s2);
                         count=0;
                         SpecialOffer(_$("ctl00_plhBody_hdnSpOfferCity").value,1,false);
                    }
                    else
                    {
                         clearTimeout(s3);
                          count=0;
                         SpecialOffer(_$("ctl00_plhBody_hdnSpOfferSki").value,2,false);
                    }
               }
               else
               {
                count=count+1;
               }
            }
            if(_sflag==true)
            {
                if(type=='0')
                {
                    f1 = function() {SpecialOffer(_$("ctl00_plhBody_hdnSpOfferBeach").value,type,true); };
                    s1= setTimeout(f1,3000);
                }
                else if(type=='1')
                {
                    f2 = function() {SpecialOffer(_$("ctl00_plhBody_hdnSpOfferCity").value,type,true); };
                    s2=setTimeout(f2,3000); 
                }
                else
                {
                    f3 = function() {SpecialOffer(_$("ctl00_plhBody_hdnSpOfferSki").value,type,true); };
                    s3= setTimeout(f3,3000);  
                }
            }
         }
      }    
  } 
}
function NextOffer(type)
{   
    if(type=='0')
    {
        if(count>=beachOffLen)
        {
            count=0;
        }
        else
        {
            count+=1;
        }
        SpecialOffer(_$("ctl00_plhBody_hdnSpOfferBeach").value,0,false);
    }
    else if(type=='1')
    {
        if(count>=cityOffLen)
        {
            count=0;
        }
        else
        {
            count+=1;
        }                   
        SpecialOffer(_$("ctl00_plhBody_hdnSpOfferCity").value,1,false);
    }
   else 
    {
        if(count>=skiOffLen)
        {
            count=0;
        }
        else
        {
            count+=1;
        }           
         SpecialOffer(_$("ctl00_plhBody_hdnSpOfferSki").value,2,false);
    }
}
//NOT IN USE
// Function for Move the SpecialOffer Forcly by the Next  Button
function LastOffer(type)
{    
    if(type=='0')
    {
        if(count==0)
        {
            count=beachOffLen;
        }
        else
        {
            count-=1;
        }
        SpecialOffer(_$("ctl00_plhBody_hdnSpOfferBeach").value,0,false);
    }
    else if(type=='1')
    {
        if(count==0)
        {
            count=cityOffLen;
        }
        else
        {
            count-=1;
        }                   
        SpecialOffer(_$("ctl00_plhBody_hdnSpOfferCity").value,1,false);
    }
    else 
    {
        if(count==0)
        {
            count=skiOffLen;
        }
        else
        {
            count-=1;
        }          
         SpecialOffer(_$("ctl00_plhBody_hdnSpOfferSki").value,2,false);
    }
}
function HomeDealOfDay(_dodXml,flag,type)
{
    _$("best_deals_tab").innerHTML = '';
    _$("best_deals_tab").appendChild(document.createTextNode("Value Finder"));
    var tbody,trHeading,tdhead,trRecord,tdRecord,div,a,div1,ratingDiv,tr,td;
    if(_dodXml!="")
    {
       if(CheckForValidObject(_dodXml))
       {
            if(flag==true && type==0)
            {
                _$("ctl00_plhBody_hdnBeachDODXml").value=_dodXml;
            }           
            var _xmlDoc = Sarissa.getDomDocument();
            _xmlDoc = (new DOMParser()).parseFromString(_dodXml, "text/xml");            
            _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
            _xmlDoc.setProperty("SelectionLanguage", "XPath");    
         
            var _ndDofDays, _ndDeal;
            var minMaxNode,min,max;
            _ndDofDays = _xmlDoc.selectNodes("DoD/D");          
                if(_ndDofDays.length > 0)
                {
                    var mainDiv=_$("test");
                    mainDiv.className = "show";
                    if(_$("VF_CSDiv")!=null)
                    {
                        _$("VF_CSDiv").innerHtml = "";                       
                        _$("VF_CSDiv").style.display = "none";           
                    }                   
                     var myMonths=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
                     var chkMonths=new Array();
                     var   today=new Date();
                     thisMonth=today.getMonth();
                     if(type=='0')
                     {
                        div = _$("DealofDay");
                     }                                   
                     if ( div.hasChildNodes())
                     {
                         while ( div.childNodes.length >= 1 )
                         { 
                            div.removeChild( div.firstChild ); 
                         } 
                     }                                  
                     var  table=document.createElement('TABLE');
                     table.border='0';
                     table.cellPadding = '5';
                     table.cellSpacing = '0';
                     table.id="table";
                     table.className="offer_results";
                     tbdy=document.createElement('TBODY');
                     table.border ="0";
                     table.appendChild(tbdy);    
                     div.appendChild(table);
                    
                     trHeading=document.createElement('TR');
                     trHeading.className="offer_row_alt";
                     tbdy.appendChild(trHeading);
                     td=document.createElement('TD');
                     td.colSpan='4';
                     td.align='Left';
                     td.height='22px';
                     td.innerHTML="<strong>Destination</strong>";
                     trHeading.appendChild(td);
                     for(var i=0; i<=5; i++)
                       {
                          tdhead=document.createElement('TD');
                           tdhead.colSpan='4';
                           tdhead.align='Left';
                           tdhead.height='22px';  
                           var newMonth=thisMonth+i;
                           if(newMonth > 11)
                           {
                            newMonth=newMonth-12;
                           } 
                            
                           tdhead.innerHTML="<strong>"+ myMonths[newMonth]+"</strong>";
                          
                           trHeading.appendChild(tdhead);                         
                       } 
                       
                        for(var _rCount=0; _rCount < _ndDofDays.length; _rCount++)
                        {                      
                           var _destId="";
                           var ndDofMonths="";
                           var destName = _ndDofDays[_rCount].getAttribute("n"); 
                           var _rId = _ndDofDays[_rCount].getAttribute("rid"); 
                           var _aId=_ndDofDays[_rCount].getAttribute("aid"); 
                           var _rlId=_ndDofDays[_rCount].getAttribute("rlid");
                          var Dname = RepSpecialChar(destName);                        
                            var _type="";
                           if(_rlId=='-1' || _rlId==null)
                           {
                            _type= "Area";
                            _destId =_rId+"|"+_aId+"|"+"0"+"|"+_type+"|"+type;
                           }
                           else
                           {
                             _type= "Resort";
                             _destId=_rId+"|"+_aId+"|"+_rlId+"|"+_type+"|"+type;
                           }
                            
                           trRecord=document.createElement('TR');
                            if(_rCount%2==0)
                            {
                            trRecord.className="offer_row";
                            }
                            else
                            {
                            trRecord.className="offer_row_alt";
                            }
                           tbdy.appendChild(trRecord);
                           td=document.createElement('TD');
                           td.colSpan='4';
                           td.align='Left';
                           td.height='22px';
                           td.appendChild(document.createTextNode(Dname));

                           trRecord.appendChild(td);
                           var hId,Pr,prMonth,cd; 
                           var month=thisMonth+1;
                           for(var i=1; i<=6; i++)
                            {
                                var newMonth=thisMonth+i;
                               if(newMonth > 12)
                               {
                                newMonth=newMonth-12;
                               } 
                              ndDofMonths=  parseXml(type,destName,newMonth);
                              if( CheckForValidObject(ndDofMonths))
                               {
                                   hId=ndDofMonths.getAttribute("hid");
                                   Pr=ndDofMonths.getAttribute("p");
                                   prMonth=ndDofMonths.getAttribute("dt");
                                   cd=ndDofMonths.getAttribute("date");
                                   td=document.createElement('TD');
                                   td.colSpan='4';
                                   td.align='left';
                                   td.height='22px';
                                   a=document.createElement('A');
                                   a.innerHTML="&pound;"+Pr;
                                   a.href="PriceResult.aspx?id="+hId+"&month="+prMonth+"&aid=1&cd="+cd+"&tab="+type+"&type="+_type; //added type by vijay 10-july-2009
                                   td.appendChild(a);
                                   trRecord.appendChild(td);
                               }
                               else
                               {
                                     Pr="-";
                                     td=document.createElement('TD');
                                     td.colSpan='4';
                                     td.align='Left';
                                     td.height='22px';
                                     td.innerHTML=Pr;
                                     trRecord.appendChild(td);
                               }
                           }                           
                        }                   
             }
        }                  
    }                
}
function HomeVF(_dodXml,flag,type)
{
    _$("best_deals_tab").innerHTML = '';
    _$("best_deals_tab").appendChild(document.createTextNode("Recommended Hotels"));    
    var div,hr,div1,p,spn,br,img,div2,div3,a,div4,div5,mainDiv,destDiv,div6,li,hid,lon,lat,aId,rId,rlId,lnkID,type;
    if(_dodXml!="")
    { 
        _$("ctl00_plhBody_hdnVF").value = _dodXml;      
        var _xmlDoc = Sarissa.getDomDocument();               
        _xmlDoc = (new DOMParser()).parseFromString(_dodXml, "text/xml");        
        _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
        _xmlDoc.setProperty("SelectionLanguage", "XPath");        
        if(CheckForValidObject(_xmlDoc))
        {
            var _ndCFavs,_ndDestCFavs;
            _ndCFavs = _xmlDoc.selectNodes("VFs/H");
            
            mainDiv=_$("best_deals_box");
            
            if ( mainDiv.hasChildNodes())
            {
                _$("test").className = "hide";                
            }
           if(_ndCFavs.length >0)
            {            
                if(_$("VF_CSDiv") != null)
                {
                    var outDiv = _$("VF_CSDiv");
                    if(outDiv.hasChildNodes())
                    {
                        _$("VF_CSDiv").style.display = "block";
                        while ( outDiv.childNodes.length >= 1 )
                         { 
                            outDiv.removeChild( outDiv.firstChild ); 
                         } 
                    }
                }
                else
                {
                    var outDiv=document.createElement("div");
                    outDiv.id="VF_CSDiv";   
                }
                for(_cfCount=0; _cfCount<_ndCFavs.length;_cfCount++)
                {
                        lon=_ndCFavs[_cfCount].getAttribute("x");
                        lat=_ndCFavs[_cfCount].getAttribute("y");                
                        div=document.createElement('DIV');
                        div.id="cusFav"+_cfCount;
                        div.className="result_desc";
                        if(_cfCount!=0)
                        {
                            hr=document.createElement('hr');
                            hr.style.color="#DFDFDF";
                            hr.size="1";
                            div.appendChild(hr);
                        }                        
                        div1=document.createElement('DIV');
                        div1.className="accomm_name";
                        p=document.createElement('P');
                        var _rName=RepSpecialChar(_ndCFavs[_cfCount].getAttribute("rnm"));
                        var _aName=RepSpecialChar(_ndCFavs[_cfCount].getAttribute("anm"));                       
                        rId=_ndCFavs[_cfCount].getAttribute("rid");
                        aId=_ndCFavs[_cfCount].getAttribute("aid");                        
                        var rar=document.createTextNode(_rName);
                        p.appendChild(rar);                                                
                        a=document.createElement('A');                        
                        if(_aName!="")
                        {
                            p.appendChild(document.createTextNode(" > "));
                            a.href="/Search/city-breaks/"+_rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+_aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aId+"-"+type+".aspx";
                            a.innerHTML= _aName;                            
                        }                       
                        p.appendChild(a);                 
                        div1.appendChild(p);                       
                        spn=document.createElement('SPAN');
                        a=document.createElement('A');
                        hName=RepSpecialChar(_ndCFavs[_cfCount].getAttribute("n"));
                        hName=RepSpecialChar(hName);
                        a.innerHTML=hName;
                        hid=_ndCFavs[_cfCount].getAttribute("hid");
                        a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                        spn.appendChild(a);
                        div1.appendChild(spn);
                        br=document.createElement('BR');
                        div1.appendChild(br);                        
                         spn=document.createElement('SPAN');
                         spn.className="rating_wrapper";                         
                         var rating=_ndCFavs[_cfCount].getAttribute("r");
                         if(rating>0)
                         {
                             for(ratCount=0; ratCount<rating; ratCount++)
                             {
                                img=document.createElement('IMG');
                                img.style.marginTop='5px';
                                img.src="images/results/icons/star.gif";
                                spn.appendChild(img);                                
                             }
                         }
                         div1.appendChild(spn);
                         div.appendChild(div1);
                         
                         if(_ndCFavs[_cfCount].getAttribute("rvs")!="" && _ndCFavs[_cfCount].getAttribute("rvs")!="0")
                         {        
                              div2=document.createElement('DIV');
                              div2.className="rating_blue_box";
                              p=document.createElement('P');

                              var  text = document.createTextNode("Average customer rating");                      
                              p.appendChild(text);
                              div2.style.cursor="hand";
                              div2.appendChild(p);
                              var cusRating=_ndCFavs[_cfCount].getAttribute("cr");
                              var cusReviews=_ndCFavs[_cfCount].getAttribute("rvs");
                              var reviewLink=ReviewWindow(cusRating,cusReviews);
                              reviewLink.appendChild(div2);
                             
                              p=document.createElement('P');
                              spn=document.createElement('SPAN');
                              spn.innerHTML=parseInt(_ndCFavs[_cfCount].getAttribute("cr"))+"%&nbsp;";
                              p.appendChild(spn);                             
                            
                               if(_ndCFavs[_cfCount].getAttribute("rvs")!="")
                               {
                                  var  text1 = document.createTextNode(_ndCFavs[_cfCount].getAttribute("rvs")+" reviews");
                               }
                               else
                               {
                                   var  text1 = document.createTextNode(" 0 reviews"); 
                               }
                              p.appendChild(text1);
                              div2.appendChild(p);
                              div.appendChild(reviewLink);                              
                              
                          }                         
                          if(_ndCFavs[_cfCount].getAttribute("lp")!="" && _ndCFavs[_cfCount].getAttribute("lp")!="0.00")
                          {
                                div3=document.createElement('DIV');
                                div3.className="blue_price";                            
                                div3.innerHTML="from &pound;<strong>"+parseFloat(_ndCFavs[_cfCount].getAttribute("lp")).toFixed(2)+"</strong>&nbsp;pppn";
                                div.appendChild(div3);
                           }
                            
                           var _ndImage=_ndCFavs[_cfCount].selectSingleNode("Is/I");
                           if(CheckForValidObject(_ndImage))
                           {
                            
                                div4=document.createElement('DIV');
                                div4.className="accomm_pic";
                                a=document.createElement('A');
                                img=document.createElement('IMG');                                
                                if(_ndImage.getAttribute("u")!="")
                                img.src=_ndImage.getAttribute("u").replace("&amp;","&");
                                else
                                img.src = '/Search/images/1/noimage_106x80.gif';                                 
                                img.style.width = "165px";
                                img.style.height = "123px";
                                a.appendChild(img);
                                a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                                div4.appendChild(a);
                                div.appendChild(div4);                                
                            }
                            else
                            {
                                 div4=document.createElement('DIV');
                                div4.className="accomm_pic";
                                a=document.createElement('A');
                                img=document.createElement('IMG');
                                img.src='\Search\Images\Homepage\no_image.gif';
                                img.title=_ndImage.getAttribute("n");
                                img.alt=_ndImage.getAttribute("a");
                                a.appendChild(img);
                                a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                                div4.appendChild(a);
                                div.appendChild(div4);
                             }
                            
                           div5=document.createElement('DIV');
                           div5.className="accomm_desc";
                           p=document.createElement('P');
                           var descp=_ndCFavs[_cfCount].getAttribute("d");
                           var desc =document.createTextNode(RepSpecialChar(descp));
                           var moreInfoLink=document.createElement('a');
                           moreInfoLink.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                           moreInfoLink.innerHTML="more info"; 
                           p.appendChild(desc);
                           p.appendChild(moreInfoLink);
                           div5.appendChild(p);
                           
                           p=document.createElement('P');
                           var _ndFacl=_ndCFavs[_cfCount].selectNodes("F");
                           var keys="";
                           for(fCount=0;fCount<_ndFacl.length; fCount++)
                           {
                              keys += _ndFacl[fCount].getAttribute("k").toLowerCase()+",";
                           }
                           if(keys.search(/kid/)!=-1)
                           {
                                img=document.createElement('IMG');
                                img.src="images/results/icons/kids_club.gif";
                                p.appendChild(img);
                                p.appendChild(document.createTextNode('\u00a0'));
                                div5.appendChild(p);
                           }
                            
                           if(keys.search(/sport/)!=-1)
                           {
                                 img=document.createElement('IMG');
                                 img.src="images/results/icons/football.gif";
                                    p.appendChild(img);
                                     div5.appendChild(p);
                           }
                               
                           if(keys.search(/beach/)!=-1)
                           {
                                    img=document.createElement('IMG');
                                    img.src="images/results/icons/beach.gif";
                                    p.appendChild(img);
                                     div5.appendChild(p);
                           }
                             
                           if(keys.search(/golf/)!=-1)
                           {
                                    img=document.createElement('IMG');
                                    img.src="images/results/icons/golf.gif";
                                    p.appendChild(img);
                                     div5.appendChild(p);
                           }
                           if(keys.search(/fourbed/)!=-1)
                           {
                                    img=document.createElement('IMG');
                                    img.src="images/results/icons/four_bed.gif";
                                    p.appendChild(img);
                                     div5.appendChild(p);
                           }
                           if(keys.search(/spa/)!=-1)
                           {
                                    img=document.createElement('IMG');
                                    img.src="images/results/icons/spa.gif";
                                    p.appendChild(img);
                                    p.appendChild(document.createTextNode('\u00a0'));
                                     div5.appendChild(p);                                     
                           } 
                           if(_ndCFavs[_cfCount].getAttribute("aid") == '500')
                           {
                                img=document.createElement('IMG');
                                img.src = "/Search/Images/results/icons/free-transfer-icon.png";
                                //img.alt = "All holidays to Sharm El Sheik receive a free transfer from the airport to resort";
                                img.title = "All holidays to Sharm El Sheik receive a free transfer from the airport to resort";
                                p.appendChild(img);
                                div5.appendChild(p);  
                           }                           
                           br=document.createElement('BR');
                           div5.appendChild(br);
                           a=document.createElement('A');
                           a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                           var imgMoreInfo=document.createElement('IMG');
                          imgMoreInfo.title = "View More Details";
                          imgMoreInfo.src="/Search/Images/results/icons/hotelinfo_icon.gif";
                          a.appendChild(imgMoreInfo);
                           div5.appendChild(a);
                           a=document.createElement('A');
                            a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                            a.innerHTML = "More info&nbsp;";
                            div5.appendChild(a); 
                           
                           if(_ndCFavs[_cfCount].getAttribute("ist")=="1")
                           {
                               var rgId="";
                               var arId="";
                               var rsId="";
                               rgId=_ndCFavs[_cfCount].getAttribute("rid");
                               arId=_ndCFavs[_cfCount].getAttribute("aid");
                               rsId=_ndCFavs[_cfCount].getAttribute("rlid");
                              var id=rgId+","+arId+","+rsId;
                                 
                               a=document.createElement('A');
                               a.href="javascript:trfrequest("+rgId+","+arId+","+rsId+")";
                               var imgTrfInfo=document.createElement('IMG');
                               imgTrfInfo.title = "View Transfer Info";
                               imgTrfInfo.src="/Search/Images/results/icons/transfer_icon.gif";
                               a.appendChild(imgTrfInfo);
                               div5.appendChild(a);
                               a=document.createElement('A');
                               a.href="javascript:trfrequest("+rgId+","+arId+","+rsId+")";
                               a.innerHTML = "Transfers&nbsp;";
                               div5.appendChild(a);
                           }      
                           if(parseFloat(lon) != 0 && parseFloat(lat) != 0 && lon!="" && lat!="")
                           {
                               a=document.createElement('A');
                               a.href="javascript:ViewMapVF("+hid+")";
                               var imgMapInfo=document.createElement('IMG');
                               imgMapInfo.title= "View Map";
                               imgMapInfo.src="/Search/Images/results/icons/map_icon.gif";
                               a.appendChild(imgMapInfo);
                               div5.appendChild(a);
                               a=document.createElement('A');
                               a.href="javascript:ViewMapVF("+hid+")";
                               a.innerHTML = "View Map";
                               div5.appendChild(a);
                            }
                           div.appendChild(div5);
                           outDiv.appendChild(div);
                        }
                        mainDiv.appendChild(outDiv);
                  }              
           }
        }
  }        
function FilterDOD(type)
{
    var _xml,_resortId;    
    if(type==0)
    {
        _xml=_$("ctl00_plhBody_hdnBeachDODXml").value;       
    } 
    HomeDealOfDay(_xml,false,type);
}
function parseXml(type,destName,month)
{
    var _xml;
    if(type==0)
    {
        _xml=_$("ctl00_plhBody_hdnBeachDODXml").value;       
    }    
    var _xmlDoc = Sarissa.getDomDocument();               
    _xmlDoc = (new DOMParser()).parseFromString(_xml, "text/xml");    
    _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
    _xmlDoc.setProperty("SelectionLanguage", "XPath");    
     var _xmlNode,startSet,endSet;
     var _minR = _$("hdnMinP").value;
     var _maxR = _$("hdnMaxP").value;
     if(_minR=="" || _minR==null || _maxR=="" || _maxR==null)
     {
        startSet =50;
        endSet =100;
     }
     else
     {
        if(_minR<51 ){startSet=50;}
        if(_maxR < 51){endSet=50;}
        if(_minR>50 && _minR<61){startSet=51;}
        if(_maxR>50 && _maxR<61){endSet=60;}
        if(_minR>60 && _minR<71){startSet=61;}
        if(_maxR>60 && _maxR<71){endSet=70;}
        if(_minR>70 && _minR<81){startSet=71;}
        if(_maxR>70 && _maxR<81){endSet=80;}
        if(_minR>80 && _minR<91){startSet=81;}
        if(_maxR>80 && _maxR<91){endSet=90;}
        if(_minR>90 && _minR<101){startSet=91;}
        if(_maxR>90 && _maxR<101){endSet=100;}
     }   
     var _ndDofDays, _ndDeal,xPath;
    _ndDofDays = _xmlDoc.selectNodes("DoD/D");
    xPath="DoD/D";
    var arr=new Array();
     if(CheckForValidObject(_ndDofDays))
            {  
                if(_ndDofDays.length > 0)
                {
                          var arr=new Array();                             
                          var _xml1=_xmlDoc.selectSingleNode(xPath+"[@n='"+ destName+"']");                          
                          var _xml2 = _xml1.selectNodes("DV[@r <= '"+parseInt(endSet)+"' and @r >= '"+parseInt(startSet)+"' and @dt='"+parseInt(month)+"']");                          
                          for(var count=0; count<_xml2.length; count++)
                          {
                            arr[count]=_xml2[count].getAttribute("p");
                          }                          
                          arr.sort(sortNumber);
                          var minPr=arr[0];                                                                           
                          var _xmlNode= _xml1.selectSingleNode("DV[@r <= '"+parseInt(endSet)+"' and @r >= '"+parseInt(startSet)+"' and  @p='"+minPr+"' and @dt='"+parseInt(month)+"']");                        
                 }
           }
      
     return _xmlNode;
}
function sortNumber(a,b) { return a - b; }
function FeaturedDestination(_fdXml,type)
{
    var ul,li,dName;
    var div=_$("FeatureDest");
    if(_fdXml!="")
    {        
        var _xmlDoc = Sarissa.getDomDocument();               
        _xmlDoc = (new DOMParser()).parseFromString(_fdXml, "text/xml");        
        _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
        _xmlDoc.setProperty("SelectionLanguage", "XPath");     
        var _ndFDests;
        _ndFDests = _xmlDoc.selectNodes("FDs/FD");
            if(CheckForValidObject(_ndFDests))
            {  
                if(_ndFDests.length >0)
                {
                         if ( div.hasChildNodes())
                         {
                             while ( div.childNodes.length >= 1 )
                             { 
                                div.removeChild( div.firstChild ); 
                             } 
                         }                   
                         var  table=document.createElement('TABLE');
                         table.border='0';
                         table.cellPadding = '0';
                         table.style.width='100%';
                         table.cellSpacing = '0';
                         table.id="table";                        
                         tbdy=document.createElement('TBODY');
                         table.border ="0";
                         table.appendChild(tbdy);    
                         div.appendChild(table);
                         tr=document.createElement('TR');
                         tr.style.width='100%';
                         tr.valign='top';
                         tbdy.appendChild(tr);
                         for(var count=0; count <_ndFDests.length; count++)
                         {
                             td=document.createElement('TD');
                             td.style.width='25%';
                             td.colSpan='4';
                             td.align='left';
                             li=document.createElement('LI');
                             li.className="destination_item";
                             li.style.width='100%';
                             a=document.createElement('A');
                             rName=RepSpecialChar(_ndFDests[count].getAttribute("rn"));
                             aName=RepSpecialChar(_ndFDests[count].getAttribute("an"));
                             rlName=RepSpecialChar(_ndFDests[count].getAttribute("rln"));                             
                             var aid=_ndFDests[count].getAttribute("aid");
                             var rid=_ndFDests[count].getAttribute("rid");
                             var rlid=_ndFDests[count].getAttribute("rlid");
                             var rarType=_ndFDests[count].getAttribute("t");
                             if(rarType=="Beach")
                             {
                                if(_$("ctl00_plhBody_hdndomain")!=null)
                                    a.href=_$("ctl00_plhBody_hdndomain").value+"/Search/beach-holiday/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlid+"-"+type+".aspx";
                                else
                                    a.href="/Search/beach-holiday/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlid+"-"+type+".aspx";
                                a.innerHTML=destLen(rlName);
                             }
                             else
                             {
                                if(_$("ctl00_plhBody_hdndomain")!=null)
                                    a.href=_$("ctl00_plhBody_hdndomain").value+"/Search/city-breaks/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aid+"-"+type+".aspx";
                                else
                                    a.href="/Search/city-breaks/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aid+"-"+type+".aspx";
                                a.innerHTML=destLen(aName);
                             }
                             li.appendChild(a);
                             td.appendChild(li);
                             tr.appendChild(td);
                              if(count != 0)
                              {
                                if(count%4==0)
                                {
                                    tr=document.createElement('TR');
                                    tbdy.appendChild(tr);
                                 }
                               }
                               tr.appendChild(td);
                         }                    
                }      
         }
    }
    else
    {
        if ( div.hasChildNodes())
         {
             while ( div.childNodes.length >= 1 )
             { 
                div.removeChild( div.firstChild ); 
             } 
         }
    }
}
var beach_tab = _$("beach_tab_link");
var city_tab =  _$('city_tab_link');
//var ski_tab= _$('ski_tab_link');
function Beach()
{
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    if(sPage=="HomePage.aspx")
    {
        if(_$("skiset2") != null) {_$("skiset2").style.display="none";}
        if(_$("ctl00_plhBody_hdnSpOfferBeach").value == '' || _$("ctl00_plhBody_hdnBeachDODXml").value == '' || _$("ctl00_Footer1_hdnBeachFD").value == '')//Code removed by Irshad 10-06-09 _$("ctl00_plhBody_hdnCFavBeach").value == '' ||
        {
            _$("ctl00_plhBody_hdnTabValue").value="";
            _$("ctl00_plhBody_hdnTabValue").value = "0";
            clearTimeout(s2);
            clearTimeout(s3);
            HomePageCall();
            footerCall(0);            
        }
        else
        {                   
            var parameter='0';     
            beach_tab.className="active_tab";
            //ski_tab.className="inactive_tab_right";
            city_tab.className="inactive_tab_right";        
            clearTimeout(s2);
            clearTimeout(s3);
            SpecialOffer(_$("ctl00_plhBody_hdnSpOfferBeach").value,parameter,true);     
            HomeDealOfDay( _$("ctl00_plhBody_hdnBeachDODXml").value,false,parameter);     
            FeaturedDestination(_$("ctl00_Footer1_hdnBeachFD").value,parameter);
            var dealDiv=_$("test");
            dealDiv.className="show";
            var Blabel=_$("price_label");
            Blabel.className="border";
            var pselect = _$("price_select"); 
            pselect.className = 'show';                     
            InitiliazeSlider('price_label','price_select','min_slider','max_slider',(50),(100),'0'); 
            _$("ctl00_plhBody_hdnTabValue").value=0;
            return false;
         }
    }
    else
    {
        var tabVal='0';
        document.frmTabVal.target='_self';
        document.frmTabVal.hdnTabVal.value =tabVal;
        document.frmTabVal.method = "POST";
        if(_$("ctl00_plhBody_hdndomain")!=null)
            document.frmTabVal.action = _$("ctl00_plhBody_hdndomain").value + "/Search/HomePage.aspx";                            
        else
            document.frmTabVal.action = "/Search/HomePage.aspx";
        document.frmTabVal.submit();        
    }       
}
function City()
{
    checkloadjsfile('/Search/JavaScript/MapPopup.js');
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    if(sPage=="HomePage.aspx")
    {    
        if(_$("skiset2") != null) {_$("skiset2").style.display="none";} 
        if(_$("ctl00_plhBody_hdnSpOfferCity").value == "" || _$("ctl00_plhBody_hdnCityVFXml").value== "" ||_$("ctl00_plhBody_hdnCFavCity").value=="" ||_$("ctl00_Footer1_hdnCityFD").value=="")
        {
            _$("ctl00_plhBody_hdnTabValue").value="";
            _$("ctl00_plhBody_hdnTabValue").value = "1";            
            clearTimeout(s1);
            clearTimeout(s3);
            HomePageCall();
            footerCall(1);
            _$("ctl00_plhBody_hdnVF").value = _$("ctl00_plhBody_hdnCityVFXml").value;
        }
        else
        {
            var parameter1=1;         
            city_tab.className="active_tab";
            beach_tab.className="inactive_tab";
            //ski_tab.className="inactive_tab_right";                   
            clearTimeout(s1);
            clearTimeout(s3);      
            SpecialOffer(_$("ctl00_plhBody_hdnSpOfferCity").value,parameter1,true);          
            HomeVF( _$("ctl00_plhBody_hdnCityVFXml").value,false,parameter1);         
            FeaturedDestination(_$("ctl00_Footer1_hdnCityFD").value,'1');          
            CustomerFavourites( _$("ctl00_plhBody_hdnCFavCity").value,'1');          
            _$("ctl00_plhBody_hdnTabValue").value="";
            _$("ctl00_plhBody_hdnTabValue").value=1;
            _$("ctl00_plhBody_hdnVF").value = _$("ctl00_plhBody_hdnCityVFXml").value;
            return false;
        }        
    }
    else
    {
        var tabVal='1';
        document.frmTabVal.target='_self';
        document.frmTabVal.hdnTabVal.value =tabVal;
        document.frmTabVal.method = "POST";
        if(_$("ctl00_plhBody_hdndomain")!=null)
            document.frmTabVal.action = _$("ctl00_plhBody_hdndomain").value + "/Search/HomePage.aspx";                            
        else
            document.frmTabVal.action = "/Search/HomePage.aspx";
        document.frmTabVal.submit();
    }   
}
function Ski()
{
    checkloadjsfile('/Search/JavaScript/MapPopup.js');
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    if(sPage=="HomePage.aspx")
    {
        if(_$("skiset2") != null) {_$("skiset2").style.display="block";}
        if(_$("ctl00_plhBody_hdnSpOfferSki").value == "" || _$("ctl00_plhBody_hdnSkiVFXml").value== "" ||_$("ctl00_plhBody_hdnCFavSki").value==""||_$("ctl00_Footer1_hdnSkiFD").value=="")
        {
            _$("ctl00_plhBody_hdnTabValue").value="";
            _$("ctl00_plhBody_hdnTabValue").value = "2";
            clearTimeout(s1);
            clearTimeout(s2);
            HomePageCall();
            footerCall(2);
            _$("ctl00_plhBody_hdnVF").value = _$("ctl00_plhBody_hdnSkiVFXml").value;
        }
        else
        {
            count=0;
            var parameter2=2;              
            //ski_tab.className="active_tab";
            beach_tab.className="inactive_tab_right";
            city_tab.className="inactive_tab";     
            clearTimeout(s1);
            clearTimeout(s2);                        
            SpecialOffer(_$("ctl00_plhBody_hdnSpOfferSki").value,parameter2,true);
            HomeVF( _$("ctl00_plhBody_hdnSkiVFXml").value,false,parameter2);      
            FeaturedDestination(_$("ctl00_Footer1_hdnSkiFD").value,'2');      
            CustomerFavourites(_$("ctl00_plhBody_hdnCFavSki").value,'2');     
            _$("ctl00_plhBody_hdnTabValue").value="";
            _$("ctl00_plhBody_hdnTabValue").value=2;
            _$("ctl00_plhBody_hdnVF").value = _$("ctl00_plhBody_hdnSkiVFXml").value;     
            return false;
        }        
    }
    else
    {
         var tabVal='2';
        document.frmTabVal.target='_self';
        document.frmTabVal.hdnTabVal.value =tabVal;
        document.frmTabVal.method = "POST";
        if(_$("ctl00_plhBody_hdndomain")!=null)
            document.frmTabVal.action = _$("ctl00_plhBody_hdndomain").value + "/Search/HomePage.aspx";                            
        else
            document.frmTabVal.action = "/Search/HomePage.aspx";                            
        document.frmTabVal.submit();
    }
      _$("ctl00_plhBody_hdnTabValue").value="";
       _$("ctl00_plhBody_hdnTabValue").value=2;
}
function setCheckOutDate(_dur)
{
    var ddlDur=_$("ctl00_plhBody_duration");
    var flag=true;
    if(_dur == 0 )
    {
           var days = prompt("Please enter the number of nights:(1 to 365 only)","");
           var strd=""; 
           var bday=0;          
          if(days!=null)
          {
           days = trim(days);
           if(days !="" && IsNumeric(days)==true)
           {
                for(var zx=0;zx<days.length;zx++)
                {
                    if(parseInt(days.charAt(zx)) > 0) {strd += days.charAt(zx); bday=1;} else if(bday == 1){strd += days.charAt(zx);}
                }
                days = strd;
                if(days > 0 && days < 366)
                {                
                        for (var count = ddlDur.options.length-1; count >-1; count--)
                        {
                            if(ddlDur.options[count].value==days)
                                {
	                                flag=false;
	                            }
                        }
                        if(flag==true)
                        {
                            for (var count = ddlDur.options.length-1; count >-1; count--)
                            {
                                if(ddlDur.options[count].value==0)
                                    {
	                                    ddlDur.options[count] = null;
	                                }
                            }
                            _optionItem = new Option( days, days,  false, false);
                            ddlDur.options[ddlDur.length] = _optionItem; 
                            _optionItem = new Option( "Other", "0",  false, false);
                            ddlDur.options[ddlDur.length] = _optionItem;
                            for(var rVal=0; rVal<ddlDur.length; rVal++)
                            {
                                if(ddlDur.options[rVal].value==days)
                                {
                                    ddlDur.options.selectedIndex = rVal;                                   
                                }
                            }
                            setCheckOutDate(days);
                         }
                         else
                         {
                             for(var rVal=0; rVal<ddlDur.length; rVal++)
                            {
                                if(ddlDur.options[rVal].value==days)
                                {
                                    ddlDur.options.selectedIndex = rVal;                                   
                                }
                            }
                            setCheckOutDate(days);
                         }
                }
                else
                {
                     alert("Please enter the duration between 1 to 365");
                     populateDuration("7");
                     setCheckOutDate("7");  
                }
           }
           else
           {
              alert("Please enter the duration between 1 to 365");
              populateDuration("7"); 
              setCheckOutDate("7");   
           }
        }
        else
        {     
            populateDuration("7"); 
            setCheckOutDate("7");   
        }
    }
    else
    {   
       // var one_day=1000*60*60*24;
        if(_$("ctl00_plhBody_hotelCheckin").value=="") 
        {
           return false;
        }
        else
        {    
            var _checkIn = _$("ctl00_plhBody_hotelCheckin").value;         
            var x=_checkIn.split("-");    
            var c=x[1]+"/"+x[0]+"/"+ x[2]; 
            var totalDate = new Date(c);
            totalDate.setDate(totalDate.getDate() + parseInt(_dur)); 
            var _d = totalDate.getDate().toString();
            if(_d.length ==1)
            _d = 0+_d;            
            var _m = totalDate.getMonth();
            _m= (_m+1).toString();
            if(_m.length ==1)
            _m = 0+(_m);            
            var _y = totalDate.getFullYear();            
            _$("ctl00_plhBody_CheckOut").value = _d + "-" + _m + "-" + _y;
            _$("ctl00_plhBody_checkoutValue").value = _$("ctl00_plhBody_CheckOut").value;
        }
    }
    return false;
}
function populateDuration(_dur)
{
    var _duration = _$("ctl00_plhBody_duration");
    _duration.value = _dur;  
}
function setDates()
{
    var _dType = _$("hdnsetDate").value;
    _$("ctl00_plhBody_CheckOut").value = "";
    //var one_day=1000*60*60*24;
    var _checkIn = _$("ctl00_plhBody_hotelCheckin").value;    
    var x=_checkIn.split("-");  
     var c=x[1]+"/"+x[0]+"/"+ x[2];    
    //var date1=new Date(x[2],(x[1]-1),x[0]);
     var totalDate = new Date(c);
    var _duration = _$("ctl00_plhBody_duration");
    totalDate.setDate(totalDate.getDate() + parseInt(_duration.value));
    var _d = totalDate.getDate().toString();
    if(_d.length ==1)
        _d = 0+_d;    
    var _m = totalDate.getMonth();
    _m= (_m+1).toString();
    if(_m.length ==1)
        _m = 0+(_m);    
    var _y = totalDate.getFullYear();    
    _$("ctl00_plhBody_CheckOut").value = _d + "-" + _m + "-" + _y;    
    _$("ctl00_plhBody_checkoutValue").value = _$("ctl00_plhBody_CheckOut").value; 
}
function popitup(url)
 {
    if(_$("ctl00_plhBody_hdndomain")!=null)
        url=_$("ctl00_plhBody_hdndomain").value + url ;
	newwindow=window.open(url,'','height=500,location=no,width=700,scrollbars=yes,resizable=1');
	if (window.focus) {newwindow.focus()}
	return false;
}
function poptrfup(turl)
{
    window.open(turl,'','height=500,resizable=1,location=no,width=700,scrollbars=yes');
    return false;
}
function CustomerFavourites(_customFavXML,type)
{
    checkloadjsfile('/Search/JavaScript/MapPopup.js');
    var div,hr,div1,p,spn,br,img,div2,div3,a,div4,div5,mainDiv,destDiv,div6,li,hid,lon,lat,aId,rId,rlId,lnkID,type;
    if(_customFavXML!="")
    {
        _$("ctl00_plhBody_hdnCFav").value=_customFavXML;
        mainDiv=_$("customer_fav_box");
        var _xmlDoc = Sarissa.getDomDocument();               
        _xmlDoc = (new DOMParser()).parseFromString(_customFavXML, "text/xml");
        _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
        _xmlDoc.setProperty("SelectionLanguage", "XPath");        
        if(CheckForValidObject(_xmlDoc))
        {
            var _ndCFavs,_ndDestCFavs;
            _ndCFavs = _xmlDoc.selectNodes("CFs/H");
            _ndDestCFavs=_xmlDoc.selectNodes("CFs/D");
            if ( mainDiv.hasChildNodes())
            {
                     while ( mainDiv.childNodes.length >= 1 )
                     { 
                        mainDiv.removeChild( mainDiv.firstChild ); 
                     } 
             }
             if(_ndDestCFavs.length>0)
             {
                CheckForValidObject(_ndDestCFavs)
                {
                     a=document.createElement('A');
                     a.id="cust_fav_dest_link";                
                     a.href="Javascript:showCustomerFav();"
                     a.innerHTML="Top rated destinations +";
                     mainDiv.appendChild(a);                                          
                     destDiv=document.createElement('DIV');
                     destDiv.id="cust_fav_dest_list";
                     destDiv.style.display='none';
                     hr=document.createElement('hr');
                     hr.style.color="#DFDFDF";
                     hr.size="1";
                     destDiv.appendChild(hr);                     
                  for(var _dCount=0; _dCount<_ndDestCFavs.length; _dCount++)
                  {
                     CheckForValidObject(_ndDestCFavs[_dCount])
                        {
                            rId=_ndDestCFavs[_dCount].getAttribute("rid");
                            aId=_ndDestCFavs[_dCount].getAttribute("aid");
                            rlId=_ndDestCFavs[_dCount].getAttribute("rlid");
                            destType=_ndDestCFavs[_dCount].getAttribute("t");
                            rName = RepSpecialChar(_ndDestCFavs[_dCount].getAttribute("rn"));
                            aName = RepSpecialChar(_ndDestCFavs[_dCount].getAttribute("an"));
                            rlName = RepSpecialChar(_ndDestCFavs[_dCount].getAttribute("rln"));                            
                            div6=document.createElement('Div');
                            div6.className="fav_list";
                            li=document.createElement('LI');
                            li.className="fav_dest_item";
                            a=document.createElement('A');                            
                            if(destType=="Beach")
                            {
                                a.innerHTML=CFdestLen(rlName);
                                a.href="/Search/beach-holiday/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlId+"-"+type+".aspx";                                
                            }
                            else
                            {
                                 a.innerHTML=CFdestLen(aName);
                                 a.href="/Search/city-breaks/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aId+"-"+type+".aspx";
                            }
                            li.appendChild(a);
                            div6.appendChild(li);
                            destDiv.appendChild(div6);
                            mainDiv.appendChild(destDiv);
                        }
                  }
               }
          }     
            if(_ndCFavs.length >0)
            {               
                for(_cfCount=0; _cfCount<_ndCFavs.length;_cfCount++)
                {
                        lon=_ndCFavs[_cfCount].getAttribute("x");
                        lat=_ndCFavs[_cfCount].getAttribute("y");                
                        div=document.createElement('DIV');
                        div.id="cusFav"+_cfCount;
                        div.className="result_desc";
                        hr=document.createElement('hr');
                        hr.style.color="#DFDFDF";
                        hr.size="1";
                        div.appendChild(hr);                        
                        div1=document.createElement('DIV');
                        div1.className="accomm_name";
                        p=document.createElement('P');
                        var _rName=RepSpecialChar(_ndCFavs[_cfCount].getAttribute("rnm"));
                        var _aName=RepSpecialChar(_ndCFavs[_cfCount].getAttribute("anm"));
                        var _rlName=RepSpecialChar(_ndCFavs[_cfCount].getAttribute("rlnm"));                        
                        rId=_ndCFavs[_cfCount].getAttribute("rid");
                        aId=_ndCFavs[_cfCount].getAttribute("aid");
                        rlId=_ndCFavs[_cfCount].getAttribute("rlid");                        
                        var rar=document.createTextNode(_rName);
                        p.appendChild(rar);                                                
                        a=document.createElement('A');                        
                        if(_rlName!="")
                        {
                            p.appendChild(document.createTextNode(" > "+_aName+" > "));
                            a.href="/Search/beach-holiday/"+_rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+_aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+_rlName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlId+"-"+type+".aspx";  
                            a.innerHTML= _rlName;                            
                        }
                        else
                        {
                            p.appendChild(document.createTextNode(" > "));
                            a.href="/Search/city-breaks/"+_rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+_aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aId+"-"+type+".aspx";
                            a.innerHTML = _aName;
                        }                       
                        p.appendChild(a);                 
                        div1.appendChild(p);                       
                        spn=document.createElement('SPAN');
                        a=document.createElement('A');
                        hName=_ndCFavs[_cfCount].getAttribute("n");
                        hName=RepSpecialChar(hName);
                        a.innerHTML=hName;
                        hid=_ndCFavs[_cfCount].getAttribute("hid");
                        a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                        spn.appendChild(a);
                        div1.appendChild(spn);
                        br=document.createElement('BR');
                        div1.appendChild(br);
                        
                         spn=document.createElement('SPAN');
                         spn.className="rating_wrapper";
                         
                         var rating=_ndCFavs[_cfCount].getAttribute("r");
                         if(rating>0)
                         {
                             for(ratCount=0; ratCount<rating; ratCount++)
                             {
                                img=document.createElement('IMG');
                                img.style.marginTop='5px';
                                img.src="images/results/icons/star.gif";
                                spn.appendChild(img);                                
                             }
                         }
                         div1.appendChild(spn);
                         div.appendChild(div1);
                         
                            if(_ndCFavs[_cfCount].getAttribute("rvs")!="" && _ndCFavs[_cfCount].getAttribute("rvs")!="0")
                           {        
                              div2=document.createElement('DIV');
                              div2.className="rating_blue_box";
                              p=document.createElement('P');
                              var  text = document.createTextNode("Average customer rating");                      
                              p.appendChild(text);
                              div2.style.cursor="hand";
                              div2.appendChild(p);
                              var cusRating=_ndCFavs[_cfCount].getAttribute("cr");
                              var cusReviews=_ndCFavs[_cfCount].getAttribute("rvs");
                              var reviewLink=ReviewWindow(cusRating,cusReviews);
                              reviewLink.appendChild(div2);                             
                              p=document.createElement('P');
                              spn=document.createElement('SPAN');
                              spn.innerHTML=parseInt(_ndCFavs[_cfCount].getAttribute("cr"))+"%&nbsp;";
                              p.appendChild(spn);                            
                               if(_ndCFavs[_cfCount].getAttribute("rvs")!="")
                               {
                                  var  text1 = document.createTextNode(_ndCFavs[_cfCount].getAttribute("rvs")+" reviews");
                               }
                               else
                               {
                                   var  text1 = document.createTextNode(" 0 reviews"); 
                               }
                              p.appendChild(text1);
                              div2.appendChild(p);
                              div.appendChild(reviewLink);
                        }   
                              if(_ndCFavs[_cfCount].getAttribute("lp")!="" && _ndCFavs[_cfCount].getAttribute("lp")!="0.00")
                                {
                                    div3=document.createElement('DIV');
                                    div3.className="blue_price";                            
                                    div3.innerHTML="from &pound;<strong>"+parseFloat(_ndCFavs[_cfCount].getAttribute("lp")).toFixed(2)+"</strong>&nbsp;pppn";
                                    div.appendChild(div3);
                                }                                                
                            var _ndImage=_ndCFavs[_cfCount].selectSingleNode("Is/I");
                            if(CheckForValidObject(_ndImage))
                            {                            
                                div4=document.createElement('DIV');
                                div4.className="accomm_pic";
                                a=document.createElement('A');
                                img=document.createElement('IMG');                                
                                if(_ndImage.getAttribute("u")!="")
                               img.src=_ndImage.getAttribute("u").replace("&amp;","&");
                                else
                                img.src = '/Search/images/1/noimage_106x80.gif';                                 
                                img.style.width = "165px";
                                img.style.height = "123px";
                                a.appendChild(img);
                                a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                                div4.appendChild(a);
                                div.appendChild(div4);                                
                             }
                             else
                             {
                                 div4=document.createElement('DIV');
                                div4.className="accomm_pic";
                                a=document.createElement('A');
                                img=document.createElement('IMG');
                                img.src='\Search\Images\Homepage\no_image.gif';
                                img.title=_ndImage.getAttribute("n");
                                img.alt=_ndImage.getAttribute("a");
                                a.appendChild(img);
                                a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                                div4.appendChild(a);
                                div.appendChild(div4);
                             }                            
                           div5=document.createElement('DIV');
                           div5.className="accomm_desc";
                           p=document.createElement('P');
                           var descp=_ndCFavs[_cfCount].getAttribute("d");
                           var desc =document.createTextNode(RepSpecialChar(descp));
                           var moreInfoLink=document.createElement('a');
                           moreInfoLink.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                           moreInfoLink.innerHTML="more info"; 
                           p.appendChild(desc);
                           p.appendChild(moreInfoLink);
                           div5.appendChild(p);                           
                           p=document.createElement('P');
                           var _ndFacl=_ndCFavs[_cfCount].selectNodes("F");
                           var keys="";
                           for(fCount=0;fCount<_ndFacl.length; fCount++)
                           {
                              keys += _ndFacl[fCount].getAttribute("k").toLowerCase()+",";
                           }
                            if(keys.search(/kid/)!=-1)
                            {
                                img=document.createElement('IMG');
                                img.src="images/results/icons/kids_club.gif";
                                p.appendChild(img);
                                p.appendChild(document.createTextNode('\u00a0'));
                                div5.appendChild(p);
                            }
                            if(keys.search(/sport/)!=-1)
                            {
                                img=document.createElement('IMG');
                                img.src="images/results/icons/football.gif";
                                p.appendChild(img);
                                div5.appendChild(p);
                            }

                            if(keys.search(/beach/)!=-1)
                            {
                                img=document.createElement('IMG');
                                img.src="images/results/icons/beach.gif";
                                p.appendChild(img);
                                div5.appendChild(p);
                            }
                            if(keys.search(/golf/)!=-1)
                            {
                                img=document.createElement('IMG');
                                img.src="images/results/icons/golf.gif";
                                p.appendChild(img);
                                div5.appendChild(p);
                            }
                            if(keys.search(/fourbed/)!=-1)
                            {
                                img=document.createElement('IMG');
                                img.src="images/results/icons/four_bed.gif";
                                p.appendChild(img);
                                div5.appendChild(p);
                            }
                            if(keys.search(/spa/)!=-1)
                            {
                                img=document.createElement('IMG');
                                img.src="images/results/icons/spa.gif";
                                p.appendChild(img);
                                p.appendChild(document.createTextNode('\u00a0'));
                                div5.appendChild(p);                             
                            }
                            if(_ndCFavs[_cfCount].getAttribute("aid") == '500')
                            {
                                img=document.createElement('IMG');
                                img.src = "/Search/Images/results/icons/free-transfer-icon.png";
                                //img.alt = "All holidays to Sharm El Sheik receive a free transfer from the airport to resort";
                                img.title = "All holidays to Sharm El Sheik receive a free transfer from the airport to resort";
                                p.appendChild(img);
                                div5.appendChild(p);  
                            }
                            br=document.createElement('BR');
                            div5.appendChild(br);
                            a=document.createElement('A');
                            a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                            var imgMoreInfo=document.createElement('IMG');
                            imgMoreInfo.title = "View More Details";
                            imgMoreInfo.src="/Search/Images/results/icons/hotelinfo_icon.gif";
                            a.appendChild(imgMoreInfo);
                            div5.appendChild(a);
                            a=document.createElement('A');
                            a.href="/Search/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type+".aspx";
                            a.innerHTML = "More info&nbsp;";
                            div5.appendChild(a); 
                                                                       
                            if(_ndCFavs[_cfCount].getAttribute("ist")=="1")
                            {
                                var rgId="";
                                var arId="";
                                var rsId="";
                                rgId=_ndCFavs[_cfCount].getAttribute("rid");
                                arId=_ndCFavs[_cfCount].getAttribute("aid");
                                rsId=_ndCFavs[_cfCount].getAttribute("rlid");
                                var id=rgId+","+arId+","+rsId;
                                 
                                a=document.createElement('A');
                                a.href="javascript:trfrequest("+rgId+","+arId+","+rsId+")";
                                var imgTrfInfo=document.createElement('IMG');
                                imgTrfInfo.title = "View Transfer Info";
                                imgTrfInfo.src="/Search/Images/results/icons/transfer_icon.gif";
                                a.appendChild(imgTrfInfo);  
                                div5.appendChild(a);
                                a=document.createElement('A');
                                a.href="javascript:trfrequest("+rgId+","+arId+","+rsId+")";
                                a.innerHTML = "Transfers&nbsp;";
                                div5.appendChild(a); 
                            }
                            if(parseFloat(lon) !=0 && parseFloat(lat) !=0 && lat!="" && lon!="")
                            {
                                a=document.createElement('A');
                                a.href="javascript:ViewMap("+hid+")";
                                var imgMapInfo=document.createElement('IMG');
                                imgMapInfo.title= "View Map";
                                imgMapInfo.src="/Search/Images/results/icons/map_icon.gif";
                                a.appendChild(imgMapInfo);
                                div5.appendChild(a);
                                a=document.createElement('A');
                                a.href="javascript:ViewMap("+hid+")";
                                a.innerHTML = "View Map";
                                div5.appendChild(a); 
                             }
                            div.appendChild(div5);
                            mainDiv.appendChild(div);
                        }
              }
           }
        }
       setTimeout("sFooter()",10000);
}
function trfrequest(rgId,arId,rsId)
{
    var id=rgId+":"+arId+":"+rsId;
    AjaxHomeRequest("TRF",id);
}
//function transfer(_xml)
//{
//    var _cfXml,mainTable,table,tabl,tbdy,tbdy2, tr,td,div,trfDur;
//    var trf,aPort,aName,aId;
//    var ddlAirport=_$("ctl00_plhBody_ddlAirport");
//        if(_xml!="")
//        {
//            var _xmlDoc = Sarissa.getDomDocument();               
//            _xmlDoc = (new DOMParser()).parseFromString(_xml, "text/xml");
//            _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
//            _xmlDoc.setProperty("SelectionLanguage", "XPath");
//            div=_$("trfpopup");
//            for (var count = ddlAirport.options.length-1; count >-1; count--)
//            {
//	            ddlAirport.options[count] = null;
//            }            
//            if(CheckForValidObject(_xmlDoc))
//            {
//                trf=_xmlDoc.selectSingleNode("transfer");
//                if(trf != null)
//                {
//                    aPort=trf.selectNodes("airport");
//                    if(CheckForValidObject(aPort))
//                    {
//                        for(count=0; count<aPort.length; count++)
//                        {
//                               var _text = aPort[count].getAttribute("airportname");
//                               if(CheckForValidObject(aPort[count].getAttribute("airportid")))
//                                    var _id = aPort[count].getAttribute("airportid");
//                                var _optionItem = new Option(_text, _id);
//                                ddlAirport.options[ddlAirport.length] = _optionItem;            
//                        }
//                    }
//                }                
//            }
//            else
//            {
//                     _optionItem = new Option( "-- No Transfer --", "",  false, false);
//                     ddlAirport.options[ddlAirport.length] = _optionItem; 
//            }
//           selectAirport();
//    }
//   else
//   {
//        var trfDiv=_$("trfDiv");
//        trfDiv.style.height='80px';
//        trfDiv.style.width='430px';       
//        _$("trfpopup").innerHTML="";
//        var span=document.createElement('span');                    
//        span.className="tbl-text-btm";    
//        span.innerHTML="No price available for these dates";
//        _$("trfpopup").appendChild(span);
//   }
//   openModalWindow("trfDiv","modalBackgroundDiv");
//}
function transfer(_xml)
{
    var len;
    var xPath,trf,aPort,veh,tType,tr,td,strong,spn,input,tab,inPr,outPr,rtPr,prodId,currency,tFprice,dur,toutPr,tName,typName,pID;
    var isTrfAvail = "true";
    if(_xml != "" && _xml != "<transfer />")
    {
        div=_$("trfpopup");    
        var _xmlDoc = Sarissa.getDomDocument();               
        _xmlDoc = (new DOMParser()).parseFromString(_xml, "text/xml");            
        _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
        _xmlDoc.setProperty("SelectionLanguage", "XPath");        
        if ( div.hasChildNodes())
        {
            while ( div.childNodes.length >= 1 )
            { 
                div.removeChild( div.firstChild ); 
            } 
        }
        if(CheckForValidObject(_xmlDoc))
        {
            trf=_xmlDoc.selectNodes("transfer/airport");
            if(trf != null && trf.length >0)
            {
                veh=trf[0].selectNodes("vehicle");
                if(veh != null && veh.length>0)
                {
                    len = 0;
                    mainTable=document.createElement('TABLE');
                    mainTable.border='0';
                    mainTable.cellPadding = '0';
                    mainTable.cellSpacing = '0';
                    mainTable.id="table1";
                    mainTable.className="tbl-main";
                    mainTable.border ="0";
                    div.appendChild(mainTable);
                    tbdy=document.createElement('TBODY');
                    mainTable.appendChild(tbdy);                         
                    tr1=document.createElement('TR');
                    tbdy.appendChild(tr1);                         
                    td1=document.createElement('TD');                       
                    var  table=document.createElement('TABLE');
                    table.border='0';
                    table.cellPadding = '2';
                    table.cellSpacing = '2';
                    table.id="table";
                    td1.appendChild(table);
                    tr1.appendChild(td1); 
                    tbdy=document.createElement('TBODY');
                    table.border ="0";
                    table.appendChild(tbdy);                     
                    tr=document.createElement('TR');
                    tbdy.appendChild(tr);                         
                    td=document.createElement('TD');
                    td.colSpan='3';
                    td.className="tbl-heading";
                    td.innerHTML="Transfer available with this hotel";
                    tr.appendChild(td);                         
                    tr=document.createElement('TR');
                    tbdy.appendChild(tr);                             
                    td=document.createElement('TD');   
                    td.className="tbl-title";    
                    td.innerHTML="Transfer";
                    tr.appendChild(td);                             
                    td=document.createElement('TD');   
                    td.className="tbl-title";    
                    td.innerHTML="Duration";
                    tr.appendChild(td);                             
                    td=document.createElement('TD');   
                    td.className="tbl-title";    
                    td.innerHTML="Return Price";
                    tr.appendChild(td);                         
                    var isShuttle = false;
                    for(var no=0; no<veh.length;no++)
                    {
                        tType= veh[no].getAttribute("prodname");
                        if(tType.indexOf("Shuttle")!= -1)
                        {
                            tType = tType+'*';                       
                        }
                        tFprice= veh[no].getAttribute("rtprice");
                        dur=veh[no].getAttribute("duration");
                        currency=veh[no].getAttribute("currency");                      
                        if(tType.indexOf("Shuttle")!= -1 || tType.indexOf("Standard Taxi")!= -1 || tType.indexOf("Premier Service")!= -1)
                        {
                            len = len+1;                            
                            tr=document.createElement('TR');
                            tbdy.appendChild(tr);                            
                            td=document.createElement('TD');
                            td.className="tbl-item";
                            td.innerHTML=tType;
                            tr.appendChild(td);                                   
                            td=document.createElement('TD');   
                            td.className="tbl-item";    
                            td.innerHTML=dur+" minutes";
                            tr.appendChild(td);                                    
                            td=document.createElement('TD');   
                            td.className="tbl-item";
                            if(currency == 'GBP')
                            {
                                if(tType.indexOf("Shuttle")!= -1) { tFprice = '&pound;'+parseFloat(tFprice).toFixed(2)+'<span style="font-size:10px;">&nbsp;per person</span>'; }     
                                else { tFprice = '&pound;'+parseFloat(tFprice).toFixed(2)+'<span style="font-size:10px;">&nbsp;per vehicle</span>'; }
                            }    
                            td.innerHTML=tFprice;
                            tr.appendChild(td);
                            if(tType.indexOf("Shuttle")!= -1)
                            {
                                isShuttle = true;
                            }
                        }                       
                    }
                    tr=document.createElement('TR');
                    tbdy.appendChild(tr);

                    td=document.createElement('TD');
                    td.colSpan='3';
                    td.className="tbl-text-em"; 

                    if(isShuttle == true)
                    {
                        td.innerHTML="*Shuttle availability subject to arrival/depature time";                        
                    }                    
                    tr.appendChild(td);                                     
                    tr=document.createElement('TR');
                    tbdy.appendChild(tr);                                    
                    td=document.createElement('TD'); 
                    td.colSpan='3';
                    td.height='10px';  
                    td.className="tbl-text-btm";    
                    td.innerHTML="You can add this transfer to your basket later";
                    tr.appendChild(td);
                }
                else { isTrfAvail = "false"; }                  
            }
            else { isTrfAvail = "false"; }       
        }
        else { isTrfAvail = "false"; }                      
    }
    else { isTrfAvail = "false"; }
    
    var ht,wd;     
    var trfDiv=_$("trfDiv");
    if(len=="1")
    {     
        trfDiv.style.height='200px';
        trfDiv.style.width='430px';
    }
    else if(len=="2")
    {
        trfDiv.style.height='230px';
        trfDiv.style.width='430px';       
    }
    else if(len=="3")
    {
        trfDiv.style.height='250px';
        trfDiv.style.width='520px';       
    }
    
    if(isTrfAvail == "false")
    {
        trfDiv.style.height='80px';
        trfDiv.style.width='430px';       
        _$("trfpopup").innerHTML="";
        var span=document.createElement('span');                    
        span.className="tbl-text-btm";    
        span.innerHTML="No price available for these dates";
        _$("trfpopup").appendChild(span);
    }
    openModalWindow("trfDiv","modalBackgroundDiv");
}
function selectAirport()
{
   var ddlAirport = _$("ctl00_plhBody_ddlAirport");
    var len;
   var w = ddlAirport.selectedIndex;
   var id = ddlAirport.options[w].value;    
    var xPath,trf,aPort,veh,tType,tr,td,strong,spn,input,tab,inPr,outPr,rtPr,prodId,currency,tFprice,dur,toutPr,tName,typName,pID;
    var _xml=_$("ctl00_plhBody_hdnTrfRes").value;
     div=_$("trfpopup");    
     var _xmlDoc = Sarissa.getDomDocument();               
    _xmlDoc = (new DOMParser()).parseFromString(_xml, "text/xml");            
    _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
    _xmlDoc.setProperty("SelectionLanguage", "XPath");    
     xPath="transfer/airport";     
      if ( div.hasChildNodes())
      {
         while ( div.childNodes.length >= 1 )
          { 
             div.removeChild( div.firstChild ); 
          } 
       }      
    if(CheckForValidObject(_xmlDoc))
    {
        trf=_xmlDoc.selectNodes("transfer/airport");
        if(trf.length >0)
        {
          aPort= _xmlDoc.selectSingleNode(xPath+"[@airportid='"+ id+"']") ;
           if(CheckForValidObject(aPort))
           {
                veh=aPort.selectNodes("vehicle");
                len = 0;
                if(veh.length>0)
                {
                   mainTable=document.createElement('TABLE');
                         mainTable.border='0';
                         mainTable.cellPadding = '0';
                         mainTable.cellSpacing = '0';
                         mainTable.id="table1";
                         mainTable.className="tbl-main";
                         mainTable.border ="0";
                         div.appendChild(mainTable);
                         tbdy=document.createElement('TBODY');
                         mainTable.appendChild(tbdy);                         
                         tr1=document.createElement('TR');
                         tbdy.appendChild(tr1);                         
                         td1=document.createElement('TD');                       
                           var  table=document.createElement('TABLE');
                             table.border='0';
                             table.cellPadding = '2';
                             table.cellSpacing = '2';
                             table.id="table";
                             td1.appendChild(table);
                             tr1.appendChild(td1); 
                             tbdy=document.createElement('TBODY');
                             table.border ="0";
                             table.appendChild(tbdy);                     
                             tr=document.createElement('TR');
                             tbdy.appendChild(tr);                         
                             td=document.createElement('TD');
                             td.colSpan='3';
                             td.className="tbl-heading";
                             td.innerHTML="Transfer available with this hotel";
                             tr.appendChild(td);                         
                             tr=document.createElement('TR');
                             tbdy.appendChild(tr);                             
                             td=document.createElement('TD');   
                             td.className="tbl-title";    
                             td.innerHTML="Transfer";
                             tr.appendChild(td);                             
                             td=document.createElement('TD');   
                             td.className="tbl-title";    
                             td.innerHTML="Duration";
                             tr.appendChild(td);                             
                             td=document.createElement('TD');   
                             td.className="tbl-title";    
                             td.innerHTML="Return Price";
                             tr.appendChild(td);                         
                    var isShuttle = false;
                    for(var no=0; no<veh.length;no++)
                    {
                       tType= veh[no].getAttribute("prodname");
                       if(tType.indexOf("Shuttle")!= -1)
                       {
                            tType = tType+'*';                       
                       }
                       tFprice= veh[no].getAttribute("rtprice");
                       dur=veh[no].getAttribute("duration");
                       currency=veh[no].getAttribute("currency");                      
                       if(tType.indexOf("Shuttle")!= -1 || tType.indexOf("Standard Taxi")!= -1 || tType.indexOf("Premier Service")!= -1)
                       {
                            len = len+1;                            
                            tr=document.createElement('TR');
                            tbdy.appendChild(tr);                            
                            td=document.createElement('TD');
                            td.className="tbl-item";
                            td.innerHTML=tType;
                            tr.appendChild(td);                                   
                            td=document.createElement('TD');   
                            td.className="tbl-item";    
                            td.innerHTML=dur+" minutes";
                            tr.appendChild(td);                                    
                            td=document.createElement('TD');   
                            td.className="tbl-item";
                            if(currency == 'GBP')
                            {
                                tFprice = '&pound;'+parseFloat(tFprice).toFixed(2);
                            }    
                            td.innerHTML=tFprice;
                            tr.appendChild(td);
                            if(tType.indexOf("Shuttle")!= -1)
                            {
                                isShuttle = true;
                            }
                       }                       
                   }
                    tr=document.createElement('TR');
                    tbdy.appendChild(tr);
                          
                    td=document.createElement('TD');
                    td.colSpan='3';
                    td.className="tbl-text-em"; 
                                     
                    if(isShuttle == true)
                    {
                        td.innerHTML="*Shuttle availability subject to arrival/depature time";                        
                    }                    
                    tr.appendChild(td);                                     
                    tr=document.createElement('TR');
                    tbdy.appendChild(tr);                                    
                    td=document.createElement('TD'); 
                    td.colSpan='3';
                    td.height='10px';  
                    td.className="tbl-text-btm";    
                    td.innerHTML="You can add this transfer to your basket later";
                    tr.appendChild(td);
           }                  
        }       
     }   
  } 
    var ht,wd;     
    var trfDiv=_$("trfDiv");
    if(len=="1")
    {     
        trfDiv.style.height='200px';
        trfDiv.style.width='430px';
    }
    else if(len=="2")
    {
        trfDiv.style.height='230px';
        trfDiv.style.width='430px';       
    }
    else if(len=="3")
    {
        trfDiv.style.height='250px';
        trfDiv.style.width='520px';       
    }     
} 
function hideTrf()
{
    _$("modalBackgroundDiv").style.display="none";
   _$("trfDiv").style.display="none";
    _$("frame").style.display="none";
}
function GoTo()
{
    eraseCookie("QkVal");
    eraseCookie("QkText");
    var _qkDestValue,_qkDestTest,sb,_rid,_aid,_rlid,type,rName,aName,rlName,type;
    if(_$("ctl00_Header1_hdnQkSearchValue").value =="" || _$("ctl00_Header1_txtQKDestination").value=="" || _$("ctl00_Header1_txtQKDestination").value=="Type destination. eg. majorca") 
    {
        _$("divHeaderDestMessage").style.display = "block";
        _$("divHeaderDestMessage").innerHTML = "Please enter a valid destination!";
        return false;
    }   
    else if(_$("ctl00_Header1_hdnQkSearchValue").value != null && _$("ctl00_Header1_hdnQkSearchValue").value !="")
    {
         var id;
        _qkDestValue=_$("ctl00_Header1_hdnQkSearchValue").value.split(',');
        _qkDestTest=_$("ctl00_Header1_txtQKDestination").value.split(',');
         createCookie("QkVal",_qkDestValue,1);
         createCookie("QkText",_$("ctl00_Header1_txtQKDestination").value,1);
        _rid=_qkDestValue[0];
        _aid=_qkDestValue[1];
        _rlid=_qkDestValue[2];        
        rName=RepSpecialChar(_qkDestTest[0]);
        aName=RepSpecialChar(_qkDestTest[1]);
        if(_qkDestTest[2]!=null)
            rlName=RepSpecialChar(_qkDestTest[2]);
        type=_qkDestValue[3];
        if(type=="Beach")
        {
            if(_$("ctl00_plhBody_hdndomain")!=null)
                location.href=_$("ctl00_plhBody_hdndomain").value+"/Search/beach-holiday/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/" + aName.replace(/ /g,'-').replace(/&/g,'and') + "/" + rlName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_rlid+"-0.aspx";
            else
                location.href="/Search/beach-holiday/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/" + aName.replace(/ /g,'-').replace(/&/g,'and') + "/" + rlName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_rlid+"-0.aspx";
        }
        else if(type=="City")
        {
            if(_$("ctl00_plhBody_hdndomain")!=null)
                location.href=_$("ctl00_plhBody_hdndomain").value+"/Search/city-breaks/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/" + aName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_aid+"-1.aspx";
            else
                location.href="/Search/city-breaks/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/" + aName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_aid+"-1.aspx";
        }
        else
        {
            if(_$("ctl00_plhBody_hdndomain")!=null)
                location.href=_$("ctl00_plhBody_hdndomain").value+"/Search/city-breaks/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/"+aName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_aid+"-2.aspx";
            else
                location.href="/Search/city-breaks/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/"+aName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_aid+"-2.aspx";
            
        }
        return false;
   }
}
function clearQkDestValues()
{
    var func=function clearQKVal(){ _$("ctl00_Header1_hdnQkSearchValue").value = "";_$("ctl00_Header1_hdnQkSearchText").value = "";return false;}
    setTimeout(func,25000);   
}
function clearDestValues()
{
    return false; 
}
function validatePriceSearch(_flag)
{
  var tabVal=_$("ctl00_plhBody_hdnTabValue").value;
  var _childsValue=0,_adultsValue=0,_roomsValue,_rooms,_cAge,_adultValue,allRooms;
    if(_$("ctl00_plhBody_txtDestination").value=="" || _$("ctl00_plhBody_txtDestination").value=="Start typing your destination here") 
    {
        _$("divDestMessage").style.display = "block";
        _$("lblDestErrMessage").innerHTML = "Please enter a valid destination first!";     
        return false;
    }
    if(_$("ctl00_plhBody_hidDestValue").value =="")
    {
        if(_$("ctl00_plhBody_txtDestination").value!="" && _$("ctl00_plhBody_txtDestination").value != null) 
        {
            _$("ctl00_plhBody_hidDestSearchQuery").value = _$("ctl00_plhBody_txtDestination").value;
            AjaxHomeRequest(_$("ctl00_plhBody_txtDestination").value,"DIDYOUMEAN");
        }
        _$("ctl00_plhBody_txtDestination").focus();
        _$("divDestMessage").style.display = "none";
        return false;
    }
    if(_$("ctl00_plhBody_hotelCheckin").value=="") 
    {
        alert("Please provide the Arrival Date!");
        return false;
    }
    if(_$("ctl00_plhBody_checkoutValue").value=="") 
    {
        alert("Please provide the Departure Date!");
        return false;
    }
     var _loopVal=0;
     var val="";   
    if(_$("ctl00_plhBody_rooms_select_id") != null)
    {
        var _roomValues="";
        _rooms = _$("ctl00_plhBody_rooms_select_id").value;
        _roomsValue=_rooms;
      
       for(var _roomCount=0; _roomCount<_rooms; _roomCount++)
       {
            var _adultValue = _$("ctl00_plhBody_ddlAdult").value;
            _adultsValue = parseInt(_adultValue);           
            var _chName ="ctl00_plhBody_children_room_1"; 
            var _chValue = _$(_chName).value;
            var val1=parseInt(_chValue);
            val=_chValue;
            _childsValue += parseInt(_chValue);
            if(_chValue >0)
            {
                for(var i=0; i<val1; i++)
                {
                    if(i==0)
                    {
                        _cAge=_$("ctl00_plhBody_childage").value
                    }
                    else
                    {
                        var cage = "ctl00_plhBody_childage" + i;
                        var cageval=_$(cage).value;
                        if(_cAge!="")
                        {
                            _cAge =_cAge+"-"+cageval;
                        }
                        else
                        {
                            _cAge =cageval;
                        }
                    }
                } 
              }
              else
              {
                 _cAge ="0";
              }
            _roomValues +=(_roomCount+1)+":"+_adultValue+":"+_chValue+":"+_cAge+"!";
            _cAge="";
            _loopVal =parseInt(_loopVal) + parseInt(val);
       }
       _$("ctl00_plhBody_hidRoomValues").value = _roomValues;
   }
    var _destName, _destValue, _hotelName, _hotelValue, _chkInValue, _chkOutValue,_hotId ; 
    if(_$("ctl00_plhBody_hidDestText").value != "")
    {
        _destName = _$("ctl00_plhBody_hidDestText").value;
        _destValue = _$("ctl00_plhBody_hidDestValue").value;
    }
    if(_$("ctl00_plhBody_hidHotelText").value != "" && _$("ctl00_plhBody_hidHotelText").value != "Type your hotel name here" )
    {
        _hotelName = _$("ctl00_plhBody_hidHotelText").value;
        _hotelValue = _$("ctl00_plhBody_hidHotelValue").value;
    }
    _chkInValue = _$("ctl00_plhBody_hotelCheckin").value;
    _chkOutValue = _$("ctl00_plhBody_checkoutValue").value;   
    var _adultsValue, _childrenValue, _durValue, _ratingValue,_ratText, _boardValue,_bText, _roomValue,_roomAgeVal;
    _adultsValue =_adultsValue; 
    _childrenValue =_childsValue; 
    _ratingValue =_$("ctl00_plhBody_ddlRating").value;
    var w = _$("ctl00_plhBody_ddlRating").selectedIndex;
    _ratText = _$("ctl00_plhBody_ddlRating").options[w].text;  
    _boardValue =_$("ctl00_plhBody_ddlboard").value;
    var y = _$("ctl00_plhBody_ddlboard").selectedIndex;
    _bText=_$("ctl00_plhBody_ddlboard").options[y].text;    
    _durValue = _$("ctl00_plhBody_duration").value;
    _roomValue =_roomsValue;
    var _destValue,_hotelValue, _rid, _aid, _rlid,_hid, _locId, _hotelValue, _type, _destId, _resortId, _airId, _checkInDate, _checkOutDate, _lrName, _aid, _destinationName, _board,tabVal;
    if(_$("ctl00_plhBody_hidDestValue").value != "")
    {
        _destValue = _$("ctl00_plhBody_hidDestValue").value.split(',');
        _rid = _destValue[0];
        _aid = _destValue[1];
        _type= _destValue[3];
        if(_destValue[2]!="" || _destValue[2]!=null)
        {
          _rlid = _destValue[2];
        }
        else
        {
          _rlid = '-1';
        }
    }
    if(CheckForValidObject(_hotelValue))
    {
        _hid =_hotelValue.split(',');
        if(_hid[3]!=null && _hid[3]!="")
        {
             _hotId=_hid[3];
        }
        else
        {
             _hotId="-1";
             _hotelName=""; 
        }
    }   
    else
    {
         _hotId ="-1";
         _hotelName=""; 
    } 
    _airId = _$("ctl00_plhBody_hidAffiliateId").value;
    _checkInDate = _$("ctl00_plhBody_checkinValue").value;
    _checkOutDate = _$("ctl00_plhBody_checkoutValue").value;
    _destinationName = _$("ctl00_plhBody_hidDestText").value;
    _board =_$("ctl00_plhBody_ddlboard").value;
    tabVal=_$("ctl00_plhBody_hdnTabValue").value;  
    var _sb = _rid;
    _sb += "|";
    _sb += _aid;
    _sb += "|";
    _sb += _rlid;    
    _sb += "|";
    _sb += _hotId;
    _sb += "|";
    _sb += _airId;
    _sb += "|";
    _sb += _checkInDate;
    _sb += "|";
    _sb += _checkOutDate;
    _sb += "|";
    _sb += _durValue;
    _sb += "|";
    _sb += _boardValue;
    _sb += "|";
    _sb += _board;
    _sb += "|";
    _sb += _ratingValue;
    _sb += "|";
    _sb += _roomValue;
    _sb += "|";
    _sb += _adultsValue;
    _sb += "|";
    _sb += _childrenValue;
    _sb +="|";
    _sb +=  _$("ctl00_plhBody_hidRoomValues").value;
    _sb +="|";
    _sb +=_type;
    _$("ctl00_plhBody_hidPriceReqValues").value = _sb;
    getPriceStaticXml(_airId);
    var sb = _rid;
    sb += "||";
    sb += _aid;
    sb += "||";
    sb += _rlid;
    sb += "||";
    sb +=_destName;
    sb +="||";
    sb += _hotId;
    sb +="||";
    sb += RepSpecialChar(_hotelName);
    sb += "||";
    sb += _airId;
    sb += "||";
    sb += _checkInDate;
    sb += "||";
    sb += _checkOutDate;
    sb += "||";
    sb += _durValue;
    sb += "||";
    sb += _boardValue;
    sb += "||";
    sb += _bText;
    sb += "||";
    sb += _ratingValue;
    sb +="||";
    sb += _ratText;
    sb += "||";
    sb += _roomValue;
    sb += "||";
    sb += _adultsValue;
    sb += "||";
    sb += _childrenValue;
    sb +="||";
    sb +=  _$("ctl00_plhBody_hidRoomValues").value;
    sb +="||";
    sb +=_type;
    sb +="||";
    sb +=tabVal;
    sb +="||";
    sb +=_flag;   
    _$("hidPriceResult").value = sb;
    createCookie("HN2", sb, 1);
    if(_flag==99 && _hotId!="-1")
    {
        document.myformPrice.target='_self';
        document.myformPrice.hidPriceResult.value =sb;
        document.myformPrice.method = "POST";
        document.myformPrice.action = "/Search/cheap-hotels/"+RepSpecialChar(_hotelName).replace(/ /g,'-').replace(/&/g,'and')+"/"+ _hotId+"-"+$("ctl00_plhBody_hdnTabValue").value+".aspx";
        document.myformPrice.submit();
    }
    else
    {
        document.myformPrice.target='_self';
        document.myformPrice.hidPriceResult.value =sb;
        document.myformPrice.method = "POST";
        document.myformPrice.action = "/Search/PriceResult.aspx";                            
        document.myformPrice.submit();
    }
    return false;
}
function getPriceStaticXml(_aid)
{
    var _hsrpIds = _$("ctl00_plhBody_hidPriceReqValues").value;   
    var theDate = new Date();
    var requestUrl = "/Search/AjaxImpl.aspx?pagedlp=HomePrice&aid="+_aid+"&v="+_hsrpIds+"&dt="+ theDate.getTime();
    var XmlHttp = CreateXmlHttp();
    if(XmlHttp)
    {
        XmlHttp.open("GET", requestUrl,  true);
        XmlHttp.send(null);		
    }
}
function SetMeanDestination(_resultXml)
{
    _$("divDidYouMeanDest").style.display = "block";    
    _$("divDestMessage").style.display = "none";
    var ddlDidYouMeanDest = _$("ctl00_plhBody_ddlDidYouMeanDest");
    var _sQ = _$("ctl00_plhBody_hidDestSearchQuery").value;
    var _optionItem;    
    for (var count = ddlDidYouMeanDest.options.length-1; count >-1; count--)
    {
	    ddlDidYouMeanDest.options[count] = null;
    }
    _optionItem = new Option( "-- Please Select --", "",  false, false);
    ddlDidYouMeanDest.options[ddlDidYouMeanDest.length] = _optionItem; 
    if(_resultXml!="")
    {  
        var _xmlDoc = Sarissa.getDomDocument();               
        _xmlDoc = (new DOMParser()).parseFromString(_resultXml, "text/xml");
        _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
        _xmlDoc.setProperty("SelectionLanguage", "XPath");
        var _ndDest, _ndCity, _ndR;
        _ndDest = _xmlDoc.selectNodes("ISD/IS");
        if(CheckForValidObject(_ndDest))
        {
            if(_ndDest.length > 0)
            {
                for(var _rCount=0; _rCount < _ndDest.length; _rCount++)
                {
                    var _text = _ndDest[_rCount].getAttribute("fn");
                    var _text1 = ReplaceAll(_text,"|", ",");
                    var newText=ReplaceAll(_text1,"<b>","");
                    var newText2=ReplaceAll(newText,"<B>","");
                    var newText3=ReplaceAll(newText2,"</B>","");
                    var newDest=ReplaceAll(newText3,"</b>","");                                    
                    var _rid, _aid, _rlid, _locid, _type, _bType, _hCount,_d, _hotelid = " ";                        
                    if(CheckForValidObject(_ndDest[_rCount].getAttribute("m_r_id")))
                        _rid = _ndDest[_rCount].getAttribute("m_r_id");
                    if(CheckForValidObject(_ndDest[_rCount].getAttribute("m_a_id")))
                        _aid = _ndDest[_rCount].getAttribute("m_a_id");
                    if(CheckForValidObject(_ndDest[_rCount].getAttribute("m_re_id")))
                        _rlid = _ndDest[_rCount].getAttribute("m_re_id");
                    if(_rlid=="" && _rlid==null)
                    {
                        _rlid='0';
                    }
                    var _textValue = newDest;                       
                    var _destId = _rid+","+_aid+","+_rlid;                       
                    var _optionItem = new Option(_textValue, _destId);                       
                    ddlDidYouMeanDest.options[ddlDidYouMeanDest.length] = _optionItem;                    
                }
            }
        }        
    }
    if(ddlDidYouMeanDest.length <= 1)
    {
        _$("divDidYouMeanDest").style.display = "none";
        _$("divDestMessage").style.display = "block";
        _$("lblDestErrMessage").innerHTML = "Please enter a valid Destination!";      
    }  
}
function didYouMeanDestSelected()
{  
    var ddlDidYouMean = _$("ctl00_plhBody_ddlDidYouMeanDest");
    _$("divDestMessage").style.display = "none";
    var w = _$("ctl00_plhBody_ddlDidYouMeanDest").selectedIndex;
    _$("ctl00_plhBody_hidDestText").value = _$("ctl00_plhBody_ddlDidYouMeanDest").options[w].text;
    _$("ctl00_plhBody_txtDestination").value = _$("ctl00_plhBody_hidDestText").value;
    _$("ctl00_plhBody_hidDestValue").value = ddlDidYouMean.value;
    var _destId = _$("ctl00_plhBody_hidDestValue").value;
    var _destValues = _destId.split(",");
    var _destType=_destValues[3];
    if(_destType != null)
    {
         _$("hdnsetDate").value=_destType;
        if(_destType=="beach" || _destType=="Ski")
        {            
            populateDuration("7");
            setCheckOutDate("7");          
        }
        else
        {
            populateDuration("2");
            setCheckOutDate("2");            
        }
    }
    else
    {
        setCheckOutDate("7");
        populateDuration("7");
    }
    _$("divDidYouMeanDest").style.display = "none";
    return false;
}
function showCustomerFav()
{
    var cflnkTxt = _$("cust_fav_dest_link").innerHTML;
    cflnkTxt = cflnkTxt.substring(0, (cflnkTxt.length-1));
    
    if(_$("cust_fav_dest_list").style.display != "block")
    {        
        _$("cust_fav_dest_link").innerHTML = cflnkTxt + " -";
        _$("cust_fav_dest_list").style.display  = "block";
    }
    else
    {
        _$("cust_fav_dest_link").innerHTML = cflnkTxt + " +";
        _$("cust_fav_dest_list").style.display  = "none";
    }
 }
 function GetRegion(_rID,_aID,ddlType)
 {
    var theDate = new Date();
         var requestUrl = "/Search/AjaxImpl.aspx?page=RG&region="+_rID+"&area="+_aID+"&dt="+ theDate.getTime();
         var XmlHttp = CreateXmlHttp();
         if(XmlHttp)
	     {
		    XmlHttp.onreadystatechange = function()
		     { 
                if(XmlHttp.readyState == 4)
                {
	                if(XmlHttp.status == 200)
	                {
                        SetRegion(XmlHttp.responseText,ddlType); 
                    }
	             }
    		}    		
		    XmlHttp.open("GET", requestUrl,  true);    		
		    XmlHttp.send(null);		    	
	     }
 } 
function SetRegion(_xml,ddl)
{   
    if(ddl=='0')
    {
     var ddlRAR = _$("ctl00_plhBody_ddlRegion");
    }
    else if(ddl=='1')
    {
         var ddlRAR = _$("ctl00_plhBody_ddlArea");
    }
    else
    {
         var ddlRAR = _$("ctl00_plhBody_ddlResort");
    }
     var _optionItem;    
    for (var count = ddlRAR.options.length-1; count >-1; count--)
    {
	    ddlRAR.options[count] = null;
    }
    if(ddl!='2')
    {
        _optionItem = new Option( "-- Please Select --", "",  false, false);
        ddlRAR.options[ddlRAR.length] = _optionItem; 
    }
    else
    {
        _optionItem = new Option( "All Resorts", "-5",  false, false);
        ddlRAR.options[ddlRAR.length] = _optionItem; 
    }
    if(_xml!="")
    {  
        var _xmlDoc = Sarissa.getDomDocument();               
        _xmlDoc = (new DOMParser()).parseFromString(_xml, "text/xml");
        _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
        _xmlDoc.setProperty("SelectionLanguage", "XPath");
        var _ndDest, _ndCity, _ndR;
        _ndDest = _xmlDoc.selectNodes("RARs/RAR");    
        if(CheckForValidObject(_ndDest))
        {
            if(_ndDest.length > 0)
            {
                for(var _rCount=0; _rCount < _ndDest.length; _rCount++)
                {
                    var _text = _ndDest[_rCount].getAttribute("n");                
                    var _rid, _aid, _rlid, _locid, _type, _bType, _hCount,_d, _hotelid = " ";                        
                    if(CheckForValidObject(_ndDest[_rCount].getAttribute("id")))
                        _rid = _ndDest[_rCount].getAttribute("id");                        
                    var _textValue = RepSpecialChar(_text);                       
                    var _optionItem = new Option(_textValue, _rid);                       
                    ddlRAR.options[ddlRAR.length] = _optionItem;                    
                }
            }
        }        
    }
    if(ddlRAR.length <= 1)
    {
        ddlRAR.disabled = true;
        _length=true;
        for (var count = ddlRAR.options.length-1; count >-1; count--)
        {
	        ddlRAR.options[count] = null;
        }
        _optionItem = new Option( "-- Please Select --", "",  false, false);
        ddlRAR.options[ddlRAR.length] = _optionItem;      
    }
    else
    {
        ddlRAR.disabled = false;
        _length=false;        
    }
    if(_$("ctl00_plhBody_ddlArea").disabled==true)
    {
        _$("ctl00_plhBody_ddlResort").disabled=true;
    }    
} 
function selectRegion()
{
    _$("ctl00_plhBody_hidHotelText").value="Type your hotel name here";
    _$("ctl00_plhBody_hidHotelValue").value="";
    _$("ctl00_plhBody_txtHotel").value="Type your hotel name here";
    var ddlRegion = _$("ctl00_plhBody_ddlRegion");    
    var w = _$("ctl00_plhBody_ddlRegion").selectedIndex;
    _$("ctl00_plhBody_hidRARText").value = _$("ctl00_plhBody_ddlRegion").options[w].text;    
    _$("ctl00_plhBody_hidRegion").value = ddlRegion.value;   
    var _rId = _$("ctl00_plhBody_hidRegion").value;   
    if(_rId != null)
    {
       var status= GetRegion(_rId,'0','1');
    }   
    var ddlResort = _$("ctl00_plhBody_ddlResort");
    for (var count = ddlResort.options.length-1; count >-1; count--)
    {
	   ddlResort.options[count] = null;
    }
    _optionItem = new Option( "-- Please Select --", "",  false, false);
    ddlResort.options[ddlResort.length] = _optionItem;     
    document.getElementById("DestSearch").style.color='';    
} 
var _gap=function(){if(_length==true) {selectRAR(null);}else{selectRAR(true);}} 
function selectArea()
{
    var status;
    var ddlArea = _$("ctl00_plhBody_ddlArea");
    var w = _$("ctl00_plhBody_ddlArea").selectedIndex;
    _$("ctl00_plhBody_hidRARText").value +=","+ _$("ctl00_plhBody_ddlArea").options[w].text;
    var _rId = _$("ctl00_plhBody_hidRegion").value;
    var _aId=ddlArea.value;
    _$("ctl00_plhBody_hidArea").value=_aId;
    if(_rId != null && _aId != null)
    {
        GetRegion(_rId,_aId,'2');        
        setTimeout(_gap,1000);       
    } 
}
function selectRAR(state)
{
    var rarVal= _$("ctl00_plhBody_hidRARValue").value;
    if(rarVal!="" || rarVal!=null)
    {
        _$("ctl00_plhBody_hidRARValue").value="";
        _$("ctl00_plhBody_hidRARValue").value=null;
        _$("ctl00_plhBody_hidRARText").value="";
        _$("ctl00_plhBody_hidRARText").value=null;
        rarVal="";
        rarVal=null;
    }
    var ddlRegion = _$("ctl00_plhBody_ddlRegion");     
    var w = _$("ctl00_plhBody_ddlRegion").selectedIndex;
    _$("ctl00_plhBody_hidRARText").value = _$("ctl00_plhBody_ddlRegion").options[w].text;    
    _$("ctl00_plhBody_hidRARValue").value = ddlRegion.value;    
     var ddlArea = _$("ctl00_plhBody_ddlArea");    
     var x = _$("ctl00_plhBody_ddlArea").selectedIndex;
     _$("ctl00_plhBody_hidRARText").value +=","+ _$("ctl00_plhBody_ddlArea").options[x].text;
     _$("ctl00_plhBody_hidRARValue").value+=","+ ddlArea.value;
     var _rlText,_rlId;
     var ddlResort = _$("ctl00_plhBody_ddlResort");
     rarVal= _$("ctl00_plhBody_hidRARValue").value;
     if(state==true)
     {
        _rlText="All Resorts";
        _rlId="-5";        
     }
     else if(state==false)
     {          
         var z = _$("ctl00_plhBody_ddlResort").selectedIndex;
          _rlText= _$("ctl00_plhBody_ddlResort").options[z].text;
          _rlId = _$("ctl00_plhBody_ddlResort").value;          
      }
     if(_rlId==null||_rlId=="")
     {
         _$("ctl00_plhBody_hidRARValue").value+=","+ "0";
         rarVal +=","+ "-1";
          populateDuration("2");
          setCheckOutDate("2");
           _$("hdnsetDate").value="City";
     }
     else
     {
        _$("ctl00_plhBody_hidRARValue").value+=","+ _rlId;
        _$("ctl00_plhBody_hidRARText").value+=","+_rlText; 
         populateDuration("7");
         setCheckOutDate("7");
         _$("hdnsetDate").value="Beach";
     }
     var rarIDs=rarVal.split(',');
     if(rarIDs[0]==null ||rarIDs[0]==""||rarIDs[1]==null ||rarIDs[1]=="")
     {
        _$("divErr").style.display="block";
        _$("divErr").innerHTML="Please Enter a Valid Destination!";
        return false;
     }
     else
     {
          _$("divErr").style.display="none";
          _$("ctl00_plhBody_hidDestValue").value = _$("ctl00_plhBody_hidRARValue").value;
          _$("ctl00_plhBody_hidDestText").value=_$("ctl00_plhBody_hidRARText").value;
          _$("ctl00_plhBody_txtDestination").value=_$("ctl00_plhBody_hidDestText").value;       
          return false;
     }     
}
function ClearRAR()
{
    var ddlRegion = _$("ctl00_plhBody_ddlRegion");
    var ddlArea = _$("ctl00_plhBody_ddlArea");
    var ddlResort = _$("ctl00_plhBody_ddlResort");
    for (var count = ddlRegion.options.length-1; count >-1; count--)
    {
        ddlRegion.options[count] = null;
    }
    _optionItem = new Option( "-- Please Select --", "",  false, false);
    ddlRegion.options[ddlRegion.length] = _optionItem; 
    for (var count = ddlArea.options.length-1; count >-1; count--)
    {
        ddlArea.options[count] = null;
    }
    _optionItem = new Option( "-- Please Select --", "",  false, false);
    ddlArea.options[ddlArea.length] = _optionItem;    

    for (var count = ddlResort.options.length-1; count >-1; count--)
    {
        ddlResort.options[count] = null;
    }
    _optionItem = new Option( "-- Please Select --", "",  false, false);
    ddlResort.options[ddlResort.length] = _optionItem; 
}
 
function InitiliazeSlider(_sliderLabel,_gutter,_minKnob,_maxKnob,_minvalue,_maxvalue,type)
{   
	var parentDiv = $('price_select');
	parentDiv.setHTML('');
	var minDiv = new Element('div', {'id': 'min_slider'});
	minDiv.className = 'slider';
	var maxDiv = new Element('div', {'id': 'max_slider'});
	maxDiv.className = 'slider';
	minDiv.injectInside(parentDiv);
	maxDiv.injectInside(parentDiv);
	
	var mySlider = new Slider($('price_select'), $('min_slider'), 
	{
		start: 50,
		end: 100,
		offset: 5,
		knobheight: 19,
		onChange: function(pos)
		{
			$('price_label').setHTML('<br /><span class="slider_label_left">'+(pos.minpos)+'%</span><span class="slider_label_right">'+(pos.maxpos) + '%</span>');
		},
        onComplete: function(pos)
        {  
            if(parseInt($("hdnFilterFisrtTime").value)>0)
	        {	            
	                $("hdnMinP").value = pos.minpos;
                    $("hdnMaxP").value = pos.maxpos;
                    FilterDOD("0");            
	        }
            if(_sliderLabel=='price_label')
            {
               $(_sliderLabel).setHTML('<br /><span class="slider_label_left">'+pos.minpos+'%</span><span class="slider_label_right"> '+pos.maxpos+'%</span>');
            }
            
            if(parseInt($("hdnFilterFisrtTime").value)<3)
                $("hdnFilterFisrtTime").value = parseInt($("hdnFilterFisrtTime").value)+1;

	      }
	}, $('max_slider')).setMin(0).setMax(100);
	$('price_select').className = 'gutter';
	$('price_label').setAttribute('for', 'price_select');

}
function AboutUs()
{
       var tabVal=_$("ctl00_plhBody_hdnTabValue").value;
        document.frmTabVal.target='_self';
        document.frmTabVal.hdnTabVal.value =tabVal;
        document.frmTabVal.method = "POST";
        if(_$("ctl00_plhBody_hdndomain")!=null)
            document.frmTabVal.action = _$("ctl00_plhBody_hdndomain").value+"/Search/AboutUs.aspx";                            
        else
            document.frmTabVal.action = "/Search/AboutUs.aspx";                            
        document.frmTabVal.submit();
}
function ContactDetail()
{
    var tabVal=_$("ctl00_plhBody_hdnTabValue").value;
        document.frmTabVal.target='_self';
        document.frmTabVal.hdnTabVal.value =tabVal;
        document.frmTabVal.method = "POST";
        if(_$("ctl00_plhBody_hdndomain")!=null)
            document.frmTabVal.action = _$("ctl00_plhBody_hdndomain").value + "/Search/ContactDetail.aspx";                            
        else
            document.frmTabVal.action = "/Search/ContactDetail.aspx";                            
        document.frmTabVal.submit();
        return true;
}
function Home()
{
        var tabVal=_$("ctl00_plhBody_hdnTabValue").value;
        document.frmTabVal.target='_self';
        document.frmTabVal.hdnTabVal.value =tabVal;
        document.frmTabVal.method = "POST";
        if(_$("ctl00_plhBody_hdndomain")!=null)
            document.frmTabVal.action = _$("ctl00_plhBody_hdndomain").value + "/Search/HomePage.aspx";                            
        else
            document.frmTabVal.action = "/Search/HomePage.aspx";                            
        document.frmTabVal.submit();
        return true;
}
function destIntelliSearch(_page, _chr, _rq, dId)
{
    var requestUrl;
    var theDate = new Date();
    if(_chr!="")
    {
        if(_page=="destIntelli"||_page=="destQKIntelli")
        {
             requestUrl = "/Search/AjaxImpl.aspx?page="+_page+"&chr="+_chr.replace("&","amp;") +"&rq="+_rq+"&dt="+ theDate.getTime();
        }
        else
        {        
             requestUrl = "/Search/AjaxImpl.aspx?page="+_page+"&chr="+_chr.replace("&","amp;") +"&rq="+_rq+"&destId="+dId+"&dt="+ theDate.getTime();
        }    
         
         var XmlHttp = CreateXmlHttp();
         if(XmlHttp)
	     {
		    XmlHttp.onreadystatechange = function() { 
                if(XmlHttp.readyState == 4)
                {
	                if(XmlHttp.status == 200)
	                {
	                    switch (_page)
                        {
                            case 'destIntelli': 
                                destIntelliXmlDB(XmlHttp.responseText);   
	                            break;
	                        case 'hotIntelli':    
	                            hotelIntelliXml(XmlHttp.responseText);
	                            break;
	                        case 'destQKIntelli':    
	                            destQKIntelliXmlDB(XmlHttp.responseText);
	                            break;
	                    }
	                }
                }
	        }    		
		    XmlHttp.open("GET", requestUrl,  true);    		
		    XmlHttp.send(null);		
	     }
    }
}
function destIntelliXmlDB(_resultXml)
{
   if(_resultXml!="")
    {  
         var _sQ = _$("ctl00_plhBody_txtDestination").value;
         if(_sQ.length > 2)
         {
            var _xmlDoc = Sarissa.getDomDocument();               
            _xmlDoc = (new DOMParser()).parseFromString(_resultXml, "text/xml");            
            _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
            _xmlDoc.setProperty("SelectionLanguage", "XPath");            
            if(_cObj(_xmlDoc.selectNodes("ISD/UL/li")))
            {
                var _ndDest;
                _ndDest = _xmlDoc.selectNodes("ISD/UL/li");
                if(_cObj(_ndDest))
                {    
                    if(_xmlDoc.selectSingleNode("ISD").getAttribute("RCntr") == _rqDest)
                    {
                        if(_ndDest.length > 0)
                        {
                            var _div = _$("destDiv");
                            _div.style.display = 'block';
                            if (_div.hasChildNodes() )
                            {
                                while (_div.childNodes.length >= 1)
                                {  
                                     _div.removeChild(_div.firstChild);       
                                } 
                            }
                            var _ul = document.createElement('UL');
                            for(var _rCount=0; _rCount < _ndDest.length; _rCount++)
                            {
                                var _textValue = GetInnerHTML(_ndDest[_rCount]);
                                _textValue = ReplaceAll(_textValue,"|", ", ");
                                var _destId = _ndDest[_rCount].getAttribute("id");
                                var _li = createDestListItem(_destId, _textValue);
                               _ul.appendChild(_li);
                            }
                            if(_ul.innerHTML.indexOf('No Match Found')!=-1)
                            {
                                document.getElementById("DestSearch").style.color='Red';
                            }
                            else
                            {
                                document.getElementById("DestSearch").style.color='';
                            }
                            var bName = navigator.appName;
                            _itemCount = _ndDest.length;  
                            if(parseInt(_itemCount) > 12)
                            {
                                _div.style.height = "300px";
                                 _div.style.overflow = 'auto';                                                            
                            }
                            else
                            {
                                _div.style.height = "auto";
                                _div.style.overflow = "hidden";
                            }
                            _div.style.display = "inline";
                            _div.zIndex = "2000";
                            _div.appendChild(_ul);                            
                            var _destDivCon =  _$("destDivContainer");
                            _destDivCon.style.display = 'block';
                            
                            if (bName == "Microsoft Internet Explorer") 
                            {
                                var _iFrame = _$("destIFrame");
                                 _iFrame.style.display = 'block';
                                _iFrame.style.width = _div.offsetWidth-2;
                                _iFrame.style.height = _div.offsetHeight-2;
                                _iFrame.style.left = _$("destDivContainer").style.left;
                                _iFrame.style.top = _$("destDivContainer").style.top;                              
                            }
                            selChoice(0)
                        }
                        else
                        {
                            _$("destIFrame").style.display = 'none';
                            _$("destDiv").style.display = 'none';
                        }
                    }
                    else
                    {
                        _$("destIFrame").style.display = 'none';
                        _$("destDiv").style.display = 'none';
                    }
                    
                }              
            }
        }
    }
}
function createDestListItem(_destId, _textValue)
{
    var _li = document.createElement('LI');
   _li.id = _destId;   
   _li.innerHTML = _textValue;   
   _li.onmousedown = function() { destListSelected(_destId, _textValue); };
   _li.onmouseover = function() { _cursel = -1; selChoice(-1); _li.className = 'listItem'; };
   _li.onmouseout = function() { _li.className = ''; };   
   return _li;
}
function destListSelected(_destId, _textValue)
{
    if(_destId != "0,0,0")
    {
        _$("destIFrame").style.display = 'none';
        _$("destDiv").style.display = 'none';
         var newText=ReplaceAll(_textValue,"<b>","");
          var newText2=ReplaceAll(newText,"<B>","");
          var newText3=ReplaceAll(newText2,"</B>","");
          var newDest=ReplaceAll(newText3,"</b>","");        
        _$("ctl00_plhBody_txtDestination").value = newDest;
        _$("divDestMessage").style.display = "none";
        _$("divDidYouMeanDest").style.display = "none";
        _$("ctl00_plhBody_hidDestValue").value = _destId;
        _$("ctl00_plhBody_hidDestText").value = newDest;
        var _destId = _$("ctl00_plhBody_hidDestValue").value;
         _$("divDestMessage").style.display = "none";            
         _$("ctl00_plhBody_hidHotelText").value="Type your hotel name here";
         _$("ctl00_plhBody_hidHotelValue").value="";
       _$("ctl00_plhBody_txtHotel").value="Type your hotel name here";            
       var _destValues = _destId.split(",");
        var _type=_destValues[3];
        _$("hdnsetDate").value =_type;
        if(_type != null)
        {
            if(_type=="Beach" || _type=="Ski")
            {
                populateDuration("7");
                setCheckOutDate("7");
            }
            else
            {
                populateDuration("2");
                setCheckOutDate("2");
            }
        }
        else
        {
             populateDuration("7");
             setCheckOutDate("7");
        }
    }
    else
    {
         _$("ctl00_plhBody_txtDestination").value = "";
         _$("ctl00_plhBody_hidDestValue").value="";
    }    
   return false;
}
function hotelIntelliXml(_resultXml)
{
    if(_resultXml!="")
    {  
         var _sQ = _$("ctl00_plhBody_txtHotel").value;
         if(_sQ.length > 2)
         {
            var _xmlDoc = Sarissa.getDomDocument();               
            _xmlDoc = (new DOMParser()).parseFromString(_resultXml, "text/xml");            
            _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
            _xmlDoc.setProperty("SelectionLanguage", "XPath");            
            if(_cObj(_xmlDoc.selectNodes("ISHs/UL/li")))
            {
                var _ndDest;
                _ndDest = _xmlDoc.selectNodes("ISHs/UL/li");
                if(_cObj(_ndDest))
                {
                    if(_xmlDoc.selectSingleNode("ISHs").getAttribute("RCntr") == _rqHot)
                    {
                        if(_ndDest.length > 0)
                        {
                            var _div = _$("hotDiv");
                            _div.style.display = 'block';
                            if (_div.hasChildNodes() )
                            {
                                while (_div.childNodes.length >= 1)
                                {  
                                     _div.removeChild(_div.firstChild);       
                                } 
                            }
                            var _ul = document.createElement('UL');
                            for(var _rCount=0; _rCount < _ndDest.length; _rCount++)
                            {
                                var _textValue = GetInnerHTML(_ndDest[_rCount]);
                                _textValue = ReplaceAll(_textValue,"|", ", ");
                                var _destId = _ndDest[_rCount].getAttribute("id");
                                var _li = createHotListItem(_destId, _textValue);
                               _ul.appendChild(_li);
                            }
                            _itemCount = _ndDest.length;
                            _div.style.display = "inline";
                            _div.zIndex = "1000";
                            _div.appendChild(_ul);
                            
                            var _destDivCon =  _$("hotDivContainer");
                            _destDivCon.style.display = 'block';                            
                            var bName = navigator.appName;
                            if (bName == "Microsoft Internet Explorer") 
                            {
                                var _iFrame = _$("hotIFrame");
                                 _iFrame.style.display = 'block';
                                _iFrame.style.width = _div.offsetWidth-2;
                                _iFrame.style.height = _div.offsetHeight-2;
                                _iFrame.style.left = _$("hotDivContainer").style.left;
                                _iFrame.style.top = _$("hotDivContainer").style.top;
                            }
                            selChoice(0)
                        }
                        else
                        {
                            _$("hotIFrame").style.display = 'none';
                            _$("hotDiv").style.display = 'none';
                        }
                    }
                    else
                    {
                        _$("hotIFrame").style.display = 'none';
                        _$("hotDiv").style.display = 'none';
                    }
                    
                }
            }
        }
    }
}
function createHotListItem(_hotId, _textValue)
{
    var _li = document.createElement('LI');
   _li.id = _hotId;
   _li.innerHTML = _textValue;
   _li.onmousedown = function() { HotelListSelected(_hotId, _textValue); };
   _li.onmouseover = function() { _cursel = -1; selChoice(-1); _li.className = 'listItem'; };
   _li.onmouseout = function() { _li.className = ''; };   
   return _li;
}
function HotelListSelected(_hotId, _textValue)
{
    if(_hotId != "0,0,0")
    {
        _$("hotIFrame").style.display = 'none';
        _$("hotDiv").style.display = 'none';
          var newText=ReplaceAll(_textValue,"<b>","");
          var newText2=ReplaceAll(newText,"<B>","");
          var newText3=ReplaceAll(newText2,"</B>","");
          var newText4=ReplaceAll(newText3,"</b>","");      
        _$("ctl00_plhBody_txtHotel").value = RepSpecialChar(newText4);      
        _$("ctl00_plhBody_hidHotelValue").value = _hotId;
        _$("ctl00_plhBody_hidHotelText").value =newText4;
    }
    else
    {
       _$("ctl00_plhBody_txtHotel").value="";
       _$("ctl00_plhBody_hidHotelValue").value="";
       _$("ctl00_plhBody_hidHotelText").value="";        
    }  
    return false;
}
function destQKIntelliXmlDB(_resultXml)
{
    if(_resultXml!="")
    {  
         var _sQ = _$("ctl00_Header1_txtQKDestination").value;
         if(_sQ.length > 2)
         {
            var _xmlDoc = Sarissa.getDomDocument();               
            _xmlDoc = (new DOMParser()).parseFromString(_resultXml, "text/xml");            
            _xmlDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
            _xmlDoc.setProperty("SelectionLanguage", "XPath");            
            if(_cObj(_xmlDoc.selectNodes("ISD/UL/li")))
            {
                var _ndDest;
                _ndDest = _xmlDoc.selectNodes("ISD/UL/li");
                if(_cObj(_ndDest))
                {
                    if(_xmlDoc.selectSingleNode("ISD").getAttribute("RCntr") == _rqDest)
                    {
                        if(_ndDest.length > 0)
                        {
                            var _div = _$("destQKDiv");
                            _div.style.display = 'block';
                            if (_div.hasChildNodes() )
                            {
                                while (_div.childNodes.length >= 1)
                                {  
                                     _div.removeChild(_div.firstChild);       
                                } 
                            }
                            var _ul = document.createElement('UL');
                            for(var _rCount=0; _rCount < _ndDest.length; _rCount++)
                            {
                                var _textValue = GetInnerHTML(_ndDest[_rCount]);
                                _textValue = ReplaceAll(_textValue,"|", ", ");
                                var _destId = _ndDest[_rCount].getAttribute("id");
                                var _li = createQKDestListItem(_destId, _textValue);
                               _ul.appendChild(_li);
                            }
                            _itemCount = _ndDest.length;
                            _div.style.display = "inline";
                            _div.zIndex = "1000";
                            _div.appendChild(_ul);                            
                            var _destDivCon =  _$("destQKDivContainer");
                            _destDivCon.style.display = 'block';                            
                            var bName = navigator.appName;
                            if (bName == "Microsoft Internet Explorer") 
                            {
                                var _iFrame = _$("destQKIFrame");
                                 _iFrame.style.display = 'block';
                                _iFrame.style.width = _div.offsetWidth-2;
                                _iFrame.style.height = _div.offsetHeight-2;
                                _iFrame.style.left = _$("destQKDivContainer").style.left;
                                _iFrame.style.top = _$("destQKDivContainer").style.top;
                            }
                            selChoice(0)
                        }
                        else
                        {
                            _$("destQKIFrame").style.display = 'none';
                            _$("destQKDiv").style.display = 'none';
                        }
                    }
                    else
                    {
                        _$("destQKIFrame").style.display = 'none';
                        _$("destQKDiv").style.display = 'none';
                    }
                    
                }
            }
        }
    }
}
function createQKDestListItem(_destId, _textValue)
{
    var _li = document.createElement('LI');
   _li.id = _destId;
   _li.innerHTML = _textValue;
   _li.onmousedown = function() { destQKListSelected(_destId, _textValue); };
   _li.onmouseover = function() { _cursel = -1; selChoice(-1); _li.className = 'listItem'; };
   _li.onmouseout = function() { _li.className = ''; };   
   return _li
}
function destQKListSelected(_destId, _text)
{
    if(_destId !="0,0,0")
    {
        _$("destQKIFrame").style.display = 'none';
        _$("destQKDiv").style.display = 'none';
        
        var newText=ReplaceAll(_text,"<b>","");
          var newText2=ReplaceAll(newText,"<B>","");
          var newText3=ReplaceAll(newText2,"</B>","");
          var newDest=ReplaceAll(newText3,"</b>","");
          
        _$("ctl00_Header1_txtQKDestination").value = newDest;
         _$("divHeaderDestMessage").style.display = "none";
        _$("ctl00_Header1_hdnQkSearchValue").value = _destId;
        _$("ctl00_Header1_hdnQkSearchText").value =_text;
     }
     else
     {
        _$("ctl00_Header1_txtQKDestination").value ="";
        _$("ctl00_Header1_hdnQkSearchValue").value="";
        _$("ctl00_Header1_hdnQkSearchText").value="";       
     }
    return false;
}
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 = "";
    document.cookie = name+"="+value+expires+"; path=/";
    return false;

}
function getCookie(name)
{
var cVal ="";
var ca = document.cookie.split(';');
var nameEQ = name + "=";
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)
    cVal = c.substring(nameEQ.length, c.length); 
}
return cVal;
}
function eraseCookie(name)
{
    createCookie(name, "", -1);
    return false;
}
function destLen(strDest){
    var len=strDest.length;
    if(len > 20)
    {
        strDest=strDest.substring(0,17)+"..";
    }
     return strDest;
}
function CFdestLen(strDest){
    var len=strDest.length;
    if(len > 16)
    {
        strDest=strDest.substring(0,13)+"..";
    }
     return strDest;
}
function checkloadjsfile(filename)
{
 if (filesadded.indexOf("["+filename+"]")==-1)
 {
  loadjscssfile(filename)
  filesadded+="["+filename+"]";
 }
}
function loadjscssfile(filename)
{
    var fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript")
    fileref.setAttribute("src", filename)
    fileref.setAttribute("language", "javascript")

    if (typeof fileref!="undefined")
        document.getElementsByTagName("head")[0].appendChild(fileref)
}
function scriptbinding()
{
    checkloadjsfile('/Search/JavaScript/sarissa/sarissa-table-utils.js');
    checkloadjsfile('/Search/JavaScript/sarissa/sarissa-mediawiki.js');
    checkloadjsfile('/Search/JavaScript/Intelli.js');
}