 function ChangeCoord(orig, dest)
 {
     var control = document.getElementById("H_T_div"+ orig);
     if (control)
     {
        control.style.visibility = "hidden";
        control.style.display = "none"; 
        var control2 = document.getElementById("H_T_div" + dest);
        if (control2)
        {
		     control2.style.visibility = "visible";
		     control2.style.display = "";  
		}
	}
 }
 
 function CheckBooking(formName)
 {
 
    if (formName=="myreservations")
    {
        var control = document.getElementById("H_T_CtrlMyReservation_txtLastName");
        if (control)
        {
           window.document.forms[0].LoginName.value=control.value;
           control = document.getElementById("H_T_CtrlMyReservation_txtLocator");
           window.document.forms[0].RecordLocator.value=control.value; 
           window.document.forms[0].action="welcome.aspx?pg=bkgModManager&login=myreservations";
           window.document.forms[0].submit();
        }	
     }
    else
    {
        var control = document.getElementById("H_T_CtrlOnlineCheckin_txtLastName");
        if (control)
        {
           window.document.forms[0].LoginName.value=control.value;
           control = document.getElementById("H_T_CtrlOnlineCheckin_txtLocator");
           window.document.forms[0].RecordLocator.value=control.value; 
           window.document.forms[0].action="welcome.aspx?pg=bkgModManager&login=OnlineCheckin";
           window.document.forms[0].submit();	
         }
     }
 }

 function ChangeLanguage(language)
 {
    HM_Language =language;
   
    var x = readCookie('UICulture')
    if (x)
    {
	    eraseCookie('UICulture');
	    createCookie('UICulture',HM_Language,7); 
	    location.reload();
    }
    else//if there is no cookies reload the home page
    {
      location.href="Welcome.aspx?currlang="+HM_Language; //history.go(0);
    }
     
 }
 
 function printit()
 {  
    if (window.print)
    {
        window.print();  
    } 
    else 
    {
         var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
         document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
         WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
     }
}

function MM_openWindow(theURL,winName,features)
{ 
  window.open(theURL,winName,features);
}

function MM_openBrWindow(theURL,winName,features)
 { //v2.0
 
 // var newURL=theURL;
  if (HM_Language == "es")
  {
    window.open(theURL.replace(".aspx", "_es.aspx"),winName,features);
  }
  else
  {
    window.open(theURL,winName,features);
   }
}

function MM_openBrDiv(theURL,winName,xwidth,yheight)
 { 
 
     var control = document.getElementById("PopupHelp");
     
     if (control)
     {  
       var iframecontents="width="+xwidth;
       iframecontents=iframecontents+" height="+yheight;
       control.innerHTML="<iframe src='./asp_popup/popup_card_security_code.aspx' frameborder=1 align=middle marginheight=2 marginwidth=2 scrolling=auto "+iframecontents+" ></iframe>"
      
     }

}

function MM_PopupHelpNoL(theURL,winName,xwidth,yheight)
 { 
 
     // var newURL=theURL;
   //  width=300,height=400,top=150,left=300,resizable=no,scrollbars=no
    var MaxWidth=475;
    var MaxHigth=475;
    var scroll=0;
    var features=""
   
    if (yheight>MaxHigth)
    {
      xwidth=xwidth+25;
      yheight=500;
      scroll=1;
      
    }
    
    if (xwidth>MaxWidth)
    {
      yheight=yheight+25;
      xwidth=500;
      scroll=1;
     }
     
    if (scroll==1)
    {
      features="width="+xwidth +",height="+yheight+ ",left=300,top=150,scrollbars=yes";
    }
    else
    {
      features="width="+xwidth +",height="+yheight+ ",left=300,top=150,scrollbars=no";
    }
    
    window.open(theURL,winName,features);
   
}


function MM_PopupHelp(theURL,winName,xwidth,yheight)
 { 
 
     // var newURL=theURL;
   //  width=300,height=400,top=150,left=300,resizable=no,scrollbars=no
    var MaxWidth=475;
    var MaxHigth=475;
    var scroll=0;
    var features=""
   
    if (yheight>MaxHigth)
    {
      xwidth=xwidth+25;
      yheight=500;
      scroll=1;
      
    }
    
    if (xwidth>MaxWidth)
    {
      yheight=yheight+25;
      xwidth=500;
      scroll=1;
     }
     
    if (scroll==1)
    {
      features="width="+xwidth +",height="+yheight+ ",left=300,top=150,scrollbars=yes";
    }
    else
    {
      features="width="+xwidth +",height="+yheight+ ",left=300,top=150,scrollbars=no";
    }
     
    if (HM_Language == "es")
    {
      window.open(theURL.replace(".aspx", "_es.aspx"),winName,features);
    }
     else
    {
      window.open(theURL,winName,features);
    }
}

function MM_CloseDiv()
 { //v2.0
 
 
     var control = document.getElementById("PopupHelp");
     
     if (control)
     {  
        control.innerHTML="";
     }


}

function MM_openModalWindow(theURL,winName,features)
 { //v2.0
 
 // var newURL=theURL;
  if (HM_Language == "es")
  {
     window.showModalDialog(theURL.replace(".aspx", "_es.aspx"),winName,features);
  }
  else
  {
    window.showModalDialog(theURL,winName,features);
   }
}

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=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	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) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}

function getURLParam(strParamName){
var strReturn = "";
var strHref = window.location.href;
if ( strHref.indexOf("?") > -1 ){
	var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
	var aQueryString = strQueryString.split("?");
	for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
	if ( 
aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
		var aParam = aQueryString[iParam].split("=");
		strReturn = aParam[1];
		break;
	}
	}
}
return strReturn;
} 
