﻿var _isIE = (((navigator.appName).indexOf('Microsoft') > -1) ? true : false)
var _isSafari = (((navigator.userAgent).indexOf('Safari') > -1) ? true : false)

var _defaultUpdatingIcon = '<img style="vertical-align: middle" src="images/loading.jpg" >&nbsp;&nbsp;';
var _defaultUpdatingMessage = 'Updating...';
var _updatingResultsMessage = null;
var _timeToExpire=1000;
var _loadingDiv = null;
var _mainDiv = null;
var _top=null;
var _contentframe=null;
var _contenttd = null;

function getUpdateMessage(defaultMsg){
var msgToShow = _defaultUpdatingIcon;
if (_updatingResultsMessage != null && _updatingResultsMessage.length > 0) {
msgToShow += _updatingResultsMessage;
} else if (defaultMsg != null && defaultMsg.length > 0) {
msgToShow += defaultMsg;
} else {
msgToShow += _defaultUpdatingMessage;}return msgToShow;}
function showmessage(msgToShow, timeToExpire, mainDiv, contentframe, contenttd, ctrl,privacyType,selCtrl,selType){
if(typeof(selCtrl)!='undefined'){
document.getElementById(ctrl).value=privacyType;
var selPrivacy=document.getElementById(selCtrl);
for(var iCount=0;iCount<selPrivacy.options.length;iCount++){
    if(selPrivacy[iCount].value==selType){            
        selPrivacy[iCount].selected=true;
}}}
if(_isIE && ge('topframe')==null){
var iframe = document.createElement("iframe");
iframe.id = "topframe";
iframe.style.position="absolute";
iframe.frameBorder='2';
iframe.src ="javascript:'<html></html>';"
iframe.style.border="none";
iframe.scrolling="no";
document.body.appendChild(iframe);}
_contentframe = contentframe;
_contenttd = contenttd;
if(ge('dvLoad')==null){
_loadingDiv = document.createElement("div");
_loadingDiv.id = 'dvLoad';
_loadingDiv.style.visibility="hidden";
_loadingDiv.style.position="absolute";
_loadingDiv.style.height="75px";
_loadingDiv.style.zIndex="10";
_loadingDiv.style.width="380px";
document.body.appendChild(_loadingDiv);}

_mainDiv = mainDiv;
_timeToExpire = timeToExpire;
var divElement=_loadingDiv;
if(_mainDiv.style.visibility=="visible")
return false;
else{
if(divElement!=null){
divElement.innerHTML='<table id="pop_dialog_table" class="pop_dialog_table">'+'<tr><td class="pop_topleft"></td><td class="pop_border"></td><td class="pop_topright"></td></tr>'+'<tr><td class="pop_border"></td><td class="pop_content_header" id="pop_content">'+ msgToShow +'</td><td class="pop_border"></td></tr>'+'<tr><td class="pop_bottomleft"></td><td class="pop_border"></td><td class="pop_bottomright"></td></tr>'+'</table>';
divElement.style.left=Math.round((document.body.clientWidth-divElement.offsetWidth)/2)+"px";
var top=100;
try
{
var elementHeight;
var topPos=document.body.scrollTop;
if(typeof window.innerWidth!="undefined")
{
    elementHeight=window.innerHeight;
    if(topPos==0&&document.documentElement.scrollTop!="undefined"&&document.documentElement.scrollTop!=0)
    {
        topPos=document.documentElement.scrollTop;
    }
}
else
{
    if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientHeight!="undefined"&&document.documentElement.clientHeight!=0)
    {
	    elementHeight=document.documentElement.clientHeight;
	    if(topPos==0)
	    {
		    topPos=document.documentElement.scrollTop;
	    }
    }
    else
    {
	    elementHeight=document.getElementsByTagName("body")[0].clientHeight;
    }
}
top=Math.round(((elementHeight-divElement.offsetHeight)/3)+topPos-0);
_top = top;
}
catch(ignored){}

divElement.style.top=top+"px";
if(_isIE)
{
    document.getElementById("topframe").style.top=divElement.style.top;
    document.getElementById("topframe").style.left=divElement.style.left;
    document.getElementById("topframe").style.height=divElement.style.height;
    document.getElementById("topframe").style.width=divElement.style.width;
    document.getElementById("topframe").style.visibility = "visible";
}
divElement.style.visibility="visible";
setTimeout("showMainDiv(0,_mainDiv)",_timeToExpire);
}}return false;}
function showMainDiv(timeToExpire, divTag){
_mainDiv = divTag;
_timeToExpire = timeToExpire;
var divElement=_mainDiv;
if(divElement!=null){
var top=200;
divElement.style.left=_loadingDiv.style.left;
divElement.style.top=_loadingDiv.style.top;
divElement.style.width=_loadingDiv.style.width;
_loadingDiv.style.visibility="hidden";
if(_isIE){
document.getElementById("topframe").style.visibility = 'hidden';
document.getElementById(_contentframe).style.top=divElement.style.top;
document.getElementById(_contentframe).style.left=divElement.style.left;
document.getElementById(_contentframe).style.height=getElementHeight(_contenttd) + 20;
document.getElementById(_contentframe).style.width=getElementWidth(_contenttd);
document.getElementById(_contentframe).style.visibility = 'visible';}
divElement.style.visibility="visible";}}
function HideLayer(_div, _frame){
_div.style.visibility="hidden";
_frame.style.visibility="hidden";
return false;}
function getElement(objid){return document.getElementById(objid);}
function ge(objid){return document.getElementById(objid);}