
var glassElement=getElement("glassPane");var loadingElement=getElement("loadingGraphic");var ajaxRequestCounter=0;var thisAjaxRequestArray=null;var thisCompletedCallback=null;var thisStatusWindowTitle=null;function setAjaxUrl(elementName,serverUrl,onDownloadStart,onDownloadEnd)
{if(serverUrl.match("\\?"))
{serverUrl=serverUrl+"&opid="+new Date().getTime();}
else
{serverUrl=serverUrl+"?opid="+new Date().getTime();}
if(getElement(elementName))
{var xmlHttpResponseElement=getElement(elementName);xmlHttpResponseElement.innerHTML="";showElement(xmlHttpResponseElement.id);submitXmlHttpRequest(serverUrl,xmlHttpResponseElement,onDownloadStart,onDownloadEnd);}}
function setAjaxPostUrl(elementName,serverUrl,postParameterArray,onDownloadStart,onDownloadEnd)
{var postParameters="opid="+new Date().getTime();for(var ctr=0;ctr<postParameterArray.length;ctr++)
{var thisParam=postParameterArray[ctr];postParameters+="&"+thisParam[0]+"="+thisParam[1];}
if(getElement(elementName))
{var xmlHttpResponseElement=getElement(elementName);xmlHttpResponseElement.innerHTML="";showElement(xmlHttpResponseElement.id);submitXmlHttpPostRequest(serverUrl,postParameters,xmlHttpResponseElement,onDownloadStart,onDownloadEnd);}}
function submitXmlHttpRequest(serverUrl,xmlHttpResponseElement,onDownloadStart,onDownloadEnd)
{var xmlhttp;xmlhttp=null;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else if(window.ActiveXObject)
{xmlhttp=new ActiveXObject("MSXML2.XMLHTTP.3.0");}
if(xmlhttp!=null)
{xmlhttp.open("GET",serverUrl,true);xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{if(xmlhttp.status==200)
{if(xmlHttpResponseElement!=null)
{xmlHttpResponseElement.innerHTML=xmlhttp.responseText;if((onDownloadEnd!=false)&(onDownloadEnd!="")&(onDownloadEnd!=null))
{eval(onDownloadEnd);}}
else
{}}}
else if(xmlhttp.readyState==1)
{if((onDownloadStart!=false)&(onDownloadStart!="")&(onDownloadStart!=null))
{eval(onDownloadStart);}}
else if(xmlhttp.readyState==2)
{}
else if(xmlhttp.readyState==3)
{}};xmlhttp.send(null);}
else
{alert("Your browser does not support XMLHTTP.");}}
function submitXmlHttpPostRequest(serverUrl,postParameters,xmlHttpResponseElement,onDownloadStart,onDownloadEnd)
{var xmlhttp;xmlhttp=null;if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();}
else if(window.ActiveXObject)
{xmlhttp=new ActiveXObject("MSXML2.XMLHTTP.3.0");}
if(xmlhttp!=null)
{xmlhttp.open("POST",serverUrl,true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",postParameters.length);xmlhttp.setRequestHeader("Connection","close");xmlhttp.onreadystatechange=function()
{if(xmlhttp.readyState==4)
{if(xmlhttp.status==200)
{if(xmlHttpResponseElement!=null)
{xmlHttpResponseElement.innerHTML=xmlhttp.responseText;if((onDownloadEnd!=false)&(onDownloadEnd!="")&(onDownloadEnd!=null))
{eval(onDownloadEnd);}}
else
{}}}
else if(xmlhttp.readyState==1)
{if((onDownloadStart!=false)&(onDownloadStart!="")&(onDownloadStart!=null))
{eval(onDownloadStart);}}
else if(xmlhttp.readyState==2)
{}
else if(xmlhttp.readyState==3)
{}};xmlhttp.send(postParameters);}
else
{alert("Your browser does not support XMLHTTP.");}}
function executeAjaxRequests(ajaxRequestArray,completedCallback,showStatusWindow,statusWindowTitle)
{thisAjaxRequestArray=ajaxRequestArray;thisCompletedCallback=completedCallback;thisStatusWindowTitle=statusWindowTitle;if((ajaxRequestArray.length>0)&(ajaxRequestCounter<ajaxRequestArray.length))
{var requestArray=ajaxRequestArray[ajaxRequestCounter];var requestContainer=requestArray[0];var requestUrl=requestArray[1];var requestPreCallAction=requestArray[2];var callbackFunction=requestArray[3];var requestStatusMessage=requestArray[4];ajaxRequestCounter++;if(callbackFunction!=false)
{if(callbackFunction.indexOf(";")==-1)
{callbackFunction+=";";}
callbackFunction+=" executeAjaxRequests(thisAjaxRequestArray, thisCompletedCallback, thisStatusWindowTitle);";}
else
{callbackFunction="executeAjaxRequests(thisAjaxRequestArray, thisCompletedCallback, thisStatusWindowTitle);";}
if(showStatusWindow)
{loadingBarPopup("<table width=\"360\"><tr><td style=\"margin-right: 15px\"><b>"+statusWindowTitle+":</b></td><td>"+requestStatusMessage+" ("+ajaxRequestCounter+" of "+ajaxRequestArray.length+")</td></tr></table>");}
setAjaxUrl(requestContainer,requestUrl,requestPreCallAction,callbackFunction);}
else
{if(completedCallback)
{eval(completedCallback);}
ajaxRequestCounter=0;}}
function setLoadingPosition()
{var posX;posX=(getWindowWidth()/2);if(IE)
{loadingElement.style.left=posX-75;loadingElement.style.top=((getWindowHeight()-75)/2)+getPageYOffset();}
else
{loadingElement.style.left=(posX-75)+"px";loadingElement.style.top=((getWindowHeight()-75)/2)+getPageYOffset()+"px";}}
function showLoadingGraphic()
{loadingElement.style.display="block";loadingElement.innerHTML="<div style=\"border: solid 1px #666666; background-color: #FFFFFF; padding: 10px; width: 150px;\" align=\"\center\"><img src=\"/images/loadingGraphic1.gif\"></div>";setLoadingPosition();}
function setLoadingGraphic(elementId)
{if(elementId!="")
{var element=getElement(elementId);var tableHeight=(.75*getHeight(element));if(tableHeight<50)
{tableHeight=50;}
element.innerHTML="<table width=\""+getWidth(element)+"\" height=\""+tableHeight+"\"><tr valign=\"center\"><td align=\"center\"><img src=\"https://www.blueriverdigital.com/images/loadingGraphic1.gif\"></td></tr></table>";}}
function setCustomLoadingGraphic(elementId,loadingImage)
{if(elementId!="")
{var element=getElement(elementId);element.innerHTML="<table width=\""+getWidth(element)+"\" height=\""+(.75*getHeight(element))+"\"><tr valign=\"center\"><td align=\"center\"><img src=\""+loadingImage+"\"></td></tr></table>";}}
function hideLoadingGraphic()
{loadingElement.style.display="none";loadingElement.innerHTML="";setLoadingPosition();}
