﻿// JScript File
//*************************************************
//This function used to hotel Area uc
//*************************************************
 function onmout(obj)
    {
  
    if(obj.className=='pic1a')
    {
        obj.className='pic1a';
    }
    else
    {
        obj.className='pic2a';
    }
    
   
    }

    function onmoin(obj)
    {
     
 
    if(obj.className=='pic1a')
    {
        obj.className='pic1a';
    }
    else
    {
        obj.className='pic3a';
    }

    }

    //******************************************************
     // End Code
     //******************************************************
     

    //******************************************************
     // This function used to basket pages
     //******************************************************
     function checkvalid()
     {
        if(Page_ClientValidate()==true)
        {
            if(document.getElementById("ctl00_ContentPlaceHolder1_chkconfcar"))
            {
                if (!document.getElementById("ctl00_ContentPlaceHolder1_chkconfcar").checked)
                {
                    alert("Please check the important car information" );
                    return false;
                }
            }
            
            if(!document.getElementById("ctl00_ContentPlaceHolder1_chkBookCondition").checked)
            {
                alert("Please check the booking conditions" );
                return false;
            }
        }
        
        return true;
    }


    function ShowHideAddDriver(Extraid,ctrlid,hdndriver)
    {
       // if(Extraid == "72" || Extraid == "78")
       if(Extraid.indexOf("ADDITIONAL DRIVER") != -1)
       {
           if(ctrlid.checked)
            {
                document.getElementById(hdndriver).value = "1";
            }    
            else
            {
                document.getElementById(hdndriver).value = "0";
            }    
        }
        
       
    }    
    function SetLeadPassanger(rowno)
    {
        document.getElementById("ctl00_ContentPlaceHolder1_hdnLeadPassNo").value = rowno;   
    }
    function openPopupWin()
    {
        window.open("ExcessRefundPolicy.aspx");
    }
    function updatePricingTotals(ctrlid)
    {      
        var WaiverPrice = parseFloat(document.getElementById("ctl00_ContentPlaceHolder1_lblCWPrice").innerHTML);
        var totprice1 = document.getElementById("ctl00_ContentPlaceHolder1_ucFareDetails1_spntotalcost").innerHTML;
         totprice = parseFloat(eval(totprice1.substring(1).replace(",","")));
        var totalpersons = parseFloat(document.getElementById("ctl00_ContentPlaceHolder1_hdnTotalPersons").value);    
      
      var strrow = "";
      
      
        if(document.getElementById(ctrlid).checked)
        {
            totprice = totprice + WaiverPrice;
            var classtype;
            if(type==1)
                classtype="bg2";
            else
                classtype="bg8";
            //strrow = "<div class='width13 bodrb floatl back1'><p class='pad7 pad6 width19 floatl'>Excess Refund Policy</p><p class='width12 floatl pad6 alignr'>&nbsp;</p><p class='width12 pad6 floatl mag5 alignr'>&nbsp;</p><div class='width10 alignr floatl pad6'>&pound;" + WaiverPrice.toFixed(2) + "</div></div>";
            strrow = "<ul><li class='" + classtype + "'><span class='w24 padtop2'><img src='images/box10_car_icon.gif' alt='' border='0' /></span><span class='width300 padleft5'>Excess Refund Policy</span><span class='width65 padr30 alignr'>&nbsp;</span><span class='width27Enquiry alignc'>&nbsp;</span><span class='w80 alignr'>&pound;" + WaiverPrice.toFixed(2) + "</span></li></ul>";
            //avgprice = avgprice + (WaiverPrice/totalpersons);
        }
        else
        {
            totprice = totprice - WaiverPrice;
            strrow = "";
            //avgprice = avgprice - (WaiverPrice/totalpersons);
        }
        totprice = totprice.toFixed(2);
        //avgprice = avgprice.toFixed(2);
     
        
        //+ (totprice1.substr(0,1) + totprice + 
        document.getElementById("divExcesspolicy").innerHTML = strrow;
        document.getElementById("ctl00_ContentPlaceHolder1_ucFareDetails1_spntotalcost").innerHTML = (totprice1.substr(0,1) + totprice);
    
    }
    
    //******************************************************
     // End Code
     //******************************************************
     
     
     
      

    //******************************************************
     // This function used to show loader image when click on add to compare list buttons.
     //******************************************************
    function setCompareItems(type,id)
    {
        document.getElementById("divProgress").style.display="none";
        
        var img=new Image();
        img.src='images/loader.gif';
              
        if (type=="add")
        {
            document.getElementById('wait_del_'+id).style.display="none";
            document.getElementById('wait_add_'+id).style.display="block";
        }
        if(type=="remove")
        {
            document.getElementById('wait_del_'+id).style.display="block";
            document.getElementById('wait_add_'+id).style.display="none";
        }
    }   
    
    
     //******************************************************
     // This function used to flight and car page
     //******************************************************
    function showview(ids)
        { 
             ids1 = ids
              ids = ids.replace("xpnlOIboundinformation","pnlOIboundinformation")
            
           if(document.getElementById(ids).style.display == "")
             {document.getElementById(ids).style.display = "none"
             document.getElementById(ids1).className = "viewdetail"
             }else
             {
             document.getElementById(ids).style.display = ""
             document.getElementById(ids1).className = "viewdetail1"
             }
            return false
          
        }
        function showview1(ids)
        { 
             ids1 = ids
              ids = ids.replace("GpnlGOIboundinformation","pnlGOIboundinformation")
            
           if(document.getElementById(ids).style.display == "")
             {document.getElementById(ids).style.display = "none"
             document.getElementById(ids1).className = "viewdetail"
             }else
             {
             document.getElementById(ids).style.display = ""
             document.getElementById(ids1).className = "viewdetail1"
             }
            return false
          
        }

    
    
    //******************************************************
     // This function used to flight page when click arrow image to see outbound and inbound informations.
     //******************************************************  
     function showviewflight(ids)
        { 
             ids1 = ids
             ids = ids.replace("xpnlOIboundinformation","pnlOIboundinformation")
             idImg=ids.replace("pnlOIboundinformation","imgMCDrop")
           
           if(document.getElementById(ids).style.display == "")
             {
                document.getElementById(ids).style.display = "none"
                document.getElementById(idImg).src = "images/arrow-right.png"
             }
             else
             {
                document.getElementById(ids).style.display = ""
                document.getElementById(idImg).src = "images/arrow-down.png"
             }
            return false
          
        }
        
        
    //******************************************************
     // This function used to show div on hotel page when on mouseover to night cost price.
     //******************************************************      
            
//    function divshow(divid,imageid)
//    {   
//        var location = Sys.UI.DomElement.getLocation(document.getElementById(imageid));
//        document.getElementById(divid).style.left = location.x+30+'px';
//        document.getElementById(divid).style.top = location.y+5+'px';
//        document.getElementById(divid).style.display="block";
//    }
    
//    function divhide(id)
//    {
//        document.getElementById(id).style.display = "none";
//    }
    
     //******************************************************
     // End Code
     //******************************************************   
     
     
     //******************************************************
     // This function used to Change hotel price when select different-2 rooms
     //******************************************************   
     
 function SetTotalPrice(cntRedio,sessionprice,cntrHotel,cntrPackage,supp,totpax)
 { 
    var noofroom=0;
     if (supp=='JMB' || supp == 'TUR')
     {
        noofroom=1; 
     }
     else
     {
        noofroom=7;
     }

  var total=0;
  for (var intRoom=0; intRoom < noofroom ; intRoom++)
  {

    var cnt=cntRedio+intRoom;
    var obj=document.getElementsByName(cnt);
    //Inner check box index
    for (var i=0; i < obj.length; i++)
    { 
        if (obj[i].checked )
        { 
          var strarry=obj[i].value.split("|");
          if (strarry.length > 0){
         
          total = parseFloat(total) + parseFloat(strarry[1]);
         
          }
        }
     }
    
   }
   //set the value in spam 
     cntrHotel.value=total.toFixed(2); 
     //var packagePrice=(parseFloat(total) + parseFloat(sessionprice))/totpax; 
     var packagePrice=parseFloat(total)/totpax; 
     cntrPackage.innerHTML=packagePrice.toFixed(2);
     
 }


 function selectRoom(obj)
 {
 try
 {
   document.getElementById(obj).checked=true;
   
  }
  catch(e)
  {}
    
 }
 
 
  //******************************************************
     // End Code
     //****************************************************** 
     
   
    //******************************************************
     // This function used to insurance page when click on individual and family radiobuttons
     //******************************************************  
     
    function  Visibletblpack(Stype)
    {
    if (Stype=='I')
    {

    document.getElementById("ctl00_ContentPlaceHolder1_trind").style.display="inline";
    document.getElementById("ctl00_ContentPlaceHolder1_trfamily").style.display="none";
    }
    else
    {
    document.getElementById("ctl00_ContentPlaceHolder1_trfamily").style.display="inline";
    document.getElementById("ctl00_ContentPlaceHolder1_trind").style.display="none";
    }
    }
    
    
    
    
     //******************************************************
     // This function used to TravelExtra page
     //******************************************************  
    // Radio Button Validation - by ashu
        function valButton(btn) {
        var cnt = -1;
        if(btn != undefined)
        {
        for (var i=btn.length-1; i > -1; i--) {
           if (btn[i].checked && btn[i].value!='No') 
           {
           cnt = i; 
           i = -1;
           }
           }
        if (cnt > -1) return btn[cnt].value;
        else return null;
        }else return null;

        }

        function valForm(form) {
        var btnAH = valButton(form.AH);
        var btnACP = valButton(form.ACP);
        var btnLOU = valButton(form.LOU);
        if (btnAH == null && btnACP == null && btnLOU == null) 
        {
        alert('Sorry, please select any one options');
        return false;
        }
        else 
        {
        return true;
        }

        }
    
    function divshow(divid,imageid)
    {   
        var location = Sys.UI.DomElement.getLocation(document.getElementById(imageid));
        document.getElementById(divid).style.left = location.x+30+'px';
        document.getElementById(divid).style.top = location.y+5+'px';
        document.getElementById(divid).style.display="block";
    }
        
        
       function ViewMultiLeg(obj,objimg)
        {
            var pnl = document.getElementById(obj);
            var img = document.getElementById(objimg);
            if (pnl.style.display == "none")
            {
                pnl.style.display = "block";
                img.src = "images/detail-open-icon.gif";
            }
            else
            {
                pnl.style.display = "none";
                img.src = "images/detail-close-icon.gif";
            }
        }
        
    
       //******************************************************
       // This function used to show major travel flights
       //******************************************************  
       function showMajorTravelDetails(obj,flightId)
       {
            var divMajor = 'divMajorTravelDetails' + flightId 
            var divMajor1 = 'divsearchbutton' + flightId 
           
            if(document.getElementById(divMajor).style.display == "block")
            {
               document.getElementById(divMajor).style.display = "none";
               obj.innerHTML = "View Details";
            }
            else
            {
                document.getElementById(divMajor).style.display = "block";
               obj.innerHTML = "Close Details";
               document.getElementById(divMajor1).style.paddingTop = (parseInt(document.getElementById(divMajor).offsetHeight) - 45) + 'px';
            }
           
            return false;
       }
    
    