﻿var siteUrl = ""
var ret = new Array();
var txtDestination = ""
var inDestination = ""

    function BrowserCode(){
        if ( (navigator.userAgent.indexOf("IE")!=-1) && (navigator.appName=="Microsoft Internet Explorer") ){
            return "IE";
        }
        else if ( (navigator.userAgent.indexOf("Firefox")!=-1) && (navigator.appName=="Netscape") ){
            return "FF";
        }
    }
    
    function ge(obj)
    {
     return document.getElementById(obj);
    }
/* destinations Dialog  */

    function openDestinationDialog(path,__txtDestination,__inDestination){
        var height = "310"
        if(path.indexOf("flights") != -1){ height = "360" }
        if(path.indexOf("hotels") != -1){ height = "335" }
        
	    var style = "dialogHeight:" + height + "px; dialogWidth:250px;dialogTop:px;dialogLeft:px;edge:Raised;center:Yes;help:no;resizable:No;status:No;scroll:no;";
	    var url = siteUrl + "resources/destinations/" + path;
    	
    	if(window.showModalDialog){	
	         ret = window.showModalDialog(url,"",style);
    	   
	        try{ 
		        ge(__txtDestination).value =ret[0]; 	
		        ge(__inDestination).value=ret[1];
	        }catch(e){ }
	    
	    }else{
	      txtDestination = __txtDestination
          inDestination = __inDestination
	     window.open(url,"","width=250,height=" + height);
	    }
	  
	}
	
	function saveRtnValue() //return values from firefox
	{
	 	ge(txtDestination).value =ret[0]; 	
		ge(inDestination).value=ret[1];
	}
/* END OF destinations Dialog  */
	
/* Calendar Waiting Dialog  */	
	    function openWaitingCalendar(code, inputDest, openerObjName, inputName){
        var myCode = "";
        var ifrmName = "ifrmCalendar";
        var ifrmHeight = 227;
        var ifrmWidth = 176;
        var DName = "divCalendar";
        if (code.toLowerCase() == "from") myCode = "5";
        else if (code.toLowerCase() == "to") myCode = "6";
     
        if (ge(DName).style.display == "none"){
            with (ge(ifrmName)){
                if(BrowserCode() == "IE"){
                 ge(ifrmName).onreadystatechange = function(){if(ge(ifrmName).readyState == "complete")ge(DName).style.display = "";}
                }else{
                 ge(DName).style.display = "block";
                }
                src = siteUrl + "resources/calendar_alp/calendarWaitingFF.aspx?Code=" + myCode + "&LastChosenDate=" + "&openerName=" + openerObjName + "&inputName=" + inputName + "&destCode=" + inputDest.value;
                height = ifrmHeight;
                width = ifrmWidth;
            }
        }    
    }
