﻿var loaderText1="";
var loaderText2="";
browserVars = new browserVarsObj();
function browserVarsObj()
{
    this.updateMouse = browserVarsObjUpdateMouse;
    this.updateVars = browserVarsObjUpdateVars;

    this.mouseX = 0;
    this.mouseY = 0;

    this.type = new browserDetect();
    this.width = 0;
    this.height = 0
    this.screenWidth = screen.width;
    this.screenHeight = screen.height;
    this.scrollWidth = 0;
    this.scrollHeight = 0;
    this.scrollLeft = 0;
    this.scrollTop = 0;
    this.updateVars();
}
function browserVarsObjUpdateMouse(e)
{
if(!this.type.ie)
{
this.mouseX = e.pageX;
this.mouseY = e.pageY;
}
else
{
this.mouseX = window.event.clientX + this.scrollLeft;
this.mouseY = window.event.clientY + this.scrollTop;
}
}
function f_clientWidth() {
    return f_filterResults (
    window.innerWidth ? window.innerWidth : 0,
    document.documentElement ? document.documentElement.clientWidth : 0,
    document.body ? document.body.clientWidth : 0
    );
}
function f_clientHeight() {
    return f_filterResults (
    window.innerHeight ? window.innerHeight : 0,
    document.documentElement ? document.documentElement.clientHeight : 0,
    document.body ? document.body.clientHeight : 0
    );
}
function f_scrollLeft() {
    return f_filterResults (
    window.pageXOffset ? window.pageXOffset : 0,
    document.documentElement ? document.documentElement.scrollLeft : 0,
    document.body ? document.body.scrollLeft : 0
    );
}
function f_scrollTop() {
    return f_filterResults (
    window.pageYOffset ? window.pageYOffset : 0,
    document.documentElement ? document.documentElement.scrollTop : 0,
    document.body ? document.body.scrollTop : 0
    );
}
function f_scrollWidth() {
    return f_filterResults (
    document.width ? document.width : 0,
    document.documentElement ? document.documentElement.scrollWidth : 0,
    document.body ? document.body.scrollWidth : 0
    );
}
function f_scrollHeight() {
    return f_filterResults (
    document.height ? document.height : 0,
    document.documentElement ? document.documentElement.scrollHeight : 0,
    document.body ? document.body.scrollHeight : 0
    );
}
function browserDetect()
{
    this.getById = document.getElementById?true:false;
    this.layers = document.layers?true:false;
    this.ns4 = ((this.layers) && (!this.getById));
    this.ns6 = ((navigator.userAgent.indexOf('Netscape6') != -1) && (this.getById));
    this.moz = ((navigator.appName.indexOf('Netscape') != -1) && (this.getById) && (!this.ns6));
    this.ie  = ((!this.layers) && (this.getById) && (!(this.ns6 || this.moz)));
    this.opera = window.opera?true:false;
}
function f_filterResults(n_win, n_docel, n_body) {
var n_result = n_win ? n_win : 0;
if (n_docel && (!n_result || (n_result > n_docel)))
n_result = n_docel;
return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
function browserVarsObjUpdateVars()
{
    this.width = f_clientWidth();
    this.height = f_clientHeight();
    this.scrollWidth = f_scrollWidth();
    this.scrollHeight = f_scrollHeight();
    this.scrollLeft = f_scrollLeft();
    this.scrollTop = f_scrollTop();
}
function showLoader() 
{   
	document.getElementById('loaderHaze').style.height = pageHeight();
	document.getElementById('loaderHaze').style.width = pageWidth();
	
	setTimeout('document.images["loaderBarImage"].src = "images/boost/mloading.gif"', 200); 
	//document.getElementById('loaderBarImage').src = "../images/boost/mloading.gif";
	
	document.body.style.overflow='hidden';
	document.body.scroll='no';
	
	var loaderDiv = document.getElementById('loaderBlock');
	browserVars.updateVars();
	var lTop = new String(loaderDiv.style.top);
	var x = parseInt(lTop.replace("px","")) + browserVars.scrollTop;
	loaderDiv.style.top = x+"px";
	if(document.getElementById('pleaseWaitDiv') != null)
	    document.getElementById('pleaseWaitDiv').style.display = 'block';
} 

function hideLoader() {        
	if(document.getElementById('pleaseWaitDiv') != null)
	    document.getElementById('pleaseWaitDiv').style.display = 'none';
	    document.body.style.overflow='scroll';
	document.body.scroll='yes';
} 

function showBookingFormPopup(radWindowClientID,URL, isReserver) 
{
    var radWindow = $find(radWindowClientID); 
    if(isReserver)
    {
        var reg=new RegExp("&amp;", "g");
        var reg2= new RegExp("&", "g");
        var URLQuerystring=URL.replace(reg,'%26');
        URLQuerystring=URLQuerystring.replace(reg2,'%26');
        radWindow.setUrl(URLQuerystring);
    }
    else
        radWindow.setUrl(URL);
    
    radWindow.show();
    
    return false;
  
//	document.getElementById('bookingLoaderHaze').style.height = pageHeight();
//	document.getElementById('bookingLoaderHaze').style.width = pageWidth();
//	//document.getElementById('loaderBarImage').src = "../images/boost/mloading.gif";
//	
////	document.body.style.overflow='hidden';
////	document.body.scroll='no';
//	
//	var loaderDiv = document.getElementById('bookingLoaderBlock');
//	browserVars.updateVars();
//	
//	var lTop = new String(loaderDiv.style.top);
//	var x = parseInt(lTop.replace("px","")) + browserVars.scrollTop;
//	loaderDiv.style.top = x+"px";
//	
//	document.getElementById('bookingDiv').style.display = 'block';
//	//
//	var reg=new RegExp("&amp;", "g");
//    var reg2= new RegExp("&", "g");
//    var URLQuerystring=URL.replace(reg,'%26');
//    URLQuerystring=URLQuerystring.replace(reg2,'%26');
//    var oIfr = document.getElementById('BookingiFrame');
//    oIfr.style.display='block';
//    oIfr.src='TrackReservation.aspx?URLReservation='+ URLQuerystring;
	
}

 function closeBookingFormPopup()
 {
    if(document.getElementById('bookingDiv') != null)
    {
        document.getElementById('bookingDiv').style.display = 'none';
    }
    
    var loaderDiv = document.getElementById('bookingLoaderBlock');
    if(loaderDiv != null)
    {
	    browserVars.updateVars();
    	
	    var lTop = new String(loaderDiv.style.top);
	    var x = parseInt(lTop.replace("px","")) + browserVars.scrollTop;
	    loaderDiv.style.top = "100px";
    }
    if(document.getElementById('BookingiFrame')!= null)
    {
        document.getElementById('BookingiFrame').style.display='none';
        document.getElementById('BookingiFrame').src = "";
    }
    
    document.body.scroll='auto';
 }


// Modal Dialog Box
function pageWidth() 
{
    return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;
}
function pageHeight() 
{
    return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;
}
function posLeft() 
{
    return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;
}
function posTop() 
{
    return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;
}
function $(x)
{
    return document.getElementById(x);
}
function scrollFix()
{
   var bookingLoaderHaze=document.getElementById('bookingLoaderHaze');
   if(bookingLoaderHaze != null)
   {
        bookingLoaderHaze.style.top=posTop()+'px';
        bookingLoaderHaze.style.left=posLeft()+'px'
   }
   var bookingLoaderBlock = document.getElementById('bookingLoaderBlock');
   if(bookingLoaderBlock != null)
   {
    
        bookingLoaderBlock.style.top= 100 + posTop() + 'px';
        bookingLoaderBlock.style.left = "10%";
   }
   
}
function sizeFix()
{
    var obol=$('ol');
    if(obol != null && obol.style != null)
    {
        obol.style.height=pageHeight()+'px';
        obol.style.width=pageWidth()+'px';
    }
}
function kp(e)
{
    ky=e?e.which:event.keyCode;
    if(ky==88||ky==120)hm();
    return false
}
function inf(h)
{
    tag=document.getElementsByTagName('select');
    for(i=tag.length-1;i>=0;i--)
        tag[i].style.visibility=h;
    tag=document.getElementsByTagName('iframe');
    for(i=tag.length-1;i>=0;i--)
        tag[i].style.visibility=h;
    tag=document.getElementsByTagName('object');
    for(i=tag.length-1;i>=0;i--)
        tag[i].style.visibility=h;
}
function sm(obl, wd, ht)
{
    var h='hidden';
    var b='block';
    var p='px';
    var obol=$('ol'); 
    var obbxd = $('mbd');
    obbxd.innerHTML = $(obl).innerHTML;
    obol.style.height=pageHeight()+p;
    obol.style.width=pageWidth()+p;
    obol.style.top=posTop()+p;
    obol.style.left=posLeft()+p;
    obol.style.display=b;
    var tp=posTop()+((pageHeight()-ht)/2)-50;
    var lt=posLeft()+((pageWidth()-wd)/2)-12;
    var obbx=$('mbox');
    obbx.style.top=(tp<0?0:tp)+p;
    obbx.style.left=(lt<0?0:lt)+p;
    obbx.style.width=wd+p;
    obbx.style.height=ht+p;
    inf(h);obbx.style.display=b;    
}
function hm()
{
    var v='visible';
    var n='none';
    $('ol').style.display=n;
    $('mbox').style.display=n;
    inf(v);
    document.onkeypress=''
}
function initmb()
{
    var ab='absolute';
    var n='none';
    var obody=document.getElementsByTagName('body')[0];
    var frag=document.createDocumentFragment();
    var obol=document.createElement('div');
    obol.setAttribute('id','ol');
    obol.style.display=n;obol.style.position=ab;
    obol.style.top=0;obol.style.left=0;
    obol.style.zIndex=998;obol.style.width='100%';
    frag.appendChild(obol);
    var obbx=document.createElement('div');
    obbx.setAttribute('id','mbox');
    obbx.style.display=n;
    obbx.style.position=ab;
    obbx.style.zIndex=999;
    var obl=document.createElement('span');
    obbx.appendChild(obl);
    var obbxd=document.createElement('div');
    obbxd.setAttribute('id','mbd');
    obl.appendChild(obbxd);
    frag.insertBefore(obbx,obol.nextSibling);
    obody.insertBefore(frag,obody.firstChild);
    window.onscroll = scrollFix; 
    window.onresize = sizeFix;
}
window.onload = initmb;



