﻿var m_ctrlId = "ctl00_ContentPlaceHolder1_";

// OnChange of Continent, this function is used on archive.aspx page
    function GetCountry()
    {  
       var objddlContinent = document.getElementById(m_ctrlId + "continent"); 
       var parameter = objddlContinent.options[objddlContinent.selectedIndex].value;
       
       spnNews =  document.getElementById(m_ctrlId + "spnNewsDetail"); 
       spnNews.innerHTML ="";
           
       // Call the Server       
       UseCallBack('Country' + String.fromCharCode(20) + parameter,"cboCountry");
    }       
    
// OnChange of Continent, this function is used on archive.aspx page
    function GetNews()
    {  
       var objddlContinent = document.getElementById(m_ctrlId + "continent"); 
       var parameter = objddlContinent.options[objddlContinent.selectedIndex].value;
       
       var objddlcountry = document.getElementById(m_ctrlId + "country"); 
       var parameter1 = objddlcountry.options[objddlcountry.selectedIndex].value;
           
       // Call the Server       
       UseCallBack('News' + String.fromCharCode(20) + parameter + String.fromCharCode(20) + parameter1,"cboNews");
    }

// this function is used in PageLoad event of archive.aspx page    
function JSCallback(result, context)
    {
     //Country and City 
      selCountry =  document.getElementById(m_ctrlId + "country"); 
      
      // SpanId
      spnNews =  document.getElementById(m_ctrlId + "spnNewsDetail"); 
      
	  if(result != "-1")
       {
           if(context == "cboNews")
           {
               spnNews.innerHTML = result;
           } 
       
          
           
           if(context == "cboCountry")
           {    
               var rows = result.split('|'); 
               var optionCountry = document.createElement("OPTION"); 
               optionCountry.innerHTML= "";
                    //optionCountry.value = "-11"; 
                    //optionCountry.innerHTML = "ALL"  
                   // selCountry.appendChild(optionCountry);
                    
               for (var i = 0; i < rows.length - 1; ++i) 
               { 
                    var values = rows[i].split('~'); 
                    
                    // If Context is Country
                    if(context == "cboCountry")
                    {
                       // Country 
                       var optionCountry1 = document.createElement("OPTION"); 
                       optionCountry1.value = values[0]; 
                       optionCountry1.innerHTML = values[1];  
                       selCountry.appendChild(optionCountry1); 
                    }
               }
          }
       } 
       else
       {    
            // "-1" Means NoRecord
           if(context == "cboCountry")
           {
               // Set the Default value to the Country
                selCountry.innerHTML ="";
                var optionCountry = document.createElement("OPTION"); 
                optionCountry.value = "-11"; 
                optionCountry.innerHTML = "ALL";
                selCountry.appendChild(optionCountry); 
           }  
           
           if(context == "cboNews")
           {
               spnNews.innerHTML = "";
           }   
       }
 	}  
  
//this function is used on DestinatiionInfoExpand.aspx page. It is called on window.onerror event.
function noErrors(){return true;}

//this function is used on DestinatiionInfoExpand.aspx page. It is called on window.onload event.
function addMPU() 
{
    var intPara = 0;
    var contentLength = 0;
    var bolAd = false;
    var contentTarget = 'copy_holder_wide';

    domObject = document.getElementById(contentTarget).getElementsByTagName("p");

    for (i = 0;i < domObject.length;i++) {
        if(domObject[i].id==''||domObject[i].id==null){
            domObject[i].id='para'+intPara;
            contentLength = contentLength + domObject[i].innerHTML.length;
            domObject[i].contentLength = contentLength;
            if (contentLength > 1600 && bolAd == false) {
	            document.getElementById('mpuLayer').style.display = 'block';
	            document.getElementById('mpuLayer').style.visibility = 'visible';
	            document.getElementById('para'+i).appendChild(document.getElementById('mpuLayer'));
	            bolAd = true;
            }
            intPara++;
        }
    }
    if (bolAd == false) {
        document.getElementById('mpuLayer').style.display = 'block';
        document.getElementById('mpuLayer').style.visibility = 'visible';
        document.getElementById(contentTarget).appendChild(document.getElementById('mpuLayer'));
    }													
}

 // OnChange of Continent, it is used on News.aspx page
    function GetCountryForNews()
    {  
       var objddlContinent = document.getElementById(m_ctrlId + "continent"); 
       var parameter = objddlContinent.options[objddlContinent.selectedIndex].value;
           
       // Call the Server       
       UseCallBack('Country' + String.fromCharCode(20) + parameter,"cboCountry");
    }

// this function is used on News.aspx page    
function GetCountryIdForNews()
	{
	   var objddlCountry = document.getElementById(m_ctrlId + "country"); 
	   var objhdn  = document.getElementById(m_ctrlId + "hdnCountry"); 
	   var parameter = objddlCountry.options[objddlCountry.selectedIndex].value;
	   objhdn.value = parameter;
	   	    
	}    

// it is used in PageLoad event of News.aspx page
function JSCallbackForNews(result, context)
    {
     //Country and City 
      selCountry =  document.getElementById(m_ctrlId + "country"); 
      objBtn  = document.getElementById(m_ctrlId + "btnSubmit");
      
      objBtn.disabled = false;
	  if(result != "-1")
       {
       
           if(context == "cboCountry")
           {     
               // Clear the CountryDropDown
               selCountry.innerHTML ="";
               
               // Set the Default value to the Country
               /*
               var optionCountry = document.createElement("OPTION"); 
               optionCountry.value = "0"; 
               optionCountry.innerHTML = "-- Country --";
               selCountry.appendChild(optionCountry); 
               */
           }
                     
           var rows = result.split('|'); 
           
           var optionCountry = document.createElement("OPTION"); 
                optionCountry.value = "-11"; 
                optionCountry.innerHTML = "ALL"  
                selCountry.appendChild(optionCountry);
                   
           for (var i = 0; i < rows.length - 1; ++i) 
           { 
                var values = rows[i].split('~'); 
                
                // If Context is Country
                if(context == "cboCountry")
                {
                   // Country 
                   var optionCountry1 = document.createElement("OPTION"); 
                   optionCountry1.value = values[0]; 
                   optionCountry1.innerHTML = values[1];  
                   selCountry.appendChild(optionCountry1); 
                }
           }
       } 
       else
       {    
            // "-1" Means NoRecord
           if(context == "cboCountry")
           {
               // Set the Default value to the Country
                selCountry.innerHTML ="";
                var optionCountry = document.createElement("OPTION"); 
                optionCountry.value = "0"; 
                optionCountry.innerHTML = "-- Country --";
                selCountry.appendChild(optionCountry); 
                
                // Hide the Button
                objBtn.disabled = true;
           }    
       }
 	}

// used on Search_Results.aspx
function ActivateLink()
	      	{
	      	 var ctrlId = "ctl00_ContentPlaceHolder1_rptPages_ctl";
	      	 var ctrlIdBottom = "ctl00_ContentPlaceHolder1_rptPagesBottom_ctl";
	      	 
	      	 var objHdn = document.getElementById("ctl00_ContentPlaceHolder1_hdnLinkAccessed");
	      	 	      	 
	      	 if (objHdn != null)
	      	 {
	      	    var idx = objHdn.value;
	      	    	      	     
	      	    var lnkObj = document.getElementById(ctrlId + idx + "_btnPage");
	      	    var lnkObjBottom = document.getElementById(ctrlIdBottom + idx + "_btnPage");
	      	    
	      	    if (lnkObj != null)
	      	    {
	      	        var val = lnkObj.innerHTML;
	      	        var val1 = lnkObjBottom.innerHTML;
	      	        	      	        
	      	        // Top Header	      	        
	      	        lnkObj.innerHTML = "<font class='Pagination'>" + val + "</font>";
	      	        
	      	        // Bottom Page
	      	        lnkObjBottom.innerHTML = "<font class='Pagination'>" + val1 + "</font>";
	      	    }
	      	 }
	      	}
	      	
 // OnChange of Continent, used on weather.aspx
function GetCountryForWeather()
    {  
       var objddlContinent = document.getElementById(m_ctrlId + "ddlContinent"); 
       var parameter = objddlContinent.options[objddlContinent.selectedIndex].value;
       var objddlCountry = document.getElementById(m_ctrlId + "ddlCountry"); 
       
       //objddlCountry.disabled=true;
       
       // Call the Server       
       UseCallBack('Country' + String.fromCharCode(20) + parameter,"cboCountry");
       document.getElementById(m_ctrlId + "divweather").style.display = 'none';
       //objddlCountry.disabled=false;
       
    }	      	
    
 // OnChange of Country,  used on weather.aspx
function GetCityForWeather()
    {  
       var objddlCountry = document.getElementById(m_ctrlId + "ddlCountry"); 
       var parameter = objddlCountry.options[objddlCountry.selectedIndex].value;
       var objddlCity = document.getElementById(m_ctrlId + "ddlCity"); 
       
       //objddlCity.disabled=true;
       
       // Call the Server
       UseCallBack('City' + String.fromCharCode(20) + parameter,"cboCity"); 
       document.getElementById(m_ctrlId + "divweather").style.display = 'none'; 
       //objddlCity.disabled=false;
       
    }    
// used on cars_hire.aspx, hotels.aspx, flights.aspx
 function mivaAdjust() 
    {	
        var mivaAdZone,adTable;	
        
        mivaAdZone = document.getElementById('mivaAdZone').getElementsByTagName('DIV')[0];		
        if (mivaAdZone != null)
        {
            mivaAdZone.style.width = '100%';	
            mivaAdZone.style.height = '600px';	
            mivaAdZone.firstChild.style.width = '100%';	
            mivaAdZone.firstChild.style.height = '600px';		
            adTable = mivaAdZone.firstChild.getElementsByTagName('TD');				
        
            for (var i = 0; i < adTable.length; i++) 
            {		
                adTable[i].style.width = '100%';	
            }
        }
    }
    
