﻿// 
 
function CloseLoadingDiv()
{
    var loadingDiv = document.getElementById("div_loading_page");
    if (loadingDiv != null)
    {
        loadingDiv.style.display = "none";
    }
}

function showSummaryDetails()
{
    var theDiv = document.getElementById("div_summary_details");
    if (theDiv == null) { alert('Unable to display summary details. Please try back later.'); return;}
    
    if (theDiv.style.display == "inline")
        theDiv.style.display = "none";
    else
        theDiv.style.display = "inline";
}

function displayLoadingGraphic()
{ 
    var theLoadingDiv = document.getElementById("div_loading_page");
    if (theLoadingDiv == null) return; 
    theLoadingDiv.style.display = "inline";
    setTimeout('document.images["pbar"].src = "/user/images/booking/loading2.gif"', 200);   
}  

function displayCheckoutGraphic()
{ 
    var theLoadingDiv = document.getElementById("div_checkout_page");
    if (theLoadingDiv == null) return; 
    theLoadingDiv.style.display = "inline";
    setTimeout('document.images["pbarCheckout"].src = "/user/images/booking/loading2.gif"', 200);   
}  

function clickAway()
{
    var theDiv = document.getElementById("div_click_away");
    if (theDiv == null) return;
    
    if (theDiv.style.display == "inline")
        theDiv.style.display = "none";
    else
        theDiv.style.display = "inline"; 
} 

var newwindow;
function open_help_window(url)
{
      newwindow=window.open(url,'helpWindow','height=475px,width=710px,sizable=no');
      if (window.focus) {newwindow.focus()}
}

 function open_weather_window(url)
{
      newwindow=window.open(url,'weatherWindow','height=560px,width=620px,resizable=1');
      if (window.focus) {newwindow.focus()}
}

 function open_survey_window(url)
{
      newwindow=window.open(url,'surveyWindow','height=575px,width=810px,resizable=1');
      if (window.focus) {newwindow.focus()}
}

function showHideDiv(theDivName, unfoundMessage)
{
    var theDiv = document.getElementById(theDivName);
    if (theDiv == null) 
    { 
        if (unfoundMessage != "") alert(unfoundMessage); 
        return;
    }
    
    if (theDiv.style.display == "inline")
    {
        theDiv.style.display = "none";
        theDiv.style.visibility = "hidden";
    }
    else
    {
        theDiv.style.display = "inline";
        theDiv.style.visibility = "visible";
    }
}

function getObj(name){
 if (document.getElementById){
  this.obj = document.getElementById(name);
  if (this.obj != null)
  {
    this.style = document.getElementById(name).style;
  }
 }
 else if (document.all){
  this.obj = document.all[name];
  this.style = document.all[name].style;
 }
}

var currentVisibleContent = "";

function resize_id(obj) {
 if (obj != "")
 {
    currentVisibleContent = obj;
 }
 var strScrollingContent = currentVisibleContent + "PopupScrollingContent";
 var oContent = new getObj(strScrollingContent);
 var strContentContainer = currentVisibleContent + "PopupContentContainer";
 var oPrimaryPopupDiv = document.getElementById(strContentContainer);
 var strHeaderContentDiv = currentVisibleContent + "PopupContentHeader";
 var intContentHeightOffset = 115; // This is the header height + footer height
 if ((oContent != null) && (oPrimaryPopupDiv != null))
 {
 	if (oPrimaryPopupDiv.offsetHeight - intContentHeightOffset > 0)
	{
		oContent.style.height = (oPrimaryPopupDiv.offsetHeight - intContentHeightOffset) + "px";
	}
 }
}

window.onresize = function() { resize_id(""); }

function showPopUpContent(id)
{
    // show div
    var theDiv = document.getElementById(id);
    if (theDiv != null)
    {
        if (theDiv.style.display=="block")
        {
            theDiv.style.display="none";
        }
        else
        {
            theDiv.style.display="block";
        }
    }
}

