﻿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=="FNHDIDYOUMEAN")
     {
        var requestUrl = "/Search/AjaxImpl.aspx?page=FnHind&sq="+req+"&dt="+ theDate.getTime();
     }
     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') {var spxml=XmlHttp.responseText; if(spxml.indexOf("[")!=-1) spxml=spxml.replace("{ 'Ofs': { 'DV': [ ","{ 'Ofs': { 'DV': [ {'I': {'a': '', 'id': '9999', 'n': 'Competition Banner', 't': 'Image', 'u': '\/Search\/images\/homepage\/win-camera-comp-hol-night.jpg' }, 't': 'Beach', 'TI': {'aid': '647', 'b': 'self catering', 'cr': '', 'hid': '-1', 'hname': 'testhotel', 'ot': 'H', 'p': '0.0', 'r': '4', 'rid': '28', 'rlid': '667', 't': '\"Win 7 nights stay + a Lumix camera\"' } } , {'I': {'a': '', 'id': '9999', 'n': 'testnew', 't': 'Image', 'u': '\/Search\/images\/homepage\/hn2_reviewcentre_banner2_stripped.jpg' }, 't': 'Beach', 'TI': {'aid': '647', 'b': 'self catering', 'cr': '', 'hid': '-1', 'hname': 'testhotel', 'ot': 'H', 'p': '0.0', 'r': '4', 'rid': '28', 'rlid': '667', 't': '\"Cheapest online & Easy to Book\"' } },{'I': {'a': '', 'id': '9999', 'n': 'testnew', 't': 'Image', 'u': '\/Search\/images\/homepage\/kids-free-hol-night-banner.jpg' }, 't': 'Beach', 'TI': {'aid': '647', 'b': 'self catering', 'cr': '', 'hid': '-1', 'hname': 'testhotel', 'ot': 'H', 'p': '0.0', 'r': '4', 'rid': '28', 'rlid': '667', 't': '\"55,000 kids go free\"' } },"); else { spxml=spxml.replace("{ 'Ofs': {'DV': ","{ 'Ofs': {'DV': [ {'I': {'a': '', 'id': '9999', 'n': 'Competition Banner', 't': 'Image', 'u': '\/Search\/images\/homepage\/win-camera-comp-hol-night.jpg' }, 't': 'Beach', 'TI': {'aid': '647', 'b': 'self catering', 'cr': '', 'hid': '-1', 'hname': 'testhotel', 'ot': 'H', 'p': '0.0', 'r': '4', 'rid': '28', 'rlid': '667', 't': '\"Win 7 nights stay + a Lumix camera\"' } } , {'I': {'a': '', 'id': '9999', 'n': 'testnew', 't': 'Image', 'u': '\/Search\/images\/homepage\/hn2_reviewcentre_banner2_stripped.jpg' }, 't': 'Beach', 'TI': {'aid': '647', 'b': 'self catering', 'cr': '', 'hid': '-1', 'hname': 'testhotel', 'ot': 'H', 'p': '0.0', 'r': '4', 'rid': '28', 'rlid': '667', 't': '\"Cheapest online & Easy to Book\"' } },{'I': {'a': '', 'id': '9999', 'n': 'testnew', 't': 'Image', 'u': '\/Search\/images\/homepage\/kids-free-hol-night-banner.jpg' }, 't': 'Beach', 'TI': {'aid': '647', 'b': 'self catering', 'cr': '', 'hid': '-1', 'hname': 'testhotel', 'ot': 'H', 'p': '0.0', 'r': '4', 'rid': '28', 'rlid': '667', 't': '\"55,000 kids go free\"' } },"); spxml=spxml.replace("} } }}","} } ] }}");}  SpecialOffer(spxml,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" || type=="FNHDIDYOUMEAN") { 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)
{ 
    try{
    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))
       {           
           var ob = eval('(' + _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;
            }
            _ndOffers = ob.Ofs.DV;
            if(type=='0')
            {
                if(_ndOffers.I == null) beachOffLen=_ndOffers.length-1; else beachOffLen = 1;
            }
            else if(type=='1')
            {
                if(_ndOffers.I == null) cityOffLen=_ndOffers.length-1; else cityOffLen = 1;
            }
            else
            {
                if(_ndOffers.I == null) skiOffLen=_ndOffers.length-1; else skiOffLen = 1;
            }
            if(_ndOffers.I != null || _ndOffers.length > 0)
             {  
                if(_ndOffers.I != null || count <= _ndOffers.length-1)
                {  
                    if(_ndOffers.I != null) { _ndOffer=_ndOffers.I; _nddesc =_ndOffers.TI; }
                    else { _ndOffer=_ndOffers[count].I; _nddesc =_ndOffers[count].TI; }                    
                    div=_$("beach_offer");                                  
                    img=_$('image');
                    if(CheckForValidObject(_ndOffer))
                    {
                        if(_ndOffer.u!="")
                        {
                            img.src=_ndOffer.u.replace("&amp;","&").replace("www2.","www.");
                        }
                        img.title=_ndOffer.n;
                        img.alt=_ndOffer.a;
                        img.width='564';
                        img.height='210';
                        a=document.createElement('A');
                        if(count==0 && type=='0')
                        linkref = "http://www.onholidayblog.co.uk/win-3-fantastic-prizes/";
                        else if(count<3 && type=='0')
                        linkref='#';
                        else                        
                        linkref = "/cheap-hotels/"+(RepSpecialChar(_nddesc.hname)).replace(/ /g,'-').replace(/&/g,'and')+"/"+_nddesc.hid+"-"+type;
                        a.href= linkref;
                        if(count==0 && type=='0')
                        a.target="_blank";
                        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;
                    if(count==0 && type=='0')
                        a2.target="_blank";
                    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.t).replace(/&apos;/g,"'");
                    div5.appendChild(lbl);                    
                    smDiv=document.createElement('DIV');
                    smDiv.className="offer_small_text";
                    spn=document.createElement('Span');
                    spn.style.color="#FED100";                    
                    if(_nddesc.cr!="")
                    {
                        spn.innerHTML="<BR>"+"User rating "+parseInt(_nddesc.cr)+"% ";
                    }
//                    else if(count==0 && type=='0')
//                    {
//                        spn.style.textDecoration="underline";
//                        spn.innerHTML = "<BR>Read more";
//                    }
                    else if(count<3 && type=='0')
                        spn.innerHTML='';
                    else                    
                    {
                        spn.innerHTML="<BR>"+"User rating 0% ";
                    }
                    smDiv.appendChild(spn);
                    div5.appendChild(smDiv);
                    if(!(count<3 && type=='0'))
                    {
                    smDiv.innerHTML +="&nbsp;"+_nddesc.r+" star,  ";
                    smDiv.innerHTML +="&nbsp;"+_nddesc.b+"  ";
                    }
                    div5.appendChild(smDiv);
                    a2.appendChild(div5);
                    div1.appendChild(a2);
                    if(!(count<3 && type=='0'))
                    {
                    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>"+ (chkrURL.indexOf('holidaynights.ie')== -1 ?"&pound;":"&euro;")+parseFloat(_nddesc.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,6000);
                }
                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);  
                }
            }
         }                  
      }    
  } 
  }
  catch (e)  { } 
}
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)
{   _$("linkVF_CV").style.display = 'none';
    _$("best_deals_box").style.padding='0';
    _$("best_deals_box").style.border='none';
    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.style.borderLeft='1px solid #683FD9';
                     table.style.borderRight='1px solid #683FD9';
                     table.style.borderBottom='1px solid #683FD9';
                     table.style.width='580px';
                     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=(chkrURL.indexOf('holidaynights.ie')== -1 ?"&pound;":"&euro;")+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="&nbsp;&nbsp;"+Pr;
                                     trRecord.appendChild(td);
                               }
                           }                           
                        }                   
             }
        }                  
    } 
    else if(_$("VF_CSDiv")!=null) { _$("VF_CSDiv").innerHtml = ""; _$("VF_CSDiv").style.display = "none"; }                   
}
function HomeVF(_dodXml,flag,type)
{
    _$("linkVF_CV").style.display = 'block';
    _$("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");
            mainDiv=_$("best_deals_box");
            mainDiv.style.border='5px solid #009DE8';
            mainDiv.style.padding='10px';
            mainDiv.style.float='left';
            mainDiv.style.width='550px';
            _$("best_deals_tab").style.background = "url(/Search/images/homepage/home_tabon.gif) no-repeat right";
            _$("highest_rating_tab").style.background ="url(/Search/images/homepage/home_taboff.gif) no-repeat right";
            
            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";   
                }
//                outDiv.style.padding='10px';
//                outDiv.style.border='5px solid #009DE8';
//                outDiv.style.float='left';
//                outDiv.style.width='550px';
                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="/city-breaks/"+_rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+_aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aId+"-"+type;
                            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="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                        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 "+(chkrURL.indexOf('holidaynights.ie')== -1 ?"&pound;":"&euro;")+"<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.alt = hName;
                                img.style.width = "165px";
                                img.style.height = "123px";
                                a.appendChild(img);
                                a.href="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                                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="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                                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="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                           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="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                           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="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                            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 =50;
        _$("ImgCust").src = '/Search/images/homepage/average.jpg';
     }
     else
     {
        if(_minR<51 ){startSet=50; endSet=50;_$("ImgCust").src = '/Search/images/homepage/average.jpg';}
        if(_minR>50 && _minR<61){startSet=51;endSet=60;_$("ImgCust").src = '/Search/images/homepage/good.jpg';}        
        if(_minR>60 && _minR<71){startSet=61;endSet=70;_$("ImgCust").src = '/Search/images/homepage/very-good.jpg';}        
        if(_minR>70 && _minR<81){startSet=71;endSet=80;_$("ImgCust").src = '/Search/images/homepage/smashing.jpg';}        
        if(_minR>80 && _minR<91){startSet=81;endSet=90;_$("ImgCust").src = '/Search/images/homepage/amazing.jpg';}        
        if(_minR>90 && _minR<101){startSet=91;endSet=100;_$("ImgCust").src = '/Search/images/homepage/exceptional.jpg';}
     }   
     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)
{
    try { var ul,li,dName; var div=_$("FeatureDest");
    if(_fdXml!="")
    {        
        var ob = eval('(' + _fdXml + ')');     
        var _ndFDests;
        _ndFDests = ob.FDs.FD;
            if(CheckForValidObject(_ndFDests))
            {  
                if(_ndFDests.rid != null || _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);
                         if(_ndFDests.rid != null) var fdlen = 1;
                         else var fdlen = _ndFDests.length;                   
                         for(var count=0; count <fdlen; count++)
                         {
                             if(_ndFDests.rid != null) var _ndFDests1 = _ndFDests;
                             else var _ndFDests1 = _ndFDests[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(_ndFDests1.rn);
                             aName=RepSpecialChar(_ndFDests1.an);
                             rlName=RepSpecialChar(_ndFDests1.rln);                             
                             var aid=_ndFDests1.aid;
                             var rid=_ndFDests1.rid;
                             var rlid=_ndFDests1.rlid;
                             var rarType=_ndFDests1.t;
                             if(rarType=="Beach")
                             {
                                if(_$("ctl00_plhBody_hdndomain")!=null)
                                    a.href=_$("ctl00_plhBody_hdndomain").value+"/beach-holiday/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlid+"-"+type;
                                else
                                    a.href="/beach-holiday/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlid+"-"+type;
                                a.innerHTML=destLen(rlName);
                             }
                             else
                             {
                                if(_$("ctl00_plhBody_hdndomain")!=null)
                                    a.href=_$("ctl00_plhBody_hdndomain").value+"/city-breaks/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aid+"-"+type;
                                else
                                    a.href="/city-breaks/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aid+"-"+type;
                                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 ); 
             } 
         }
    }
    }
    catch(e) { }
}
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;    
    if(sPath.indexOf('co.uk')!= -1) { var sPage = sPath.substring(sPath.lastIndexOf('co.uk/') + 6); }
    else { var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); }    
    if(sPage=="" || sPage=="HomePage.aspx")
    {
        _$("best_deals_box").style.display = "block";
        _$("customer_fav_box").style.display = "none";
        if(_$("skiset2") != null) {_$("skiset2").style.display="none";}
        if(_$("ctl00_plhBody_hdnSpOfferBeach").value == '' || _$("ctl00_plhBody_hdnBeachDODXml").value == '' || _$("ctl00_Footer1_hdnBeachFD").value == '')
        {
            _$("ctl00_plhBody_hdnTabValue").value="";
            _$("ctl00_plhBody_hdnTabValue").value = "0";
            clearTimeout(s2);
            clearTimeout(s3);
            HomePageCall();
            if(_$("ctl00_plhBody_hdnCFavBeach").value == '') { AjaxHomeRequest("CF",0); } else { CustomerFavourites( _$("ctl00_plhBody_hdnCFavBeach").value,'0'); }    
            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);
            if(_$("ctl00_plhBody_hdnCFavBeach").value == '') { AjaxHomeRequest("CF",0); } else { CustomerFavourites( _$("ctl00_plhBody_hdnCFavBeach").value,'0'); }                
            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;
    if(sPath.indexOf('co.uk')!= -1) { var sPage = sPath.substring(sPath.lastIndexOf('co.uk/') + 6); }
    else { var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); }    
    if(sPage=="" || 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;
    if(sPath.indexOf('co.uk')!= -1) { var sPage = sPath.substring(sPath.lastIndexOf('co.uk/') + 6); }
    else { var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); }    
    if(sPage=="" || 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
    {   
       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;
            setupCal(null, null, "ctl00_plhBody_hotelCheckin", "ctl00_plhBody_checkoutValue", "checkinCalContainer", "checkoutCalContainer",2);
        }
    }
    return false;
}
function populateDuration(_dur)
{
    var _duration = _$("ctl00_plhBody_duration");
    _duration.value = _dur;  
}
function setDates()
{
    var _dType = _$("hdnsetDate").value;
    _$("ctl00_plhBody_CheckOut").value = "";
    var _checkIn = _$("ctl00_plhBody_hotelCheckin").value;    
    var x=_checkIn.split("-");  
     var c=x[1]+"/"+x[0]+"/"+ x[2];    
    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 ;
	if(url.indexOf('MFHNSignUp')!=-1)
        newwindow=window.open(url,'','height=650,location=no,width=650,scrollbars=yes,resizable=1');
    else
        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');
    try {
    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!="")
    {
        var ob = eval('(' + _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(_customFavXML))
        {
            var _ndCFavs,_ndDestCFavs;
            _ndCFavs = ob.CFs.H;
            _ndDestCFavs=ob.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].rid;
                            aId=_ndDestCFavs[_dCount].aid;
                            rlId=_ndDestCFavs[_dCount].rlid;
                            destType=_ndDestCFavs[_dCount].t;
                            rName = RepSpecialChar(_ndDestCFavs[_dCount].rn);
                            aName = RepSpecialChar(_ndDestCFavs[_dCount].an);
                            rlName = RepSpecialChar(_ndDestCFavs[_dCount].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="/beach-holiday/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlId+"-"+type;
                            }
                            else
                            {
                                 a.innerHTML=CFdestLen(aName);
                                 a.href="/city-breaks/"+rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aId+"-"+type;
                            }
                            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].x;
                        lat=_ndCFavs[_cfCount].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].rnm);
                        var _aName=RepSpecialChar(_ndCFavs[_cfCount].anm);
                        var _rlName=RepSpecialChar(_ndCFavs[_cfCount].rlnm);                        
                        rId=_ndCFavs[_cfCount].rid;
                        aId=_ndCFavs[_cfCount].aid;
                        rlId=_ndCFavs[_cfCount].rlid;                        
                        var rar=document.createTextNode(_rName);
                        p.appendChild(rar);                                                
                        a=document.createElement('A');                        
                        if(_rlName!="")
                        {
                            p.appendChild(document.createTextNode(" > "+_aName+" > "));
                            a.href="/beach-holiday/"+_rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+_aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+_rlName.replace(/ /g,'-').replace(/&/g,'and')+"/"+rlId+"-"+type;  
                            a.innerHTML= _rlName;                            
                        }
                        else
                        {
                            p.appendChild(document.createTextNode(" > "));
                            a.href="/city-breaks/"+_rName.replace(/ /g,'-').replace(/&/g,'and')+"/"+_aName.replace(/ /g,'-').replace(/&/g,'and')+"/"+aId+"-"+type;
                            a.innerHTML = _aName;
                        }                       
                        p.appendChild(a);                 
                        div1.appendChild(p);                       
                        spn=document.createElement('SPAN');
                        a=document.createElement('A');
                        hName=_ndCFavs[_cfCount].n;
                        hName=RepSpecialChar(hName);
                        a.innerHTML=hName;
                        hid=_ndCFavs[_cfCount].hid;
                        a.href="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                        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].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].rvs!="" && _ndCFavs[_cfCount].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].cr;
                              var cusReviews=_ndCFavs[_cfCount].rvs;
                              var reviewLink=ReviewWindow(cusRating,cusReviews);
                              reviewLink.appendChild(div2);                             
                              p=document.createElement('P');
                              spn=document.createElement('SPAN');
                              spn.innerHTML=parseInt(_ndCFavs[_cfCount].cr)+"%&nbsp;";
                              p.appendChild(spn);                            
                               if(_ndCFavs[_cfCount].rvs!="")
                               {
                                  var  text1 = document.createTextNode(_ndCFavs[_cfCount].rvs+" reviews");
                               }
                               else
                               {
                                   var  text1 = document.createTextNode(" 0 reviews"); 
                               }
                              p.appendChild(text1);
                              div2.appendChild(p);
                              div.appendChild(reviewLink);
                        }   
                              if(_ndCFavs[_cfCount].lp!="" && _ndCFavs[_cfCount].lp!="0.00")
                                {
                                    div3=document.createElement('DIV');
                                    div3.className="blue_price";                            
                                    div3.innerHTML="from "+(chkrURL.indexOf('holidaynights.ie')== -1 ?"&pound;":"&euro;")+"<strong>"+parseFloat(_ndCFavs[_cfCount].lp).toFixed(2)+"</strong>&nbsp;pppn";
                                    div.appendChild(div3);
                                }                                                
                            var _ndImage=_ndCFavs[_cfCount].Is.I;
                            if(CheckForValidObject(_ndImage))
                            {                            
                                div4=document.createElement('DIV');
                                div4.className="accomm_pic";
                                a=document.createElement('A');
                                img=document.createElement('IMG');                                
                                if(_ndImage.u!="")
                               img.src=_ndImage.u.replace("&amp;","&");
                                else
                                img.src = '/Search/images/1/noimage_106x80.gif';
                                img.alt=hName;                                 
                                img.style.width = "165px";
                                img.style.height = "123px";
                                a.appendChild(img);
                                a.href="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                                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.n;
                                img.alt=_ndImage.a;
                                a.appendChild(img);
                                a.href="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                                div4.appendChild(a);
                                div.appendChild(div4);
                             }                            
                           div5=document.createElement('DIV');
                           div5.className="accomm_desc";
                           p=document.createElement('P');
                           var descp=_ndCFavs[_cfCount].d;
                           var desc =document.createTextNode(RepSpecialChar(descp));
                           var moreInfoLink=document.createElement('a');
                           moreInfoLink.href="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                           moreInfoLink.innerHTML="more info"; 
                           p.appendChild(desc);
                           p.appendChild(moreInfoLink);
                           div5.appendChild(p);                           
                           p=document.createElement('P');
                           var _ndFacl=_ndCFavs[_cfCount].F;
                           var keys="";
                           if(_ndFacl!=null)
                           for(fCount=0;fCount<_ndFacl.length; fCount++)
                           {
                              keys += _ndFacl[fCount].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].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="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                            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="/cheap-hotels/"+hName.replace(/ /g,'-').replace(/&/g,'and')+"/"+ hid+"-"+type;
                            a.innerHTML = "More info&nbsp;";
                            div5.appendChild(a); 
                                                                       
                            if(_ndCFavs[_cfCount].ist=="1")
                            {
                                var rgId="";
                                var arId="";
                                var rsId="";
                                rgId=_ndCFavs[_cfCount].rid;
                                arId=_ndCFavs[_cfCount].aid;
                                rsId=_ndCFavs[_cfCount].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);
                        }
              }
           }
        }
        }
        catch (e) { }
       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.indexOf("Private")!= -1)
                        {
                            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("Private Transfer")!= -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 = (chkrURL.indexOf('holidaynights.ie')== -1 ?"&pound;":"&euro;")+parseFloat(tFprice).toFixed(2)+'<span style="font-size:10px;">&nbsp;per person</span>'; }     
                                    else { tFprice = (chkrURL.indexOf('holidaynights.ie')== -1 ?"&pound;":"&euro;")+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);
                            }
                            else if(currency == 'EUR')
                            {
                                tFprice = '&euro;'+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(rlName== 'All Resorts')
            {
                rlName = 'AllResorts';
                _rlid=_aid;
            }
            if(_$("ctl00_plhBody_hdndomain")!=null)
                location.href=_$("ctl00_plhBody_hdndomain").value+"/beach-holiday/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/" + aName.replace(/ /g,'-').replace(/&/g,'and') + "/" + rlName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_rlid+"-0";
            else
                location.href="/beach-holiday/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/" + aName.replace(/ /g,'-').replace(/&/g,'and') + "/" + rlName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_rlid+"-0";
        }
        else if(type=="City")
        {
            if(_$("ctl00_plhBody_hdndomain")!=null)
                location.href=_$("ctl00_plhBody_hdndomain").value+"/city-breaks/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/" + aName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_aid+"-1";
            else
                location.href="/city-breaks/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/" + aName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_aid+"-1";
        }
        else
        {
            if(_$("ctl00_plhBody_hdndomain")!=null)
                location.href=_$("ctl00_plhBody_hdndomain").value+"/city-breaks/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/"+aName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_aid+"-2";
            else
                location.href="/city-breaks/" + rName.replace(/ /g,'-').replace(/&/g,'and') + "/"+aName.replace(/ /g,'-').replace(/&/g,'and') + "/"+_aid+"-2";
            
        }
        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)
{
  if(!validate_passengers()) { alert("Please call us free on 0800 091 3888 to book multiple rooms with different occupancies."); return false;}
  if(!val_ch_age()) { alert("Please enter the ages of all the children less than 13 years and greater than a year."); return false;}
  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;
            if(_$("hidFnH") != null && _$("hidFnH").value == "2")
            { AjaxHomeRequest(_$("ctl00_plhBody_txtDestination").value,"FNHDIDYOUMEAN"); }
            else
            { AjaxHomeRequest(_$("ctl00_plhBody_txtDestination").value,"DIDYOUMEAN"); }
        }
        _$("ctl00_plhBody_txtDestination").focus();
        _$("divDestMessage").style.display = "none";
        return false;
    }    
    if(_$("ctl00_plhBody_hotelCheckin").value=="") { if(_$("hidFnH") != null && _$("hidFnH").value == "2") {  alert("Please provide the Departure Date!"); return false; } else { alert("Please provide the Arrival Date!"); return false; } }
    if(_$("ctl00_plhBody_checkoutValue").value=="")  { if(_$("hidFnH") != null && _$("hidFnH").value == "2") {  alert("Please provide the Return Date!"); return false; } else { alert("Please provide the Departure Date!"); return false; } }
    if(_$("hidFnH") != null && _$("hidFnH").value != "2") if(!val3dchin(_$("ctl00_plhBody_hotelCheckin").value)) { alert("We can book same day and next day departures over the phone - please call 0800 091 3888."); _$("ctl00_plhBody_hotelCheckin").focus(); return false; }
    var val="";   
    if(_cObj(_$("hidFnH")) && _$('hidFnH').value != '2' && _$("ctl00_plhBody_rooms_select_id") != null)
    {
       var _roomValues=""; _rooms = _$("ctl00_plhBody_rooms_select_id").value; _roomsValue=_rooms;      
       for(var _roomCount=1; _roomCount<=_rooms; _roomCount++)
       {
            var _adultValue = _$("ctl00_plhBody_ddlAdult"+_roomCount).value; _adultValue = parseInt(_adultValue); _adultsValue = _adultValue;
            var _chValue = _$("ctl00_plhBody_ddlChild"+_roomCount).value; _chValue = parseInt(_chValue); _childsValue += _chValue;
            if(_chValue >0) { for(var i=1; i<=_chValue; i++) { if(i==1) { _cAge=_$("ctl00_plhBody_txtChild"+_roomCount+''+i).value; } else { _cAge =_cAge+"-"+_$("ctl00_plhBody_txtChild"+_roomCount+''+i).value; } }  } else { _cAge ="0"; } 
            _roomValues +=(_roomCount)+":"+_adultValue+":"+_chValue+":"+_cAge+"!";
            _cAge="";            
       }
       _$("ctl00_plhBody_hidRoomValues").value = _roomValues;
   }
   else {  _adultsValue = parseInt(_$("ctl00_plhBody_ddlAdultFnH").value); _childsValue = parseInt(_$("ctl00_plhBody_ddlChildFnH").value); var _infantvalue = parseInt(_$("ctl00_plhBody_ddlInfantFnH").value); _roomValue="1:"+_adultsValue + ":"+_childsValue+":"+_infantvalue+"!";  _$("ctl00_plhBody_hidRoomValues").value = _roomValue;}
    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; _hotelName = ReplaceAll(_hotelName,'/','or'); _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;
    var _iataC,ddlApt=_$("ctl00_plhBody_ddlAirportFnH"); if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2' && _cObj(ddlApt)) { _iataC = ddlApt.value;if(_iataC =='-1'){alert('Please select a departure airport'); return false; }  }
    _boardValue =_$("ctl00_plhBody_ddlboard").value;if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2' && _boardValue =='-1'){alert('Please select a Board Basis'); return false; } 
    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; 
    if(_$("hidFnH")!=null && _$("hidFnH").value == "2") { _sb += "||" + _iataC + "||" + ddlApt.options[ddlApt.selectedIndex].text; }
    _$("ctl00_plhBody_hidPriceReqValues").value = _sb;
    if(_$("hidFnH")!=null && _$("hidFnH").value == "2") { } else {  getPriceStaticXml(_airId); }    
    var sb = _rid; sb += "||"; sb += _aid; sb += "||"; sb += _rlid; sb += "||"; sb +=RepSpecialChar(_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;
    if(_$("hidFnH")!=null && _$("hidFnH").value == "2") { sb += "||" + _iataC + "||" + ddlApt.options[ddlApt.selectedIndex].text; createCookie("FnHHN2", sb, 1); createCookie("browsing","FnH",1); }
    else { createCookie("HN2", sb, 1); createCookie("browsing","H",1); }
    createCookie("HN2Duration", _durValue, 1);   
    _$("hidPriceResult").value = sb;    
    if(_$("hidFnH")!=null && _$("hidFnH").value == "2")
    { 
        document.myformPrice.target='_self'; document.myformPrice.hidPriceResult.value =sb; document.myformPrice.method = "POST"; document.myformPrice.action = "/Search/PriceResultFnH.aspx"; document.myformPrice.submit();
    }
    else
    {
        sb = ReplaceAll(sb,"'","#~#");
        setTimeout("CPRP('"+sb+"')",500);
//        if(_flag==99 && _hotId!="-1")
//        {
//            _hotelName = RepSpecialChar(_hotelName).replace(/ /g,'-').replace(/&/g,'and');
//            setTimeout("CHPRP('"+sb+"','"+_hotelName+"','"+_hotId+"')",500);
//        }
//        else
//        {
//            //document.myformPrice.target='_self'; if(_$("ctl00_plhBody_hdnShowSupplier")!=null && _$("ctl00_plhBody_hdnShowSupplier").value!='0' ) document.myformPrice.hidPriceResult.value =sb+"||"+_$("ctl00_plhBody_hdnShowSupplier").value; else document.myformPrice.hidPriceResult.value =sb+"||0"; document.myformPrice.method = "POST"; document.myformPrice.action = "/Search/PriceResult.aspx"; document.myformPrice.submit();            
//            setTimeout("CPRP('"+sb+"')",500);
//        }
    }
    return false;
}
function CHPRP(srchprm,prmhname,prmhid) { srchprm = ReplaceAll(srchprm,"#~#","'"); document.myformPrice.target='_self'; document.myformPrice.hidPriceResult.value =srchprm; document.myformPrice.method = "POST"; document.myformPrice.action = "/cheap-hotels/"+prmhname+"/"+ prmhid+"-"+$("ctl00_plhBody_hdnTabValue").value; document.myformPrice.submit();}
function CPRP(srchprm) { srchprm = ReplaceAll(srchprm,"#~#","'"); document.myformPrice.target='_self'; if(_$("ctl00_plhBody_hdnShowSupplier")!=null && _$("ctl00_plhBody_hdnShowSupplier").value!='0' ) document.myformPrice.hidPriceResult.value =srchprm+"||"+_$("ctl00_plhBody_hdnShowSupplier").value; else document.myformPrice.hidPriceResult.value =srchprm+"||0"; document.myformPrice.method = "POST"; document.myformPrice.action = "/Search/PriceResult.aspx"; document.myformPrice.submit();}
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];
    var durlast = "";
    if(getCookie("HN2Duration")!=null && getCookie("HN2Duration")!="" && _$('hidFnH').value!="2") durlast= getCookie("HN2Duration");
    if(_destType != null)
    {         
         _$("hdnsetDate").value=_destType;
        if(_destType=="beach" || _destType=="Ski")
        {          
            if(durlast==null || durlast!="") { durlast = "7"; }
            populateDuration(durlast);
            setCheckOutDate(durlast);          
        }
        else
        {
            if(durlast==null || durlast!="") { durlast = "2"; }
            populateDuration(durlast);
            setCheckOutDate(durlast);            
        }
    }
    else
    {
        if(durlast==null || durlast!="") { durlast = "7"; }
        populateDuration(durlast);
        setCheckOutDate(durlast);
    }
    _$("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 requestUrl;
    var theDate = new Date();
    if(_$("hidFnH")!=null && _$("hidFnH").value == "2")
        requestUrl = "/Search/AjaxImpl.aspx?page=FnHRG&region="+_rID+"&area="+_aID+"&dt="+ theDate.getTime();
    else
        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);		    	
	     }
 }
 var _gap=function(){if(_length==true) {selectRAR(null);}else{selectRAR(true);}}  
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 { if(_$("hidFnH")==null || _$("hidFnH").value == "1") { _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(_$("hidFnH")!=null && _$("hidFnH").value == "2" )
    {
        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);
        ddlAR.options[ddlRAR.length] = _optionItem; 
        }
        else
        {
        ddlRAR.disabled = false;
        _length=false;
        if(ddl=='2') selectRAR(true);                
        }
    }
    else 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='';    
} 
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'); if(_$("hidFnH")==null || _$("hidFnH").value == "1" ) 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; }
     var durlast = "";
     if(getCookie("HN2Duration")!=null && getCookie("HN2Duration")!="" && _$('hidFnH').value!="2") durlast= getCookie("HN2Duration");
     if(_rlId==null||_rlId=="")
     {
         _$("ctl00_plhBody_hidRARValue").value+=","+ "0";
         rarVal +=","+ "-1";
         if(durlast==null || durlast=="" ){ durlast = "2"; }
          populateDuration(durlast);
          setCheckOutDate(durlast);
           _$("hdnsetDate").value="City";
     }
     else
     {
        _$("ctl00_plhBody_hidRARValue").value+=","+ _rlId;
        _$("ctl00_plhBody_hidRARText").value+=","+_rlText; 
         if(durlast==null || durlast=="" ){ durlast = "7"; }
          populateDuration(durlast);
          setCheckOutDate(durlast);
         _$("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;
          if(rarIDs != "") { if(_$("hidFnH") != null && _$("hidFnH").value == "2") { gIATA(_$("ctl00_plhBody_hidRARValue").value,"dest"); } }       
          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';
	minDiv.style.background = "#F2F2F2 url('/Search/images/homepage/slider2.gif') no-repeat top center";
	minDiv.style.height='23px';
	InitiliazeSlider
	minDiv.style.bottom='7px';
	var maxDiv = new Element('div', {'id': 'max_slider'});
	maxDiv.className = 'slider';
	maxDiv.style.display = 'none';
	minDiv.injectInside(parentDiv);
	maxDiv.injectInside(parentDiv);	
	var mySlider = new Slider($('price_select'), $('min_slider'), 
	{
		start: 50,
		end: 100,
		offset: 5,		
		knobheight: 27,
		onChange: function(pos)
		{
			$('price_label').setHTML('<br /><span class="slider_label_left" style="color:white;font-weight:bold;">'+(pos.minpos)+'%</span><span class="slider_label_right" style="color:white;font-weight:bold;">'+(pos.maxpos) + '%</span>');
			if(pos.minpos<51 ){_$("ImgCust").src = '/Search/images/homepage/average.jpg';}
            else if(pos.minpos>50 && pos.minpos<61){_$("ImgCust").src = '/Search/images/homepage/good.jpg';}        
            else if(pos.minpos>60 && pos.minpos<71){_$("ImgCust").src = '/Search/images/homepage/very-good.jpg';}        
            else if(pos.minpos>70 && pos.minpos<81){_$("ImgCust").src = '/Search/images/homepage/smashing.jpg';}        
            else if(pos.minpos>80 && pos.minpos<91){_$("ImgCust").src = '/Search/images/homepage/amazing.jpg';}        
            else if(pos.minpos>90 && pos.minpos<101){_$("ImgCust").src = '/Search/images/homepage/exceptional.jpg';}
		},
        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" style="color:white;font-weight:bold;">'+pos.minpos+'%</span><span class="slider_label_right" style="color:white;font-weight:bold;"> '+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_select').style.background="#fafafa url('../../images/homepage/testslid_bg.jpg') no-repeat top center";
	$('price_select').style.height='7px';
	$('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;
    if(_$("ctl00_plhBody_hdndomain")!=null) var path = _$("ctl00_plhBody_hdndomain").value
    window.location.href = path + "/Search/ContactDetail.aspx?tab="+tabval;
//    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 false;
}
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" ||_page=="FnHdestIntelli" || _page=="FnHdestQKIntelli")
        {
             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 'FnHdestIntelli':
                            case 'destIntelli': 
                                destIntelliXmlDB(XmlHttp.responseText);   
	                            break;
	                        case 'FnHhotIntelli':
	                        case 'hotIntelli':    
	                            hotelIntelliXml(XmlHttp.responseText);
	                            break;
	                        case 'FnHdestQKIntelli':
	                        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;                              
                            }
                            else if(navigator.vendor=="Google Inc." || navigator.vendor.indexOf("Apple")!=-1)
                            {
                                _$("destIFrame").style.width="280px";
                            }
                            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";            
       if(_destId != "") { if(_$("hidFnH") != null && _$("hidFnH").value == "2") { gIATA(_destId,"dest"); } }       
       var _destValues = _destId.split(",");
        var _type=_destValues[3];
        _$("hdnsetDate").value =_type;
        var durlast = "";
        if(getCookie("HN2Duration")!=null && getCookie("HN2Duration")!="" && _$('hidFnH').value!="2") durlast= getCookie("HN2Duration");
        if(_type != null)
        {
            if(_type=="Beach" || _type=="Ski")
            {
                if(durlast==null || durlast=="" ){ durlast = "7"; }
                populateDuration(durlast);
                setCheckOutDate(durlast);
            }
            else
            {
                if(durlast==null || durlast=="" ){ durlast = "2"; }
                populateDuration(durlast);
                setCheckOutDate(durlast);
            }
        }
        else
        {
             if(durlast==null || durlast=="" ){ durlast = "7"; }
             populateDuration(durlast);
             setCheckOutDate(durlast);
        }        
    }
    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;
        if(_hotId != "") { if(_$("hidFnH") != null && _$("hidFnH").value == "2") { gIATA(_hotId,"hotel"); } }
    }
    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;
                            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 =  _$("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+2;
                                _iFrame.style.top = _$("destQKDivContainer").style.top+2;
                            }
                            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.defer = false; 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'); }
function homeTab(_v)
{  
    _$('divHotMessage').style.display = "none"; 
    if(_cObj(_$('hidFnH'))) _$('hidFnH').value = _v;
    if(_v == '1') { _$("FNH_ONLY").style.background="none";_$('CCNumber').innerHTML = "0800 091 3888";
        var iev = 7;       
        if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
        iev=new Number(RegExp.$1)}        
        if (iev<7)
        {
           _$('trPass').style.display = "block";
            _$("ctl00_plhBody_ddlRating").style.display = "block";
            _$('tdRating').style.display = "block";
        }
        else
        {
        _$('trPass').style.display = "table-row";
        _$("ctl00_plhBody_ddlRating").style.visibility = "visible";
        _$('tdRating').style.visibility = "visible";
        }
        _$('Passengers').style.display='none';
        _$('roomnpass').style.display='block';         
        _$("H_ONLY").style.background="#BAE1FA none repeat scroll 0 0";
        _$('hotel_label').className = "selected"; _$('flightandhotel_label').className = "";
        _$('lblCin').innerHTML = "Arrival date:"; _$('lblCout').innerHTML = "Departure date:";
        _$('divAir').style.display = "none"; clearVal(); pDDDLBrd();pDDLDuration(_v);PSfrmCK();
    }
    else { _$("H_ONLY").style.background="none";_$('CCNumber').innerHTML = "0800 0913 876";        
        _$('trPass').style.display = "none";
        var iev = 7;       
        if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
        iev=new Number(RegExp.$1)}
        if (iev<7)
        {
            _$("ctl00_plhBody_ddlRating").style.display = "none";
            _$('tdRating').style.display = "none";           
        }
        else
        {
            _$("ctl00_plhBody_ddlRating").style.visibility = "hidden";
            _$('tdRating').style.visibility = "hidden";
        }
        _$('Passengers').style.display='inline';
        _$('roomnpass').style.display='none';
        _$("FNH_ONLY").style.background="#BAE1FA none repeat scroll 0 0";        
        _$('hotel_label').className = ""; _$('flightandhotel_label').className = "selected";
        _$('lblCin').innerHTML = "Departure date:"; _$('lblCout').innerHTML = "Return date:";
        if(navigator.appName=="Microsoft Internet Explorer") _$('divAir').style.display = "block"; else _$('divAir').style.display = "table-row"; clearVal();pDDLDuration(_v);PFnHSfrmCK();   
    }
}
function clearVal()
{
    _$("DestSearch").style.color='';
    _$("DivDestSearch").style.display='none';
     _$("divDidYouMeanDest").style.display = "none";
    _$("divDestMessage").style.display = "none";
    _$("ctl00_plhBody_txtDestination").value="";
    _$("ctl00_plhBody_txtDestination").value= "Start typing your destination here";
    _$("lblDestErrMessage").innerHTML = "";
    _$("ctl00_plhBody_txtHotel").value="";
    _$("ctl00_plhBody_txtHotel").value= "Type your hotel name here";
    _$("ctl00_plhBody_hidDestValue").value ="";
    _$("ctl00_plhBody_hidDestSearchQuery").value = "";
    _$("ctl00_plhBody_hotelCheckin").value=""; _$("ctl00_plhBody_hotelCheckout").value=""; _$("ctl00_plhBody_hidDestText").value = "";
    _$("ctl00_plhBody_hidDestValue").value = "";
     _$("ctl00_plhBody_checkinValue").value = "";
     _$("ctl00_plhBody_checkoutValue").value = "";
    _$("ctl00_plhBody_hidPriceReqValues").value = "";
     if(_$("hidPriceRequestValues")!= null)_$("hidPriceRequestValues").value = "";     
    _$("ctl00_plhBody_duration").selectedIndex = "8";
    var ddlResort; var ddlAirport;var ddlBoard;
    if(_cObj(_$("ctl00_plhBody_ddlResort"))) ddlResort = _$("ctl00_plhBody_ddlResort");
    if(_cObj(_$("ctl00_plhBody_ddlAirportFnH"))) ddlAirport = _$("ctl00_plhBody_ddlAirportFnH"); 
    if(_cObj(_$("ctl00_plhBody_ddlboard"))) ddlBoard = _$("ctl00_plhBody_ddlboard");
    var _opI;
    for (var count = ddlResort.options.length-1; count >-1; count--)
    { ddlResort.options[count] = null; }
    _opI = new Option( "-- Select Resort --", "",  false, false);
    ddlResort.disabled=false; ddlResort.options[ddlResort.length] = _opI; 
    var _optionAir;
    for (var count = ddlAirport.options.length-1; count >-1; count--)
    { ddlAirport.options[count] = null; }
    _optionAir = new Option( "--Select--", "-1",  false, false);
    ddlAirport.disabled=false; ddlAirport.options[ddlAirport.length] = _optionAir;
    var _optionBrd;
    for (var count = ddlBoard.options.length-1; count >-1; count--)
    { ddlBoard.options[count] = null; }
    _optionBrd = new Option( "--Select---", "-1",  false, false);
    ddlBoard.disabled=false;
    ddlBoard.options[ddlBoard.length] = _optionBrd;
    return false;
}
function pDDDLBrd()
{
    var ddlBoard; var _optionBrd; if(_cObj(_$("ctl00_plhBody_ddlboard"))) ddlBoard = _$("ctl00_plhBody_ddlboard");    
    if(ddlBoard != null)
    {
        _optionBrd = new Option( "Any", "0",  false, false); ddlBoard.options[0] = _optionBrd;
        _optionBrd = new Option( "Self Catering", "1",  false, false); ddlBoard.options[1] = _optionBrd;
        _optionBrd = new Option( "All Inclusive", "2",  false, false); ddlBoard.options[2] = _optionBrd;
        _optionBrd = new Option( "Bed and Breakfast", "3",  false, false); ddlBoard.options[3] = _optionBrd;
        _optionBrd = new Option( "Half Board", "4",  false, false); ddlBoard.options[4] = _optionBrd;
        _optionBrd = new Option( "Full Board", "5",  false, false); ddlBoard.options[5] = _optionBrd;
        _optionBrd = new Option( "Room Only", "6",  false, false); ddlBoard.options[6] = _optionBrd;
        _optionBrd = new Option( "Drinks Inclusive", "7",  false, false); ddlBoard.options[7] = _optionBrd;
    }
}
function gIATA(_IATAID,_type)
{
    if(_IATAID!="" && _$('hidFnH').value =='2') {
    var FnhJSONIDs = _IATAID.split(',');
    if(FnhJSONIDs[3]!=null && FnhJSONIDs[3] !="" && FnhJSONIDs[3]!="-1") _type = "Hotel";
         var theDate = new Date();var rU;
         if(_type=="dest") { rU = "/Search/AjaxImpl.aspx?page=IATA&IDs="+_IATAID +"&dt="+ theDate.getTime(); }
         else { rU = "/Search/AjaxImpl.aspx?page=IATA&IDs="+ _IATAID +"&dt="+ theDate.getTime(); }
         var XmlHttp = CreateXmlHttp();
         if(XmlHttp) { XmlHttp.onreadystatechange = function() {
                if(XmlHttp.readyState == 4) {
	                if(XmlHttp.status == 200) {pIATAbyDestn(XmlHttp.responseText,_type);}//,_ckVal,_ckBVal);}
                }
	        }
		    XmlHttp.open("GET", rU, true); XmlHttp.send(null);
	     }
    }
}
function pIATAbyDestn(_JSONStr,_type)
{
    _$("divDestMessage").style.display = 'none'; _$("divHotMessage").style.display = 'none'; var _opI,_tV,_dId,_flag,_nIndex; _nIndex=0; var ddlAirport = _$("ctl00_plhBody_ddlAirportFnH");
    if(navigator.appName == "Microsoft Internet Explorer") { ddlAirport.style.width = "auto"; } else { ddlAirport.style.overflow = "scroll"; }
    if(_JSONStr.length>0 && _JSONStr.indexOf('<form')==-1)
    {
        for (var count = ddlAirport.options.length-1; count >-1; count--) { ddlAirport.options[count] = null; }
        _opI = new Option( "[Please select]", "-1",  false, false); ddlAirport.options[ddlAirport.length] = _opI; 
        var strArr = _JSONStr.split('*#*#*'); var JObj = eval('(' + strArr[0] + ')');
        for(var i = 0; i < JObj.IATA.length; i++)
        {
            _tV = JObj.IATA[i].V; _dId = JObj.IATA[i].C; _opI = new Option(_tV, _dId); ddlAirport.options[ddlAirport.length] = _opI; ddlAirport.options[i+1].title = _tV;           
            if(_$("ctl00_plhBody_hdFnHAirport") != null && _$("ctl00_plhBody_hdFnHAirport").value == _dId ) _nIndex=i+1;
        } 
        if(_$("ctl00_plhBody_hdFnHAirport") != null && _$("ctl00_plhBody_hdFnHAirport").value != '') { ddlAirport.options.selectedIndex = _nIndex;}
        pBOARDbyDestn(strArr[1]);
    }
    else{ if(_$("f_option").checked && _type=="dest") { _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block"; _$("divDestMessage").style.height = "40px"; _$("lblDestErrMessage").style.display='block'; _$("lblDestErrMessage").innerHTML = "No match found.";  } 
         else if(_$("f_option").checked && _type!="dest") _$("divHotMessage").style.display = 'block'; 
         else _$("lblDestErrMessage").style.display = 'none'; }
}
function pBOARDbyDestn(_boardStr,_type)
{
    var _opI,_tV,_dId,_flag,_nIndex; _nIndex=0; var ddlBoard = _$("ctl00_plhBody_ddlboard");
    if(_boardStr.length>0 && _boardStr.indexOf('<form')==-1)
    {
        for (var count = ddlBoard.options.length-1; count >-1; count--) { ddlBoard.options[count] = null; }
       _opI = new Option( "[Please select]", "-1",  false, false); ddlBoard.options[ddlBoard.length] = _opI;
        var JObj = eval('(' + _boardStr + ')');
        for(var i = 0; i < JObj.BOARD.length; i++)
        {
            _tV = JObj.BOARD[i].V; _dId = JObj.BOARD[i].C; _opI = new Option(_tV, _dId); ddlBoard.options[ddlBoard.length] = _opI; ddlBoard.options[i+1].title = _tV;           
            if(_$("ctl00_plhBody_hdFnHBoard") != null && _$("ctl00_plhBody_hdFnHBoard").value == _dId ) _nIndex=i+1;
        } 
        if(_$("ctl00_plhBody_hdFnHBoard") != null && _$("ctl00_plhBody_hdFnHBoard").value != '') { ddlBoard.options.selectedIndex = _nIndex;}
    } 
    else{ if(_$("f_option").checked && _type=="dest") { _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block"; _$("divDestMessage").style.height = "40px"; _$("lblDestErrMessage").style.display='block'; _$("lblDestErrMessage").innerHTML = "No match found.";} 
         else if(_$("f_option").checked && _type!="dest") _$("divHotMessage").style.display = 'block'; 
         else _$("lblDestErrMessage").style.display = 'none'; }     
}
function cleardest() { _$("ctl00_plhBody_txtDestination").value= "Start typing your destination here"; _$("DestSearch").style.color=''; return false; }
function pDDLDuration(vval)
{
    var ddlDuration; var _optionDur; if(_cObj(_$("ctl00_plhBody_duration"))) ddlDuration = _$("ctl00_plhBody_duration");  
    if(ddlDuration != null)
    {
        for (var count = ddlDuration.options.length-1; count >-1; count--) { ddlDuration.options[count] = null; }
        if(vval=='2')
        {
            _optionDur = new Option( "7", "7",  false, false);
            ddlDuration.options[0] = _optionDur;
            _optionDur = new Option( "8", "8",  false, false);
            ddlDuration.options[1] = _optionDur;
            _optionDur = new Option( "10", "10",  false, false);
            ddlDuration.options[2] = _optionDur;
            _optionDur = new Option( "11", "11",  false, false);            
            ddlDuration.options[3] = _optionDur;
            _optionDur = new Option( "14", "14",  false, false);
            ddlDuration.options[4] = _optionDur;
            _optionDur = new Option( "15", "15",  false, false);
            ddlDuration.options[5] = _optionDur;
        }
        else
        {
            if(getCookie("HN2Duration")!=null && getCookie("HN2Duration")!="") var durlast= getCookie("HN2Duration");
            _optionDur = new Option( "7", "7",  false, false);
            ddlDuration.options[0] = _optionDur;
            _optionDur = new Option( "14", "14",  false, false);
            ddlDuration.options[1] = _optionDur;
            for(var i=1;i<31;i++)
            {
                _optionDur = new Option( i, i,  false, false);
                ddlDuration.options[i+1] = _optionDur;
             }
           _optionDur = new Option( "Other", "0",  false, false);
            ddlDuration.options[32] = _optionDur;
            ddlDuration.options.selectedIndex=parseInt(durlast)+1;
        }
    }
    return;
}
function PopulateFnHSearch()
{
    homeTab(2);
    _$('hidFnH').value = '2';
    _$("f_option").checked = 'true';
    var FnHSearchParams = _$("ctl00_plhBody_hdnFnHSearchParams").value.split('||');
    _$("ctl00_plhBody_txtDestination").value = FnHSearchParams[3] ;
    _$("ctl00_plhBody_hidDestText").value = FnHSearchParams[3];
    _$("ctl00_plhBody_hidDestValue").value = FnHSearchParams[0]+','+FnHSearchParams[1]+','+FnHSearchParams[2]+','+FnHSearchParams[18];
    _$("ctl00_plhBody_hidHotelValue").value = FnHSearchParams[0]+','+FnHSearchParams[1]+','+FnHSearchParams[2]+','+ FnHSearchParams[4] +','+ FnHSearchParams[18];
    if(FnHSearchParams[5] != "") _$("ctl00_plhBody_txtHotel").value = FnHSearchParams[5] ;
    _$("ctl00_plhBody_hidHotelText").value = FnHSearchParams[5] ;
    _$("ctl00_plhBody_hotelCheckin").value = FnHSearchParams[7];
    _$("ctl00_plhBody_checkinValue").value = FnHSearchParams[7];
    _$("ctl00_plhBody_hdFnHAirport").value = FnHSearchParams[21];
    _$("ctl00_plhBody_hdFnHBoard").value = FnHSearchParams[10];
    var _roominfo = FnHSearchParams[17];
    _roominfo = _roominfo.split(":");
    var _adult = _roominfo[1];
    var _child = _roominfo[2];
    var _infant = _roominfo[3].split("!");
    _infant = _infant[0];
    _$("ctl00_plhBody_ddlAdultFnH").value = _adult;
    _$("ctl00_plhBody_ddlChildFnH").value = _child;
    _$("ctl00_plhBody_ddlInfantFnH").value = _infant;
    var IATAIDS = FnHSearchParams[0]+','+FnHSearchParams[1]+','+FnHSearchParams[2]+','+FnHSearchParams[4];
    gIATA(IATAIDS,'0');
    setCheckOutDate(FnHSearchParams[9]);
    return false;
}
function PFnHSfrmCK()
{     
//    try 
//    {
//        var pageTracker = _gat._getTracker('UA-9888040-1');        
//        pageTracker._trackEvent('Flights','Clicked','FlightClicked');
//    }
//    catch (e) 
//    {
//    }    
    if(getCookie("FnHHN2") != null && getCookie("FnHHN2") != "")
    {
    var FnHSearchParams = getCookie("FnHHN2").split('||');    
    _$("ctl00_plhBody_txtDestination").value = FnHSearchParams[3] ;
    _$("ctl00_plhBody_hidDestText").value = FnHSearchParams[3];
    _$("ctl00_plhBody_hidDestValue").value = FnHSearchParams[0]+','+FnHSearchParams[1]+','+FnHSearchParams[2]+','+FnHSearchParams[18];
    _$("ctl00_plhBody_hidHotelValue").value = FnHSearchParams[0]+','+FnHSearchParams[1]+','+FnHSearchParams[2]+','+ FnHSearchParams[4] +','+ FnHSearchParams[18];
    if(FnHSearchParams[5] != "") _$("ctl00_plhBody_txtHotel").value = FnHSearchParams[5] ;
    _$("ctl00_plhBody_hidHotelText").value = FnHSearchParams[5] ;
    _$("ctl00_plhBody_hotelCheckin").value = FnHSearchParams[7];
    _$("ctl00_plhBody_checkinValue").value = FnHSearchParams[7];        
    _$("ctl00_plhBody_hdFnHAirport").value = FnHSearchParams[21];
    _$("ctl00_plhBody_hdFnHBoard").value = FnHSearchParams[10];     
    var _roominfo = FnHSearchParams[17];
    _roominfo = _roominfo.split(":");
    var _adult = _roominfo[1];
    var _child = _roominfo[2];
    var _infant = _roominfo[3].split("!");
    _infant = _infant[0];
    _$("ctl00_plhBody_ddlAdultFnH").value = _adult;
    _$("ctl00_plhBody_ddlChildFnH").value = _child;
    _$("ctl00_plhBody_ddlInfantFnH").value = _infant;     
    var IATAIDS = FnHSearchParams[0]+','+FnHSearchParams[1]+','+FnHSearchParams[2]+','+FnHSearchParams[4];
    gIATA(IATAIDS,'0');  
    _$("ctl00_plhBody_duration").value = FnHSearchParams[9]; 
    setCheckOutDate(FnHSearchParams[9]); 
    }
    else { _$("ctl00_plhBody_hotelCheckout").value=""; }
    return false;   
}
function PSfrmCK()
{    
//    try 
//    {
//        var pageTracker = _gat._getTracker('UA-9888040-1');        
//        pageTracker._trackEvent('Hotels','Clicked','HotelClicked');
//    }
//    catch (e) 
//    {
//    }
    if(getCookie("HN2") != null && getCookie("HN2") != "")
    {
    var FnHSearchParams = getCookie("HN2").split('||');    
    _$("ctl00_plhBody_txtDestination").value = FnHSearchParams[3] ;
    _$("ctl00_plhBody_hidDestText").value = FnHSearchParams[3];
    _$("ctl00_plhBody_hidDestValue").value = FnHSearchParams[0]+','+FnHSearchParams[1]+','+FnHSearchParams[2]+','+FnHSearchParams[18];
    _$("ctl00_plhBody_hidHotelValue").value = FnHSearchParams[0]+','+FnHSearchParams[1]+','+FnHSearchParams[2]+','+ FnHSearchParams[4] +','+ FnHSearchParams[18];
    if(FnHSearchParams[5] != "") _$("ctl00_plhBody_txtHotel").value = FnHSearchParams[5] ;
    _$("ctl00_plhBody_hidHotelText").value = FnHSearchParams[5] ;
    _$("ctl00_plhBody_hotelCheckin").value = FnHSearchParams[7];
    _$("ctl00_plhBody_checkinValue").value = FnHSearchParams[7];
    var _roominfo = FnHSearchParams[17];
    _$("ctl00_plhBody_rInf").value= _roominfo;
    SetChildAge();
    _$("ctl00_plhBody_duration").value = FnHSearchParams[9];          
    setCheckOutDate(FnHSearchParams[9]); 
    }
    else { _$("ctl00_plhBody_hotelCheckout").value=""; }
    return false;   
}

//function PopulateControl(count,tmpinfo)
//{
//    tmpinfo = tmpinfo.split(':');
//    var adlt = tmpinfo[1];
//    var chlds = tmpinfo[2];
//    var chldage=tmpinfo[3].split('-');
//    _$('ctl00_plhBody_ddlAdult'+count).value=adlt;
//    _$('ctl00_plhBody_ddlChild'+count).value=chlds;
//    for(var tmpcount=1;tmpcount<=chldage.length;tmpcount++) { _$('ctl00_plhBody_txtChild'+count+''+tmpcount).style.display="block"; _$('ctl00_plhBody_txtChild'+count+''+tmpcount).value=chldage[tmpcount-1]; } 
//}
function show_children(id) {if(!validate_passengers()) { alert('Please call us free on 0800 091 3888 to book multiple rooms with different occupancies.'); } var num = _$("ctl00_plhBody_ddlChild"+id).value; for(var count=1; count<=5; count ++) { _$('lblchage').style.display="none"; _$("ctl00_plhBody_txtChild"+id+""+count).style.display="none"; } for(var count=1; count<=num; count ++) {_$('lblchage').style.display="block"; _$("ctl00_plhBody_txtChild"+id+""+count).style.display="block"; } }
function show_rooms() { var num = _$("ctl00_plhBody_rooms_select_id").value; for(var count=1; count<=4; count++) _$('roomnpass'+count).style.display="none"; for(var count=1; count<=num; count++) {_$('roomnpass'+count).style.display="block";show_children(count);} }
function show_adult() { if(!validate_passengers()) { alert('Please call us free on 0800 091 3888 to book multiple rooms with different occupancies.'); } }
function validate_passengers() { var num = _$("ctl00_plhBody_rooms_select_id").value; var chk = new Boolean(); chk=true; for(var count=1; count<num; count++) { if(_$("ctl00_plhBody_ddlAdult"+count).value != _$("ctl00_plhBody_ddlAdult"+(count+1)).value) chk=false; } if(chk==false) return chk; for(var count=1; count<num; count++) { if(_$("ctl00_plhBody_ddlChild"+count).value != _$("ctl00_plhBody_ddlChild"+(count+1)).value) chk= false; } return chk; }
function val_ch_age() { var num = _$("ctl00_plhBody_rooms_select_id").value; var chk = new Boolean(); chk=true; for(var count=1; count<=num; count++) { var ccoun = _$("ctl00_plhBody_ddlChild"+count).value; ccoun = parseInt(ccoun); if(ccoun > 0) { for(var iage=1;iage<=ccoun;iage++) { if (!(_$('ctl00_plhBody_txtChild'+count+''+iage)!=null && _$('ctl00_plhBody_txtChild'+count+''+iage).value.trim() !="" && _$('ctl00_plhBody_txtChild'+count+''+iage).value <13 && _$('ctl00_plhBody_txtChild'+count+''+iage).value >1 )) { chk= false; return chk; } } } } return chk; }    
function NumericValuesOnly(event) { if(!(event.keyCode==45||event.keyCode==46||event.keyCode==48||event.keyCode==49||event.keyCode==50||event.keyCode==51||event.keyCode==52||event.keyCode==53||event.keyCode==54||event.keyCode==55||event.keyCode==56||event.keyCode==57)) { event.returnValue=false; } }
function hideFeedback() { _$("modalBackgroundDiv").style.display="none";_$("Feedback").style.display="none";_$("frame").style.display="none"; }
function val3dchin(hcin) { var arrhcin = hcin.split('-'); var dtCurr = new Date(); dtCurr = new Date(dtCurr.getFullYear(),dtCurr.getMonth(),dtCurr.getDate()); var dthcin = new Date(arrhcin[2],arrhcin[1]-1,arrhcin[0]); var days = 0; var difference = 0; difference = dthcin - dtCurr; days = Math.round(difference/(1000*60*60*24)); if(days<3) return false; else return true; }
