var wait = []; var wait_count = []; function waiting(myCondition,myFunction,myDelay,uniqueId,maxLoop) { if (uniqueId == "undefined") uniqueId=1; var fnKey = myFunction + uniqueId; if (myCondition)
{if (!wait[fnKey])
{wait[fnKey] = setInterval(myFunction,myDelay); wait_count[fnKey] = 1;}
window.status=myFunction + ":" + wait_count[fnKey]; wait_count[fnKey] ++; if (maxLoop !="undefined" && wait_count[fnKey] > maxLoop)
{window.clearInterval(wait[fnKey]); wait_count[fnKey] = null; wait[fnKey]=null; window.status=myFunction + ":timeout!"}
return true;}
else
{if (wait[fnKey])
{window.clearInterval(wait[fnKey]); wait_count[fnKey] = null; wait[fnKey]=null}
window.status=myFunction + ":complete!"; return false;}
}
function form_submit(aform,abutton) { if (validate_form(aform))
{if (aform.form_randomid) aform.form_randomid.value = Math.random(1); if (abutton) {return true}
else {aform.submit()}
}
else return false
}
function Is() { agent = navigator.userAgent.toLowerCase(); this.major = parseInt(navigator.appVersion); this.minor = parseFloat(navigator.appVersion); this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1))); this.ns2 = (this.ns && (this.major == 3)); this.ns3 = (this.ns && (this.major == 3)); this.ns4b = (this.ns && (this.major == 4) && (this.minor <= 4.03)); this.ns4 = (this.ns && (this.major >= 4)); this.ns6 = (this.ns && (this.major >= 5)); this.ie = (agent.indexOf("msie") != -1); this.ie3 = (this.ie && (this.major < 4)); this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1)); this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1)); this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));}
function validate_form(aform) { var output_alert = new String(); var submititem = new Object; var field_text = new String(); var form_valid = true,fieldptr,avalid; for (fieldptr=0; fieldptr < aform.elements.length; fieldptr++)
{submititem = aform.elements[fieldptr]; avalid = validate_field(submititem); if (avalid == false)
{ if (submititem.validation_text > "") {field_text += (submititem.validation_text + "\n")}
form_valid=false;}
}
if (!form_valid)
{ alert(error_text + "\n\n" + field_text);}
return form_valid;}
function setError(item,astate) { if (document.images[item.name + "_image"])
{var animage=document.images[item.name + "_image"]
if (astate == true || astate == 1)
animage.src = top.presto_web_path + 'presto_pub/images/exclaim.gif'; else if (animage.src.indexOf('spacer.gif')==-1)
animage.src = top.presto_web_path + 'presto_pub/images/spacer.gif';}
else {alert("Presto error: unable to find image for field:" + item.name);}
item.valid = (astate == true || astate == 1 ? false : true); return item.valid;}
function setRequired(item,astate) { if (item)
{item.required = astate; if (astate == true || astate==1)
document.images[item.name + "_image"].src = top.presto_web_path + 'presto_pub/images/asterisk.gif'
else
document.images[item.name + "_image"].src = top.presto_web_path + 'presto_pub/images/spacer.gif'
}
return true;}
function codes(e) { if (Is.ns) return e.which; else return e.keyCode;}
function ltrim(item) {item.value = item.value.replace(/^ +/,"")}
function textarea_length(item,maximum) { if (item.value.length > maximum)
{alert("WARNING:" + maximum + " character maximum for this field."); item.value = item.value.substring(0,maximum)
}
}
var helpWindow = null; function display_help(awindow,item,help_html) { var browseWidth, browseHeight, browseLeft, browseTop; browseWidth=300; if (document.all){ browseLeft=awindow.screenLeft; browseTop=awindow.screenTop;}
else { browseLeft = awindow.screenX + (awindow.outerWidth-awindow.innerWidth) -awindow.pageXOffset; browseTop = awindow.screenY + (awindow.outerHeight-24-awindow.innerHeight) -awindow.pageYOffset;}
leftcoord = getAbsX(item) - browseWidth + browseLeft; topcoord = getAbsY(item) - 35 + browseTop; if (awindow.document.all)
{ leftcoord=leftcoord - awindow.document.body.scrollLeft; topcoord=topcoord - awindow.document.body.scrollTop;}
if (!helpWindow || !helpWindow.open || helpWindow.closed)
helpWindow = window.open("","presto_help", "location=no,menubar=no,status=no,toolbar=no,resizable=yes,alwaysRaised=yes,dependent=yes,titlebar=no,scrollbars=1,width="+browseWidth+",height=100,top="+topcoord+",screenY="+topcoord+",left="+leftcoord+",screenX="+leftcoord)
helpWindow.blur(); help_html=help_html.replace(/\\\*/g,'"'); help_html='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head><title>Presto Help</title>\n<link rel="stylesheet" href="'+awindow.top.presto_web_path+'styles.css" type="text/css" /></head>\n<body style="padding:0px;border:0px"><img src="'+awindow.top.presto_web_path+'presto_pub/images/close.gif" onmouseover="window.close()" style="margin-bottom:3px" align="right"><br /><div class="help_text" id="help_div">' + help_html + '</div></body></html>'; if (document.all) { helpWindow.document.clear(); helpWindow.document.innerHTML = "";}
helpWindow.document.open(); helpWindow.document.write(help_html); helpWindow.document.close(); if (document.all){ browseHeight=helpWindow.document.body.clientHeight+90;}
else { browseHeight=300;}
if (browseHeight > 500) browseHeight=500; if (browseHeight < 100) browseHeight=100; if ((leftcoord+browseWidth) > screen.availWidth)
leftcoord=screen.availWidth-browseWidth; if ((topcoord+browseHeight) > screen.availHeight) topcoord=screen.availHeight-browseHeight; helpWindow.resizeTo(browseWidth, browseHeight); helpWindow.moveTo(leftcoord,topcoord); helpWindow.focus();}
function hover_help(awindow,item,state,hide_fields,offsetX,offsetY) { helpDiv = awindow.document.getElementById(item.id + "_div"); if (state) { if (offsetX > 0) { helpDiv.style.left = getAbsX(item) + offsetX + "px";}
if (offsetY > 0) { helpDiv.style.top = getAbsY(item) + offsetY + "px";}
helpDiv.style.visibility="visible";}
else helpDiv.style.visibility="hidden";}
function getAbsX(item) { return (item.x) ? item.x : getAbsPos(item,"Left");}
function getAbsY(item) { return (item.y) ? item.y : getAbsPos(item,"Top");}
function getAbsPos(item,which) { iPos = 0; while (item != null) { iPos += item["offset" + which]; item = item.offsetParent;}
return iPos;}


var _RETURN_AS_TEXT = 1; var _RETURN_AS_DOM = 0; var _POST = 0; var _GET = 1; var _REPLACE_AS_DOM = 0; var _REPLACE_AS_HTML = 1; var _CACHE = 0; var _NO_CACHE = 1; function DataRequestor() { var self = this; this.getXMLHTTP = function() { var xmlHTTP = null; try { xmlHTTP = new XMLHttpRequest();} catch (e) { try { xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP")
} catch(e) { var success = false; var MSXML_XMLHTTP_PROGIDS = new Array( 'Microsoft.XMLHTTP', 'MSXML2.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0' ); for (var i=0;i < MSXML_XMLHTTP_PROGIDS.length && !success; i++) { try { xmlHTTP = new ActiveXObject(MSXML_XMLHTTP_PROGIDS[i]); success = true;} catch (e) { xmlHTTP = null;}
}
}
}
self._XML_REQ = xmlHTTP; return self._XML_REQ;}
this.getURL = function(url) { if (arguments[1] == _RETURN_AS_DOM) { self.returnType = _RETURN_AS_DOM;} else { self.returnType = _RETURN_AS_TEXT;}
if (typeof self._XML_REQ.abort == "function" && self._XML_REQ.readyState!=0) { self._XML_REQ.abort();}
self._XML_REQ.onreadystatechange = self.callback; var requestType = "GET"; var getUrlString = "?"; for (var i in self.argArray[_GET]) { getUrlString += i + "=" + self.argArray[_GET][i] + "&";}
var postUrlString = ""; for (i in self.argArray[_POST]) { postUrlString += i + "=" + self.argArray[_POST][i] + "&";}
if (postUrlString != "") { requestType = "POST";}
self._XML_REQ.open(requestType, url + getUrlString, true); if (typeof self._XML_REQ.setRequestHeader == "function") { if (self.returnType == _RETURN_AS_DOM && typeof self._XML_REQ.overrideMimeType == "function") { self._XML_REQ.overrideMimeType('text/xml');}
self._XML_REQ.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
self._XML_REQ.send(postUrlString); return true;}
this.callback = function() { if (self.onLoad) { self.onload = self.onLoad;}
if (self.onProgress) { self.onprogress = self.onProgress;}
if (self.onFail) { self.onfail = self.onFail;}
if (self._XML_REQ.readyState == 4 && self._XML_REQ.status == 200) { var obj = self.getObjToReplace(); if (obj) { if (self.replaceAs == _REPLACE_AS_HTML) { if (obj.nodeName == "TEXTAREA" || obj.nodeName == "INPUT") { obj.value = self._XML_REQ.responseText;} else { obj.innerHTML = self._XML_REQ.responseText;}
} else if (self.replaceAs == _REPLACE_AS_DOM) { eval(self._XML_REQ.responseText); obj.parentNode.replaceChild(_DOM_OBJ, obj); self.setObjToReplace(_DOM_OBJ);}
}
if (self.onload) { if (self.returnType == _RETURN_AS_DOM) { self.onload(self.normalizeWhitespace(self._XML_REQ.responseXML), obj);} else { self.onload(self._XML_REQ.responseText, obj);}
}
} else if (self._XML_REQ.readyState == 3) { if (self.onprogress && !document.all) { var contentLength = 0; try { contentLength = self._XML_REQ.getResponseHeader("Content-Length");} catch (e) { contentLength = -1;}
self.onprogress(self._XML_REQ.responseText.length, contentLength);}
} else if (self._XML_REQ.readyState == 4) { if (self.onfail) { self.onfail(self._XML_REQ.status);} else { throw new Error("Data Request failed with an HTTP status of " + self._XML_REQ.status);}
}
}
this.normalizeWhitespace = function (domObj) { if (document.createTreeWalker) { var filter = { acceptNode: function(node) { if (/\S/.test(node.nodeValue)) { return NodeFilter.FILTER_SKIP;}
return NodeFilter.FILTER_ACCEPT;}
}
var treeWalker = document.createTreeWalker(domObj, NodeFilter.SHOW_TEXT, filter, true); while (treeWalker.nextNode()) { treeWalker.currentNode.parentNode.removeChild(treeWalker.currentNode); treeWalker.currentNode = domObj;}
return domObj;} else { return domObj;}
}
this.setObjToReplace = function(obj) { if (arguments[1] == _REPLACE_AS_DOM) { self.replaceAs = _REPLACE_AS_DOM;} else { self.replaceAs = _REPLACE_AS_HTML;}
if (typeof obj == "object") { self.objToReplace = obj;} else if (typeof obj == "string") { self.objToReplaceID = obj;}
}
this.getObjToReplace = function() { if (self.objToReplaceID) { self.objToReplace = document.getElementById(self.objToReplaceID); self.objToReplaceID = "";}
return self.objToReplace;}
this.addArg = function(type, name, value) { self.argArray[type][name] = escape(value);}
this.clearArgs = function() { self.argArray[_POST] = new Array(); self.argArray[_GET] = new Array();}
this.clear = function() { self.returnType = _RETURN_AS_TEXT; self.argArray = new Array(); self.objToReplace = null; self.objToReplaceID = ""; self.replaceAs = _REPLACE_AS_HTML; self.onload = null; self.onfail = null; self.onprogress = null; self.cache = new Array(); this.clearArgs();}
if (!this.getXMLHTTP()) { throw new Error("Could not load XMLHttpRequest object");}
this.clear();}

