﻿// Common functions that are used throughout the ECommerce system.


// Determine how we apply the "visible" style to display a table row.  IE and Moz do this differently.
if(navigator.appName.indexOf("Microsoft") > -1)
{
    var g_platformTRVisibleStyle = 'block';
    var g_platformTBodyVisibleStyle = 'block';
}
else
{
    var g_platformTRVisibleStyle = 'table-row';
    var g_platformTBodyVisibleStyle = 'table-row-group';
}

var g_panelGroups = new Array();

function togglePanel(oLink, sDivId, sGroupId)
{
    var oDiv = document.getElementById(sDivId);
    var bDisplayNext = true;
    
    if (g_panelGroups[sGroupId])
    {
        closePanel(g_panelGroups[sGroupId].Link, g_panelGroups[sGroupId].Div);
        bDisplayNext = (g_panelGroups[sGroupId].Div.id != oDiv.id);
        g_panelGroups[sGroupId] = null;
    }
    
    if (bDisplayNext)
    {
        g_panelGroups[sGroupId] = new Object();
        g_panelGroups[sGroupId].Link = oLink;
        g_panelGroups[sGroupId].Div = oDiv;
        openPanel(oLink, oDiv);
    }
}

function openPanel(oLink, oDiv)
{
    oLink.className = "withTwistyIconOpen";

    if (oDiv.nodeName=="TR")
    {
         oDiv.style.display = g_platformTRVisibleStyle;
    }
    else if (oDiv.nodeName=="TBODY")
    {
        oDiv.style.display = g_platformTBodyVisibleStyle;
    }
    else
    {
         oDiv.style.display = "block";
    }
}

function closePanel(oLink, oDiv)
{

    oLink.className = "withTwistyIconClosed";
    oDiv.style.display = "none";

}

/**
Convert a JavaScript Date object to a string, based on the dateFormat and dateSeparator
variables at the beginning of this script library.
*/
function getDateString(dateVal)
{
    var dayString = "00" + dateVal.getDate();
    var monthString = "00" + (dateVal.getMonth()+1);
    dayString = dayString.substring(dayString.length - 2);
    monthString = monthString.substring(monthString.length - 2);

    switch (dateFormat)
    {
        case "dmy" :
            return dayString + dateSeparator + monthString + dateSeparator + dateVal.getFullYear();
        case "ymd" :
            return dateVal.getFullYear() + dateSeparator + monthString + dateSeparator + dayString;
        case "mdy" :
        default :
            return monthString + dateSeparator + dayString + dateSeparator + dateVal.getFullYear();
    }
}


/**
Convert a string to a JavaScript Date object.
*/
function getFieldDate(dateString)
{
    var dateVal;
    var dArray;
    var d, m, y;

    try
    {
        dArray = splitDateString(dateString);
        if (dArray)
        {
            switch (dateFormat)
            {
                case "dmy" :
                    d = parseInt(dArray[0], 10);
                    m = parseInt(dArray[1], 10) - 1;
                    y = parseInt(dArray[2], 10);
                    break;
                case "ymd" :
                    d = parseInt(dArray[2], 10);
                    m = parseInt(dArray[1], 10) - 1;
                    y = parseInt(dArray[0], 10);
                    break;
                case "mdy" :
                default :
                    d = parseInt(dArray[1], 10);
                    m = parseInt(dArray[0], 10) - 1;
                    y = parseInt(dArray[2], 10);
                    break;
            }
            dateVal = new Date(y, m, d);
        }
        else if (dateString)
        {
            dateVal = new Date(dateString);
        }
        else
        {
            dateVal = new Date();
        }
    }
    catch(e)
    {
        dateVal = new Date();
    }

    return dateVal;
}


/**
Try to split a date string into an array of elements, using common date separators.
If the date is split, an array is returned; otherwise, we just return false.
*/
function splitDateString(dateString)
{
    var dArray;
    if (dateString.indexOf("/") >= 0)
        dArray = dateString.split("/");
    else if (dateString.indexOf(".") >= 0)
        dArray = dateString.split(".");
    else if (dateString.indexOf("-") >= 0)
        dArray = dateString.split("-");
    else if (dateString.indexOf("\\") >= 0)
        dArray = dateString.split("\\");
    else
        dArray = false;

    return dArray;
}

/*Format Currency*/
function formatCurrency(num) {
    num = num.toString().replace(/\$|\,/g,'');
    if(isNaN(num))
    num = "0";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num*100+0.50000000001);
    cents = num%100;
    num = Math.floor(num/100).toString();
    if(cents<10)
    cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
    num = num.substring(0,num.length-(4*i+3))+','+
    num.substring(num.length-(4*i+3));
    return num + '.' + cents;
}

function isCurrency (sString) {
  return RegExp(/^\$?[0-9\,]+(\.\d{2})?$/).test(String(sString).replace(/^\s+|\s+$/g, ""));
}

// ----------------------------------------------------------------------------
// Function:    TODO
// Purpose:     TODO
// Inputs:      TODO
// Returns:     TODO
// ----------------------------------------------------------------------------

function getPosition(oObject)
{
    if (oObject)
    {
        var oParentPosition = getPosition(oObject.offsetParent);
        return [oObject.offsetLeft + oParentPosition[0],
                oObject.offsetTop + oParentPosition[1]];
    }
    else
        return [0,0];
}

// ----------------------------------------------------------------------------
// Function:    TODO
// Purpose:     TODO
// Inputs:      TODO
// Returns:     TODO
// ----------------------------------------------------------------------------
function toggleDhtmlPopup(popupID, triggeredLinkObj)
{
    var popup = document.getElementById(popupID);

    if (popup.style.display != "block")
    {
     
        popup.style.display = 'block';
        var linkPosition = getPosition(triggeredLinkObj);
        
        var oPageBody = document.getElementById('pageBody');
        var pagePosition = getPosition(oPageBody);
        
        var iPopupLeftPosition = linkPosition[0];
        var iOffsetRight = iPopupLeftPosition + popup.offsetWidth;
        var iPageOffsetRight = pagePosition[0] + oPageBody.offsetWidth;
        var iOffsetDifference = iPageOffsetRight - iOffsetRight;
        
        if (iOffsetDifference < 0)
        {
            iPopupLeftPosition += iOffsetDifference;
        }
        
        var winSize = getPageSize();
        var topBuffer = 0;
        
        //winSize[2] = window width
        if(iPopupLeftPosition > winSize[2] / 2){
            //get position of subHeader(div containing whistler blackcomb header)
            var subHeaderPos = getPosition(document.getElementById('header'));
            iPopupLeftPosition = subHeaderPos[0] + 760 - 310;
            topBuffer = -140;
        } else {
            iPopupLeftPosition = iPopupLeftPosition - 135;
        }
        
      
        popup.style.top = (linkPosition[1] + triggeredLinkObj.offsetHeight)+ topBuffer + 'px';
        popup.style.left = iPopupLeftPosition + 'px';
        
    }
    else
    {
        popup.style.display = 'none';
        // Hide select boxes as they will 'peek' through the image in IE
        /*
        selects = document.getElementsByTagName("select");
        for (i = 0; i != selects.length; i++) {
                selects[i].style.visibility = "";
        }
        */
    }

}

function placeCrcyPopup(popupID){
    var popup = document.getElementById(popupID);
   
    if (popup.style.display == "block")
    {
     
        popup.style.display = 'block';
        var popupObj = document.getElementById(popupID);
        var popupPos = getPosition(popupObj);
        
        var oPageBody = document.getElementById('pageBody');
        var pagePosition = getPosition(oPageBody);

        var iPopupLeftPosition = 0;
      
        var winSize = getPageSize();

        //winSize[3] = window height
        //check whether pop up is in upper right corner or bottom left corner
        if(popupPos[1] < winSize[3] / 2){
            //get position of subHeader(div containing whistler blackcomb header)
            var subHeaderPos = getPosition(document.getElementById('header'));
            iPopupLeftPosition = subHeaderPos[0] + 760 - 310;
        } 
        else {
            //115 is how much the pop up sticks out to the right of the content
            iPopupLeftPosition = pagePosition[0] - 115;
        }      
      
        popup.style.left = iPopupLeftPosition +'px';
    }
}

function hideDropDownOnWait(targetDiv){
    if (!window.browser)
	{	        
	    getBrowserInfo();
	} else {
	    browser = window.browser;
	}
	
	if(browser == 'Internet Explorer' && window.version == '6' ){

        var allDropDowns = document.getElementsByTagName("select");
        for(i=0; i < allDropDowns.length; i++){
            if(allDropDowns[i].id.indexOf(targetDiv) > -1){
                allDropDowns[i].style.display = "none";
                break;
            }
        }

    }
}


// ----------------------------------------------------------------------------
// Function:    interceptEnterKeyPress
// Purpose:     Causes the "click" event to be invoked on a particular button
//              if the "Enter" key is pressed from within a text box.
// Inputs:      e - Event Args
//              sButtonId - ID of the button to invoke the click on.
// Returns:     TODO
// ----------------------------------------------------------------------------
function interceptEnterKeyPress(e, sButtonId)
{
    var unicode=e.keyCode? e.keyCode : e.charCode
    if (unicode == 13)
    {                               
        document.getElementById(sButtonId).click();
        return false;
    }
}

// ----------------------------------------------------------------------------
// Function:    hover
// Purpose:     Changes the class of an element if the browser doesn't
//              understand xx:hover styles on elements other than hyperlinks
// Inputs:      obj - DOM object
//              sClassName - CSS class name to change to
// Returns:     none
// ----------------------------------------------------------------------------
function hover(obj, sClassName)
{
    obj.className = sClassName;
}

/*Display Loading Screen*/
/***********************************************************/

function setupLoadingPage(loadingPageID, loadingDivID)
{
	var arrAbsoluteRoots = getPageAbsoluteRoot(window, self)
	var rootWindow = arrAbsoluteRoots[0];

    var loadingPage = rootWindow.document.getElementById(loadingPageID); // find the div tag
    if (loadingPage)
    {
        if (!browser)
	    {	        
	        getBrowserInfo();
	    }

        if (browser == 'Internet Explorer' && version == '6')
        {
            // Hide objects as they will 'peek' through the image in IE
	        var arrAbsoluteRoots = getPageAbsoluteRoot(window, self)
	        var rootWindow = arrAbsoluteRoots[0];
            
            objects = rootWindow.document.getElementsByTagName("object");
            for (i = 0; i != objects.length; i++) {
                if (objects[i].offsetParent.id != loadingPageID)
                {
                    objects[i].style.visibility = "hidden";
                }
                else
                {
                    objects[i].style.visibility = "visible";
                }
            }

           // Hide select boxes as they will 'peek' through the image in IE
            selects = rootWindow.document.getElementsByTagName("select");
            for (i = 0; i != selects.length; i++) {
                    selects[i].style.visibility = "hidden";
            } 
        }

        // Hide select boxes as they will 'peek' through the image in IE
        /*selects = document.getElementsByTagName("select");
        for (i = 0; i != selects.length; i++) {
                selects[i].style.visibility = "hidden";
        }
        */
        var arrayPageSize = getPageSize();

        loadingPage.style.width = arrayPageSize[0] + 'px';
        loadingPage.style.height = arrayPageSize[1] + 'px';
        
        loadingPage.style.display = "block";

        /* Get width & height of LoadingDiv Content*/
        /**************************************************************/
        var loadingDiv = rootWindow.document.getElementById(loadingDivID);

        loadingDiv.style.visibility = "hidden";
        loadingDiv.style.display = "block";
        loadingDiv.style.position = "absolute";

        var loadingDivWidth = loadingDiv.offsetWidth;
        var loadingDivHeight = loadingDiv.offsetHeight;
        
        loadingDiv.style.position = "static";
        loadingDiv.style.display = "none";
        loadingDiv.style.visibility = "visible";

        /**************************************************************/
        
        document.body.style.overflow = "hidden";
        center(loadingDivID, loadingDivWidth, loadingDivHeight);
    }
}


function unsetupLoadingPage(loadingPageID, loadingDivID) {
    var arrAbsoluteRoots = getPageAbsoluteRoot(window, self)
    var rootWindow = arrAbsoluteRoots[0];

    var loadingPage = rootWindow.document.getElementById(loadingPageID); // find the div tag
    if (!loadingPage) return;

    loadingPage.style.display = "none";

    var loadingDiv = rootWindow.document.getElementById(loadingDivID);
    if (loadingDiv) {
        loadingDiv.style.display = "none";
    }

    document.body.style.overflow = "auto";
    window.scrollTo(0, 0);
}

/*Positioning functions*/
/******************************************************************/

function center(element, elementWidth, elementHeight){
	var arrAbsoluteRoots = getPageAbsoluteRoot(window, self)
	var rootWindow = arrAbsoluteRoots[0];

    try{
        element = rootWindow.document.getElementById(element);
    }catch(e){
        return;
    }

    var my_width  = 0;
    var my_height = 0;

    if ( typeof( rootWindow.innerWidth ) == 'number' ){
        my_width  = rootWindow.innerWidth;
        my_height = rootWindow.innerHeight;
    }else if ( rootWindow.document.documentElement && 
             ( rootWindow.document.documentElement.clientWidth ||
               rootWindow.document.documentElement.clientHeight ) ){
        my_width  = rootWindow.document.documentElement.clientWidth;
        my_height = rootWindow.document.documentElement.clientHeight;
    }
    else if ( rootWindow.document.body && 
            ( rootWindow.document.body.clientWidth || rootWindow.document.body.clientHeight ) ){
        my_width  = rootWindow.document.body.clientWidth;
        my_height = rootWindow.document.body.clientHeight;
    }

    element.style.position = 'absolute';
    element.style.zIndex   = 99;

    var scrollY = 0;

    if(navigator.appName == "Microsoft Internet Explorer")
    {
        if ( rootWindow.document.documentElement && rootWindow.document.documentElement.scrollTop ){
            scrollY = rootWindow.document.documentElement.scrollTop;
        }else if ( rootWindow.document.body && rootWindow.document.body.scrollTop ){
            scrollY = rootWindow.document.body.scrollTop;
        }else if ( rootWindow.pageYOffset ){
            scrollY = rootWindow.pageYOffset;
        }else if ( rootWindow.scrollY ){
            scrollY = rootWindow.scrollY;
        }
        var setY = ( my_height - elementHeight ) / 2 + scrollY;
    }
    else
    {
        var arrPageSize = getPageSize();
        var arrPageScroll = getScrollXY();
        var setY = arrPageScroll[1] + ((arrPageSize[3] - elementHeight - ((arrPageSize[3] - elementHeight)% 2 )) / 2);
    }
    
    var setX = ( my_width - elementWidth ) / 2;

    setX = ( setX < 0 ) ? 0 : setX;
    setY = ( setY < 0 ) ? 0 : setY;

    element.style.left = setX + "px";
    element.style.top  = setY + "px";

    element.style.display  = 'block';
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	var arrAbsoluteRoots = getPageAbsoluteRoot(window, self)
	
	var rootWindow = arrAbsoluteRoots[0];
	var rootSelf = arrAbsoluteRoots[1];
	
	if (rootWindow.innerHeight && rootWindow.scrollMaxY) {	
		xScroll = rootWindow.document.body.scrollWidth;
		yScroll = rootWindow.innerHeight + rootWindow.scrollMaxY;
	} else if (rootWindow.document.body.scrollHeight > rootWindow.document.body.offsetHeight){ // all but Explorer Mac
		xScroll = rootWindow.document.body.scrollWidth;
		yScroll = rootWindow.document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = rootWindow.document.body.offsetWidth;
		yScroll = rootWindow.document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (rootSelf.innerHeight) {	// all except Explorer
		windowWidth = rootSelf.innerWidth;
		windowHeight = rootSelf.innerHeight;
	} else if (rootWindow.document.documentElement && rootWindow.document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = rootWindow.document.documentElement.clientWidth;
		windowHeight = rootWindow.document.documentElement.clientHeight;
	} else if (rootWindow.document.body) { // other Explorers
		windowWidth = rootWindow.document.body.clientWidth;
		windowHeight = rootWindow.document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function getScrollXY()
{
    var scrOfX = 0;
    var scrOfY = 0;

	var arrAbsoluteRoots = getPageAbsoluteRoot(window, self)
	
	var rootWindow = arrAbsoluteRoots[0];
    
    if (typeof(rootWindow.pageYOffset) == 'number')
    {
        //Netscape compliant
        scrOfY = rootWindow.pageYOffset;
        scrOfX = rootWindow.pageXOffset;
    }
    else if (rootWindow.document.body && (rootWindow.document.body.scrollLeft || rootWindow.document.body.scrollTop))
    {
        //DOM compliant
        scrOfY = rootWindow.document.body.scrollTop;
        scrOfX = rootWindow.document.body.scrollLeft;
    }
    else if (rootWindow.document.documentElement && (rootWindow.document.documentElement.scrollLeft || rootWindow.document.documentElement.scrollTop))
    {
        //IE6 standards compliant mode
        scrOfY = rootWindow.document.documentElement.scrollTop;
        scrOfX = rootWindow.document.documentElement.scrollLeft;
    }
    
    return [scrOfX, scrOfY];
}


function invokeConfirmAction(buttonID, loadingPageID, loadingDivID, confirmMessage)
{
    var confirmed = true;
    
    if ((confirmMessage != null) && (confirmMessage != ""))
    {
        confirmed = confirm(confirmMessage);
    }
    
    if (confirmed)
    {
        var button = document.getElementById(buttonID);

        if (button != null)
        {
            setTimeout("setupLoadingPage('" + loadingPageID +"','" + loadingDivID + "');", 10);
            button.click();
        }
    }
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function getPageAbsoluteRoot(objWindow, objSelf)
{
    if (objWindow)
    {
        getPageAbsoluteRoot(objWindow.offsetParent, objSelf.offsetParent);
        return [objWindow.parent, objSelf.parent];
    }
    else
    {
        return [null, null];
    }
}

function htmlEncode(s) {
        var str = new String(s);
        str = str.replace(/&/g, "&amp;");
        str = str.replace(/</g, "&lt;");
        str = str.replace(/>/g, "&gt;");
        str = str.replace(/"/g, "&quot;");
        return str;
}

function synchronizeHeight(id1,id2)
{
    var one = document.getElementById(id1);
    var two = document.getElementById(id2);
    if (one && two)
    {
        var iMaxHeight = (one.offsetHeight > two.offsetHeight) ? one.offsetHeight : two.offsetHeight;
        one.style.height = iMaxHeight + "px";
        two.style.height = iMaxHeight + "px";
    }
}

function addShadow(placer)
{
    var shadow = document.createElement("div");

    shadow.className = "shadow4px";
    placer.parentNode.insertBefore(shadow,placer);

    var child = document.createElement("div");
    child.innerHTML = "&nbsp;";
    child.className = "northwest";
    shadow.appendChild(child);
    shadow._northwest = child;
    child = document.createElement("div");
    child.innerHTML = "&nbsp;";
    child.className = "northeast";
    shadow.appendChild(child);
    shadow._northeast = child;
    child = document.createElement("div");
    child.innerHTML = "&nbsp;";
    child.className = "southwest";
    shadow.appendChild(child);
    shadow._southwest = child;
    child = document.createElement("div");
    child.innerHTML = "&nbsp;";
    child.className = "southeast";
    shadow.appendChild(child);
    shadow._southeast = child;

    placer['_shadow'] = shadow;

    adjustShadow(placer);
}

function adjustShadow(placer)
{
    if (placer._shadow)
    {
        var se = placer._shadow;
        var y = placer.offsetTop;
        var x = placer.offsetLeft;
        var h = placer.offsetHeight;
        var w = placer.offsetWidth;

        se.style.top = y + "px";
        se.style.left = (x-3) + "px";        
        se._northwest.style.height = h + "px";
        se._northeast.style.left = (w+3) + "px";
        se._northeast.style.height = h + "px";
        se._southwest.style.top = h + "px";
        se._southwest.style.width = w + "px";
        se._southeast.style.left = w + "px";
        se._southeast.style.top = h + "px";
        se.style.visibility = "visible";
    }
}


/*String Functions*/
/*********************************************************/
// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}

/*-------------------------------Browser Detection------------------------------------*/

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
var lbContent;
var lbOverlay;
var isVista = false;
/*-----------------------------------------------------------------------------------------------*/

//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/

function getBrowserInfo() {
	if (checkIt('konqueror')) {
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser 	= "Safari"
	else if (checkIt('omniweb')) browser 	= "OmniWeb"
	else if (checkIt('opera')) browser 		= "Opera"
	else if (checkIt('webtv')) browser 		= "WebTV";
	else if (checkIt('icab')) browser 		= "iCab"
	else if (checkIt('msie')) browser 		= "Internet Explorer"
	else if (!checkIt('compatible')) {
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";

	if (!version) version = detect.charAt(place + thestring.length);

	if (!OS) {
		if (checkIt('linux')) OS 		= "Linux";
		else if (checkIt('x11')) OS 	= "Unix";
		else if (checkIt('mac')) OS 	= "Mac"
		else if (checkIt('win')) OS 	= "Windows"
		else OS 						= "an unknown operating system";
    }

    if (detect.indexOf('windows NT 6.0') > -1) {
        isVista = true;
    }

}

function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

/************************************/

function makeFrame(parentOfFrame, frmName)
{
    ifrm = document.createElement("IFRAME");
    ifrm.setAttribute("id", frmName);
    ifrm.setAttribute("src", "/reservations/nothing.htm");
    ifrm.setAttribute("frameborder", "0");
    ifrm.setAttribute("scrolling", "no");
    
    ifrm.style.width = "0";
    ifrm.style.height = "0";
    
    parentOfFrame.appendChild(ifrm);
    
    return ifrm;
}

function removeFrame(parentOfFrame, frmName)
{   
    var ifrm = document.getElementById(frmName);    

    if (ifrm)
    {
        parentOfFrame.removeChild(ifrm);
    }

}

/*******************************************************************************/
/* Telerik RadToolTip Modal Overlay Workaround - Start                         */
/*******************************************************************************/
function setOverlay(sender, args) {
    var arrAbsoluteRoots = getPageAbsoluteRoot(window, sender)
    var rootWindow = arrAbsoluteRoots[0];
    var loadingPageID = "loadingPageAvailabilityWaitMessage";

    var loadingPage = rootWindow.document.getElementById(loadingPageID); // find the div tag
    if (loadingPage) {
        if (!browser) {
            getBrowserInfo();
        }

        if (browser == 'Internet Explorer' && version == '6') {
            // Hide objects as they will 'peek' through the image in IE
            var arrAbsoluteRoots = getPageAbsoluteRoot(window, sender)
            var rootWindow = arrAbsoluteRoots[0];

            objects = rootWindow.document.getElementsByTagName("object");
            for (i = 0; i != objects.length; i++) {
                if (objects[i].offsetParent.id != loadingPageID) {
                    objects[i].style.visibility = "hidden";
                }
                else {
                    objects[i].style.visibility = "visible";
                }
            }

            // Hide select boxes as they will 'peek' through the image in IE
            selects = rootWindow.document.getElementsByTagName("select");
            for (i = 0; i != selects.length; i++) {
                selects[i].style.visibility = "hidden";
            }
        }

        // Hide select boxes as they will 'peek' through the image in IE
        /*selects = document.getElementsByTagName("select");
        for (i = 0; i != selects.length; i++) {
        selects[i].style.visibility = "hidden";
        }
        */
        var arrayPageSize = getPageSize();

        loadingPage.style.width = arrayPageSize[0] + 'px';
        loadingPage.style.height = arrayPageSize[1] + 'px';

        loadingPage.style.display = "block";

        /* Get width & height of LoadingDiv Content*/
        /**************************************************************/
        /*
        var loadingDiv = rootWindow.document.getElementById(loadingDivID);

        loadingDiv.style.visibility = "hidden";
        loadingDiv.style.display = "block";
        loadingDiv.style.position = "absolute";

        var loadingDivWidth = loadingDiv.offsetWidth;
        var loadingDivHeight = loadingDiv.offsetHeight;

        loadingDiv.style.position = "static";
        loadingDiv.style.display = "none";
        loadingDiv.style.visibility = "visible";
        */

        /**************************************************************/

        //document.body.style.overflow = "hidden";
        //center(loadingDivID, loadingDivWidth, loadingDivHeight);
    }
}

function unsetOverlay(sender, args) {
    
    var arrAbsoluteRoots = getPageAbsoluteRoot(window, sender)
    var rootWindow = arrAbsoluteRoots[0];
    var loadingPageID = "loadingPageAvailabilityWaitMessage";

    var loadingPage = rootWindow.document.getElementById(loadingPageID); // find the div tag
    if (!loadingPage) return;

    loadingPage.style.display = "none";
    unhideDropDowns();
    /*
    var loadingDiv = rootWindow.document.getElementById(loadingDivID);
    if (loadingDiv) {
    loadingDiv.style.display = "none";
    }
    */

    //document.body.style.overflow = "auto";
    //window.scrollTo(0, 0);
}
/*******************************************************************************/
/* Telerik RadToolTip Modal Overlay Workaround - End                           */
/*******************************************************************************/

function unhideDropDowns(){
    if (!window.browser)
	{	        
	    getBrowserInfo();
	} else {
	    browser = window.browser;
	}
	
	if(browser == 'Internet Explorer' && window.version == '6' ){
        var allDropDowns = document.getElementsByTagName("select");
        for(i=0; i < allDropDowns.length; i++){
            allDropDowns[i].style.display = "inline-block";
            allDropDowns[i].style.visibility = "visible";
            allDropDowns[i].style.float = "left";
        }

    }
}