if("function"!=typeof Object.extend)
Object.extend=function(dst,src)
{for(var propName in src)
if("undefined"==typeof dst[propName])
dst[propName]=src[propName];};Object.extend(Array.prototype,{indexOf:function(val)
{for(var idxArr=this.length-1;idxArr>=0;idxArr--)
if(val==this[idxArr])
return idxArr;return-1;},remove:function(val)
{for(var idx=this.length-1;idx>=0;idx--)
if(val==this[idx])
{this.removeAt(idx);}},removeAt:function(idx)
{this.splice(idx,1);},binarySearch:function(val,fnCompare)
{var low=0;var high=this.length-1;if(!fnCompare)
fnCompare=this._defaultComparison;var mid=-1;while(low<=high)
{mid=Math.floor((low+high)/2);var midVal=this[mid];var comparison=fnCompare(midVal,val);if(0<comparison)
high=mid-1;else if(0>comparison)
low=mid+1;else
return mid;}
return~mid;},_defaultComparison:function(a,b)
{if(a<b)
return-1;else if(a>b)
return 1;else
return 0;}});Object.extend(Array,{copy:function(src,dst)
{dst=src.slice(0);}});Object.extend(Date.prototype,{toLocal:function()
{var offset=this.getTimezoneOffset();var ret=new Date(this.toString());ret.setMinutes(ret.getMinutes()-offset);return ret;},toISOString:function()
{var offset=this.getTimezoneOffset();return this.getFullYear()+"-"
+("0"+(this.getMonth()+1)).slice(-2)+"-"
+("0"+this.getDate()).slice(-2)+"T"
+("0"+this.getHours()).slice(-2)+":"
+("0"+this.getMinutes()).slice(-2)+":"
+("0"+this.getSeconds()).slice(-2)+"."
+("00"+this.getMilliseconds()).slice(-3)
+(offset>=0?"-":"+")
+("0"+Math.floor(offset/60)).slice(-2)+":"
+("0"+offset%60).slice(-2);},toShortTimeString:function()
{var hours=this.getHours();var isPm=(hours/12>0);hours%=12;if(0==hours)
hours=12;return hours+":"+("0"+this.getMinutes()).slice(-2)+(isPm?" pm":" am");},toNewTimezone:function(newUtcOffset)
{var newTime=this.toUTC();newTime.setHours(newTime.getHours()+newUtcOffset);return newTime;},toUTC:function()
{return new Date(this.getTime()+(60000*this.getTimezoneOffset()));},copy:function()
{return new Date(this.valueOf());}});Object.extend(String.prototype,{trim:function()
{return this.replace(/(?:^\s*|\s*$)/g,"");},endsWith:function(toFind)
{var idx=this.lastIndexOf(toFind);return(idx==this.length-toFind.length);},compareTo:function(b)
{if(this==b)
return 0;else if(this<b)
return-1;else
return 1;},containsClass:function(className)
{var re=new RegExp("(?:^| )"+className+"(?: |$)");return re.test(this);},replaceClass:function(cn,rv)
{var ss=this.split(' ');for(var idxSS=ss.length-1;idxSS>=0;idxSS--)
if(cn==ss[idxSS])
{if(rv)
ss[idxSS]=rv;else
ss.removeAt(idxSS);break;}
return ss.join(' ');}});Object.extend(Math,{rad:function(deg)
{return(deg*this.PI)/180;},deg:function(rad)
{return(rad*180)/this.PI;}});function BrowserDetectionFn()
{if("undefined"==typeof BrowserDetectionFn._initialized)
{BrowserDetectionFn.prototype.compareVersions=function(sVersion1,sVersion2)
{var arrVersion1=sVersion1.split(".");var arrVersion2=sVersion2.split(".");if(arrVersion1.length>arrVersion2.length)
{for(var i=0;i<arrVersion1.length-arrVersion2.length;i++)
arrVersion2.push("0");}
else if(arrVersion1.length<arrVersion2.length)
{for(var i=0;i<arrVersion2.length-arrVersion1.length;i++)
arrVersion1.push("0");}
for(var i=0;i<arrVersion1.length;i++){if(arrVersion1[i]<arrVersion2[i])
return-1;else if(arrVersion1[i]>arrVersion2[i])
return 1;}
return 0;};}
var sUserAgent=navigator.userAgent;var fAppVersion=parseFloat(navigator.appVersion);this.isOpera=(sUserAgent.indexOf("Opera")>-1);this.isMinOpera4=this.isMinOpera5=this.isMinOpera6=this.isMinOpera7=this.isMinOpera7_5=false;if(this.isOpera){var fOperaVersion;if(navigator.appName=="Opera"){fOperaVersion=fAppVersion;}else{var reOperaVersion=new RegExp("Opera (\\d+\\.\\d+)");reOperaVersion.test(sUserAgent);fOperaVersion=parseFloat(RegExp["$1"]);}
this.isMinOpera4=fOperaVersion>=4;this.isMinOpera5=fOperaVersion>=5;this.isMinOpera6=fOperaVersion>=6;this.isMinOpera7=fOperaVersion>=7;this.isMinOpera7_5=fOperaVersion>=7.5;}
this.isKHTML=(-1<sUserAgent.indexOf("KHTML")||-1<sUserAgent.indexOf("Konqueror")||-1<sUserAgent.indexOf("AppleWebKit"));this.isMinSafari1=this.isMinSafari1_2=false;this.isMinKonq2_2=this.isMinKonq3=this.isMinKonq3_1=this.isMinKonq3_2=false;if(this.isKHTML){this.isSafari=(sUserAgent.indexOf("AppleWebKit")>-1);this.isKonq=(sUserAgent.indexOf("Konqueror")>-1);if(this.isSafari){var reAppleWebKit=new RegExp("AppleWebKit\\/(\\d+(?:\\.\\d*)?)");reAppleWebKit.test(sUserAgent);var fAppleWebKitVersion=parseFloat(RegExp["$1"]);this.isMinSafari1=fAppleWebKitVersion>=85;this.isMinSafari1_2=fAppleWebKitVersion>=124;}else if(this.isKonq){var reKonq=new RegExp("Konqueror\\/(\\d+(?:\\.\\d+(?:\\.\\d)?)?)");reKonq.test(sUserAgent);this.isMinKonq2_2=this.compareVersions(RegExp["$1"],"2.2")>=0;this.isMinKonq3=this.compareVersions(RegExp["$1"],"3.0")>=0;this.isMinKonq3_1=this.compareVersions(RegExp["$1"],"3.1")>=0;this.isMinKonq3_2=this.compareVersions(RegExp["$1"],"3.2")>=0;}}
this.isIE=(sUserAgent.indexOf("compatible")>-1&&sUserAgent.indexOf("MSIE")>-1&&!this.isOpera);this.isMinIE4=this.isMinIE5=this.isMinIE5_5=this.isMinIE6=false;if(this.isIE){var reIE=new RegExp("MSIE (\\d+\\.\\d+);");reIE.test(sUserAgent);var fIEVersion=parseFloat(RegExp["$1"]);this.isMinIE4=fIEVersion>=4;this.isMinIE5=fIEVersion>=5;this.isMinIE5_5=fIEVersion>=5.5;this.isMinIE6=fIEVersion>=6;this.isMinIE7=fIEVersion>=7;this.isMaxIE6=fIEVersion<=6;}
this.isMoz=(sUserAgent.indexOf("Gecko")>-1&&!this.isKHTML);this.isMinMoz1=this.sMinMoz1_4=this.isMinMoz1_5=false;if(this.isMoz){var reMoz=new RegExp("rv:(\\d+\\.\\d+(?:\\.\\d+)?)");reMoz.test(sUserAgent);this.isMinMoz1=this.compareVersions(RegExp["$1"],"1.0")>=0;this.isMinMoz1_4=this.compareVersions(RegExp["$1"],"1.4")>=0;this.isMinMoz1_5=this.compareVersions(RegExp["$1"],"1.5")>=0;}
this.isNS4=(!this.isIE&&!this.isOpera&&!this.isMoz&&!this.isKHTML&&(sUserAgent.indexOf("Mozilla")==0)&&(navigator.appName=="Netscape")&&(fAppVersion>=4.0&&fAppVersion<5.0));this.isMinNS4=this.isMinNS4_5=this.isMinNS4_7=this.isMinNS4_8=false;if(this.isNS4){this.isMinNS4=true;this.isMinNS4_5=fAppVersion>=4.5;this.isMinNS4_7=fAppVersion>=4.7;this.isMinNS4_8=fAppVersion>=4.8;}
this.isWin=(navigator.platform=="Win32")||(navigator.platform=="Windows");this.isMac=(navigator.platform=="Mac68K")||(navigator.platform=="MacPPC")||(navigator.platform=="Macintosh");this.isUnix=((navigator.platform=="X11")&&!this.isWin&&!this.isMac);this.isWin95=this.isWin98=this.isWinNT4=this.isWin2K=this.isWinME=this.isWinXP=false;this.isMac68K=this.isMacPPC=false;this.isSunOS=this.isMinSunOS4=this.isMinSunOS5=this.isMinSunOS5_5=false;if(this.isWin){this.isWin95=(sUserAgent.indexOf("Win95")>-1||sUserAgent.indexOf("Windows 95")>-1);this.isWin98=(sUserAgent.indexOf("Win98")>-1||sUserAgent.indexOf("Windows 98")>-1);this.isWinME=(sUserAgent.indexOf("Win 9x 4.90")>-1||sUserAgent.indexOf("Windows ME")>-1);this.isWin2K=(sUserAgent.indexOf("Windows NT 5.0")>-1||sUserAgent.indexOf("Windows 2000")>-1);this.isWinXP=(sUserAgent.indexOf("Windows NT 5.1")>-1||sUserAgent.indexOf("Windows XP")>-1);this.isWinNT4=(sUserAgent.indexOf("WinNT")>-1||sUserAgent.indexOf("Windows NT")>-1||sUserAgent.indexOf("WinNT4.0")>-1||sUserAgent.indexOf("Windows NT 4.0")>-1&&(!this.isWinME&&!this.isWin2K&&!this.isWinXP));}
if(this.isMac){this.isMac68K=(sUserAgent.indexOf("Mac_68000")>-1||sUserAgent.indexOf("68K")>-1);this.isMacPPC=(sUserAgent.indexOf("Mac_PowerPC")>-1||sUserAgent.indexOf("PPC")>-1);}
if(this.isUnix){this.isSunOS=(sUserAgent.indexOf("SunOS")>-1);if(this.isSunOS){var reSunOS=new RegExp("SunOS (\\d+\\.\\d+(?:\\.\\d+)?)");reSunOS.test(sUserAgent);this.isMinSunOS4=this.compareVersions(RegExp["$1"],"4.0")>=0;this.isMinSunOS5=this.compareVersions(RegExp["$1"],"5.0")>=0;this.isMinSunOS5_5=this.compareVersions(RegExp["$1"],"5.5")>=0;}}}
var BrowserDetection=new BrowserDetectionFn();function Delegate(fn,fnThis)
{this._fn=fn;this._t=fnThis;}
Delegate.prototype={call:function()
{if(!this._fn)return false;return this._fn.apply(this._t,Array.prototype.slice.apply(arguments,[0]));}};function Event(node)
{if("undefined"==typeof node)
node=null;this._head=node;}
Object.extend(Event.prototype,{addEventListener:function(func,This)
{if(null==func)
return;this._addNode(new this._functionNode(func,This));},removeEventListener:function(func,This)
{if(null==func)
return;this._removeNode(new this._functionNode(func,This));},addChainedEvent:function(evt)
{this._addNode(new this._evtNode(evt));},removeChainedEvent:function(evt)
{this._removeNode(new this._evtNode(evt));},dispatchEvent:function(args)
{if(!args)
args=[];var nodes=[];var node=this._head;while(!this._isTail(node))
{nodes.push(node);node=this._moveNext(node);};var retVals=[];var lenNodes=nodes.length;for(var idxNodes=0;idxNodes<lenNodes;idxNodes++)
retVals=retVals.concat(nodes[idxNodes].dispatch(args));return retVals;},_addNode:function(node)
{node.next=this._head;this._head=node;},_removeNode:function(nodeToRemove)
{var prevNode=null;var node=this._head;while(!this._isTail(node))
{if(node.fn==nodeToRemove.fn&&node.This==nodeToRemove.This)
{if(prevNode==null)
this._head=node.next;else
prevNode.next=node.next;}
prevNode=node;node=this._moveNext(node);};},_moveNext:function(node)
{return node.next;},_isTail:function(node)
{return(null==node);},_isEmpty:function()
{return(null==this._head);},_length:function()
{var length=0;var node=this._head;while(!this._isTail(node))
{length++;node=this._moveNext(node);}
return length;},_functionNode:function(fn,This)
{this.fn=fn;this.This=This;this.next=null;},_evtNode:function(evt)
{this.evt=evt;this.next=null;}});Event.prototype._functionNode.prototype={dispatch:function(args)
{return[this.fn.apply(this.This,args)];}}
Event.prototype._evtNode.prototype={dispatch:function(args)
{return this.evt.dispatchEvent(args);}}
Object.extend(Event,{_prefix:"_evt-",addEventsToObject:function(obj,events)
{for(var idxEvents=events.length-1;idxEvents>=0;idxEvents--)
{obj[Event._prefix+events[idxEvents]]=null;}
obj.addEventListener=this._addEventListener;obj.removeEventListener=this._removeEventListener;obj.dispatchEvent=this._dispatchEvent;},chainEvents:function(dstObj,dstEvtName,srcObj,srvEvtName)
{var srcEvt;if(null==(srcEvt=srcObj[Event._prefix+srvEvtName]))
srcEvt=srcObj[Event._prefix+srvEvtName]=new Event();var dstEvt;if(null==(dstEvt=dstObj[Event._prefix+dstEvtName]))
dstEvt=dstObj[Event._prefix+dstEvtName]=new Event();dstEvt.addChainedEvent(srcEvt);},_addEventListener:function(evtName,func,This)
{var evt;if(null==(evt=this[Event._prefix+evtName]))
evt=this[Event._prefix+evtName]=new Event();evt.addEventListener(func,This);},_removeEventListener:function(evtName,func,This)
{var evt;if(null!=(evt=this[Event._prefix+evtName]))
evt.removeEventListener(func,This);},_dispatchEvent:function(evtName)
{var evt;var retVals=null;if(null!=(evt=this[Event._prefix+evtName]))
{var args=Array.prototype.slice.apply(arguments,[1]);retVals=evt.dispatchEvent(args);}
else
retVals=[];retVals.isAllTrue=Event._isAllTrue;return retVals;},_isAllTrue:function()
{var retVal=true;for(var idxThis=this.length-1;idxThis>=0;idxThis--)
retVal&=("undefined"==typeof this[idxThis]||this[idxThis]);return retVal;},addDomEventListener:function(domObj,evtName,fn,This)
{var evt;if(!(evt=domObj[Event._prefix+evtName]))
evt=domObj[this._prefix+evtName]=new Event();evt.addEventListener(fn,This);if(1==evt._length())
this._xbAddEventListener(domObj,evtName,this._getFnFromFactory(evtName));},removeDomEventListener:function(domObj,evtName,fn,This)
{var evt;if(evt=domObj[Event._prefix+evtName])
{evt.removeEventListener(fn,This);if(evt._isEmpty())
this._xbRemoveEventListener(domObj,evtName,this._getFnFromFactory(evtName));}},_getFnFromFactory:function(evtName)
{var fn;if(null==(fn=this._getFnFromFactory[evtName]))
{fn=new Function("var evt=Event._xbGetEvent();Event._callEventFromDomEvent(evt,'"+evtName+"')");this._getFnFromFactory[evtName]=fn;}
return fn;},_callEventFromDomEvent:function(evt,evtName)
{evtName=Event._prefix+evtName;var evtInst;if(evtName.endsWith("scroll")||evtName.endsWith("load"))
{evtInst=this._getInstFromTree(window,evtName);}
else
{var srcs=[evt.explicitOriginalTarget,evt.target,evt.currentTarget];for(var idxSrcs=srcs.length-1;idxSrcs>=0;idxSrcs--)
if(srcs[idxSrcs])
{evtInst=this._getInstFromTree(srcs[idxSrcs],evtName);if(evtInst)
break;}}
if(!evtInst)
return;var retVals=evtInst.dispatchEvent([evt]);if(!retVals||0==retVals.length)
return;else
return retVals[retVals.length-1];},_getInstFromTree:function(e,n)
{var r;do
r=e[n];while(!r&&null!=(e=e.parentNode));return r;},_xbAddEventListener:function(oTarget,sEventType,fnHandler){if(oTarget.addEventListener){oTarget.addEventListener(sEventType,fnHandler,false);}else if(oTarget.attachEvent){oTarget.attachEvent("on"+sEventType,fnHandler);}else{oTarget["on"+sEventType]=fnHandler;}},_xbAddDomContentLoadedEvent:function(fnHandler)
{if(document.addEventListener){document.addEventListener("DOMContentLoaded",fnHandler,false);}
/*@cc_on@*/
/*@if(@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");var script=document.getElementById("__ie_onload");script.onreadystatechange=function(){if(this.readyState=="complete"){fnHandler();}};@end@*/
if(/WebKit/i.test(navigator.userAgent)){this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){fnHandler();}},10);}
window.onload=fnHandler;},_xbRemoveEventListener:function(oTarget,sEventType,fnHandler){if(oTarget.removeEventListener){oTarget.removeEventListener(sEventType,fnHandler,false);}else if(oTarget.detachEvent){oTarget.detachEvent("on"+sEventType,fnHandler);}else{oTarget["on"+sEventType]=null;}},_ieFormatEvent:function(oEvent)
{if(BrowserDetection.isIE&&BrowserDetection.isWin)
{oEvent.charCode=(oEvent.type=="keypress")?oEvent.keyCode:0;oEvent.eventPhase=2;oEvent.isChar=(oEvent.charCode>0);oEvent.pageX=oEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;oEvent.pageY=oEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop;oEvent.preventDefault=function()
{this.returnValue=false;};if(oEvent.type=="mouseout")
oEvent.relatedTarget=oEvent.toElement;else if(oEvent.type=="mouseover")
oEvent.relatedTarget=oEvent.fromElement;oEvent.stopPropagation=function()
{this.cancelBubble=true;};oEvent.target=oEvent.srcElement;oEvent.currentTarget=oEvent.target;oEvent.time=(new Date).getTime();}
return oEvent;},_xbGetEvent:function(){if(window.event){return this._ieFormatEvent(window.event);}else{return this._xbGetEvent.caller.arguments[0];}}});var FormUtil={selectSelectOption:function(select,optionValue)
{for(var idxOptions=select.childNodes.length-1;idxOptions>=0;idxOptions--)
{var option=select.childNodes[idxOptions];if(option.value==optionValue)
{option.selected=true;}}},hideSelect:function(select)
{if("undefined"==typeof select._refCount)
select._refCount=0;if(1==++select._refCount)
select.style.visibility='hidden';},showSelect:function(select)
{if(0>=--select._refCount)
select.style.visibility='visible';},checkFirstRadioIfNoneChecked:function(radioContainer,name)
{var radios=radioContainer.getElementsByTagName("input");var firstRadio,checkedFound=false;for(var idxRadios=0,length=radios.length;idxRadios<length;idxRadios++)
{var radio=radios[idxRadios];if(DataType.isParam(name)&&name!=radio.name)
continue;if("radio"==radio.type&&!radio.disabled&&!firstRadio)
firstRadio=radio;checkedFound|=(radio.checked&&!radio.disabled);}
if(!checkedFound&&firstRadio)
firstRadio.checked=true;return!checkedFound;}};var TextUtil={isNotMax:function(oTextArea){return oTextArea.value.length<=oTextArea.getAttribute("maxlength");},preventOverMax:function()
{var evt=Event._xbGetEvent();var elem=evt.currentTarget;var maxLength=parseInt(elem.getAttribute("maxlength"));if(isNaN(maxLength))
return;var currLength=elem.value.length;if("key"==evt.type.slice(0,3))
currLength++;if(currLength>maxLength)
{evt.preventDefault();alert("You may not enter more than "+elem.getAttribute("maxlength")+" characters.");}},clickOnEnter:function()
{var evt=Event._xbGetEvent();var toClick=evt.currentTarget.elemToClick;if((13==evt.charCode||13==evt.keyCode)&&DataType.isObject(toClick)&&DataType.isFunction(toClick.click))
{toClick.click();evt.preventDefault();return false;}
return true;},blockChars:function(oTextbox,oEvent,bBlockPaste)
{oEvent=Event._ieFormatEvent(oEvent);var sInvalidChars=oTextbox.getAttribute("invalidchars");var sChar=String.fromCharCode(oEvent.charCode);var bIsValidChar=sInvalidChars.indexOf(sChar)==-1;if(bBlockPaste){return bIsValidChar&&!(oEvent.ctrlKey&&sChar=="v");}else{return bIsValidChar||oEvent.ctrlKey;}},allowChars:function(oTextbox,oEvent,bBlockPaste){oEvent=Event._ieFormatEvent(oEvent);var sValidChars=oTextbox.getAttribute("validchars");var sChar=String.fromCharCode(oEvent.charCode);var bIsValidChar=sValidChars.indexOf(sChar)>-1;if(bBlockPaste){return bIsValidChar&&!(oEvent.ctrlKey&&sChar=="v");}else{return bIsValidChar||0==oEvent.charCode||oEvent.ctrlKey;}},blurBlock:function(oTextbox){var sInvalidChars=oTextbox.getAttribute("invalidchars");var arrInvalidChars=sInvalidChars.split("");for(var i=0;i<arrInvalidChars.length;i++){if(oTextbox.value.indexOf(arrInvalidChars[i])>-1){alert("Character '"+arrInvalidChars[i]+"' not allowed.");oTextbox.focus();oTextbox.select();return;}}},blurBlock2:function(oTxt)
{var exp=oTxt.getAttribute("validationexpression");var regEx=new RegExp(exp);if(!regEx.test(oTxt.value))
{var errormessage=oTxt.getAttribute("errormessage");if(errormessage&&""!=errormessage)
alert(errormessage);oTxt.focus();return false;}
return true;},blurAllow:function(oTextbox){var sValidChars=oTextbox.getAttribute("validchars");var arrTextChars=oTextbox.value.split("");for(var i=0;i<arrTextChars.length;i++){if(sValidChars.indexOf(arrTextChars[i])==-1){alert("Character '"+arrTextChars[i]+"' not allowed.");oTextbox.focus();oTextbox.select();return;}}},numericScroll:function(oTextbox,evt){evt=Event._ieFormatEvent(evt);var iValue=oTextbox.value.length==0?0:parseInt(oTextbox.value);var iMax=oTextbox.getAttribute("max");var iMin=oTextbox.getAttribute("min");if(evt.keyCode==38||38==evt.charCode){if(iMax==null||iValue<iMax){oTextbox.value=(iValue+1);}}else if(evt.keyCode==40||40==evt.charCode){if(iMin==null||iValue>iMin){oTextbox.value=(iValue-1);}}},autosuggestMatch:function(sText,arrValues){var arrResult=new Array;if(sText!=""){for(var i=0;i<arrValues.length;i++){if(arrValues[i].indexOf(sText)==0){arrResult.push(arrValues[i]);}}}
return arrResult;},autosuggest:function(oTextbox,arrValues,sListboxId){var oListbox=document.getElementById(sListboxId);var arrMatches=this.autosuggestMatch(oTextbox.value,arrValues);ListUtil.clear(oListbox);for(var i=0;i<arrMatches.length;i++){ListUtil.add(oListbox,arrMatches[i]);}}};function XmlDom(){if(window.ActiveXObject){var arrSignatures=["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","Microsoft.XmlDom"];for(var i=0;i<arrSignatures.length;i++){try{var oXmlDom=new ActiveXObject(arrSignatures[i]);return oXmlDom;}catch(oError){}}
throw new Error("MSXML is not installed on your system.");}else if(document.implementation&&document.implementation.createDocument){var oXmlDom=document.implementation.createDocument("","",null);oXmlDom.parseError={valueOf:function(){return this.errorCode;},toString:function(){return this.errorCode.toString()}};oXmlDom._initError();oXmlDom.addEventListener("load",function(){this._checkForErrors();this._changeReadyState(4);},false);return oXmlDom;}else{throw new Error("Your browser doesn't support an XML DOM object.");}}
if(BrowserDetection.isMoz)
{Object.extend(Document.prototype,{readyState:0,onreadystatechange:null,_changeReadyState:function(iReadyState)
{this.readyState=iReadyState;if(typeof this.onreadystatechange=="function"){this.onreadystatechange();}},_initError:function()
{this.parseError.errorCode=0;this.parseError.filepos=-1;this.parseError.line=-1;this.parseError.linepos=-1;this.parseError.reason=null;this.parseError.srcText=null;this.parseError.url=null;},_checkForErrors:function()
{if(this.documentElement.tagName=="parsererror"){var reError=/>([\s\S]*?)Location:([\s\S]*?)Line Number (\d+), Column (\d+):<sourcetext>([\s\S]*?)(?:\-*\^)/;reError.test(this.xml);this.parseError.errorCode=-999999;this.parseError.reason=RegExp.$1;this.parseError.url=RegExp.$2;this.parseError.line=parseInt(RegExp.$3);this.parseError.linepos=parseInt(RegExp.$4);this.parseError.srcText=RegExp.$5;}},loadXML:function(sXml)
{this._initError();this._changeReadyState(1);var oParser=new DOMParser();var oXmlDom=oParser.parseFromString(sXml,"text/xml");while(this.firstChild){this.removeChild(this.firstChild);}
for(var i=0;i<oXmlDom.childNodes.length;i++){var oNewNode=this.importNode(oXmlDom.childNodes[i],true);this.appendChild(oNewNode);}
this._checkForErrors();this._changeReadyState(4);},_load:Document.prototype.load,load:function(sURL)
{this._initError();this._changeReadyState(1);this._load(sURL);}});Node.prototype.__defineGetter__("xml",function(){var oSerializer=new XMLSerializer();return oSerializer.serializeToString(this,"text/xml");});}
function StringBuilder(txt)
{this._sArr=[];if(DataType.isString(txt))
this.append(txt);};StringBuilder.prototype={append:function(str)
{this._sArr.push(str);return this;},toString:function()
{return this._sArr.join("");},undoLast:function()
{var arr=this._sArr;if(arr.length>0)
{arr.pop();return true;}
else
{return false;}},getLength:function()
{return this.toString().length;}};function QueryStringMap(queryPortion)
{if(!DataType.isString(queryPortion))
queryPortion=window.location.search.slice(1);if(0==queryPortion.length)
return;var params=queryPortion.split("&");for(var idxParams=params.length-1;idxParams>=0;idxParams--)
{var param=params[idxParams];if(0!=param.length)
{var nameValue=param.split('=');if(2==nameValue.length)
this[nameValue[0]]=unescape(nameValue[1]);}}}
QueryStringMap.prototype={toString:function()
{var keys=[];for(var key in this)
keys.push(key);keys.sort();var sb=new StringBuilder();var len=keys.length;for(var idxKey=0;idxKey<len;idxKey++)
{var key=keys[idxKey];if(DataType.isFunction(this[key]))
continue;sb.append("&").append(key).append("=");var val=this[key];if(DataType.isUndefined(val)||DataType.isNull(val))
val="";else if(DataType.isBoolean(val))
val=val?1:0;sb.append(encodeURIComponent(val));}
return sb.toString().slice(1);}};var bXmlHttpSupport=("undefined"!=typeof XMLHttpRequest||window.ActiveXObject);function httpPost(sURL,sParams){var oURL=new java.net.URL(sURL);var oConnection=oURL.openConnection();oConnection.setDoInput(true);oConnection.setDoOutput(true);oConnection.setUseCaches(false);oConnection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");var oOutput=new java.io.DataOutputStream(oConnection.getOutputStream());oOutput.writeBytes(sParams);oOutput.flush();oOutput.close();var sLine="",sResponseText="";var oInput=new java.io.DataInputStream(oConnection.getInputStream());sLine=oInput.readLine();while(sLine!=null){sResponseText+=sLine+"\n";sLine=oInput.readLine();}
oInput.close();return sResponseText;}
function addPostParam(sParams,sParamName,sParamValue){if(sParams.length>0){sParams+="&";}
return sParams+encodeURIComponent(sParamName)+"="
+encodeURIComponent(sParamValue);}
function addURLParam(sURL,sParamName,sParamValue){sURL+=(sURL.indexOf("?")==-1?"?":"&");sURL+=encodeURIComponent(sParamName)+"="+encodeURIComponent(sParamValue);return sURL;}
function httpGet(sURL){var sResponseText="";var oURL=new java.net.URL(sURL);var oStream=oURL.openStream();var oReader=new java.io.BufferedReader(new java.io.InputStreamReader(oStream));var sLine=oReader.readLine();while(sLine!=null){sResponseText+=sLine+"\n";sLine=oReader.readLine();}
oReader.close();return sResponseText;}
if(typeof XMLHttpRequest=="undefined"&&window.ActiveXObject){var XMLHttpRequest=function(){var arrSignatures=["MSXML2.XMLHTTP","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","Microsoft.XMLHTTP"];for(var i=0;i<arrSignatures.length;i++){try{var oRequest=new ActiveXObject(arrSignatures[i]);return oRequest;}catch(oError){}}
throw new Error("MSXML is not installed on your system.");}}
var Http={get:function(sURL,fnCallback){if(bXmlHttpSupport)
{var oRequest=new XMLHttpRequest();oRequest.open("get",sURL,true);oRequest.onreadystatechange=function()
{if(oRequest.readyState==4)
{fnCallback(oRequest.responseText);}}
oRequest.send(null);}
else if(navigator.javaEnabled()&&typeof java!="undefined"&&typeof java.net!="undefined")
{setTimeout(function()
{fnCallback(httpGet(sURL));},10);}
else
{alert("Your browser doesn't support HTTP requests.");}},post:function(sURL,sParams,fnCallback)
{if(bXmlHttpSupport){var oRequest=new XMLHttpRequest();oRequest.open("post",sURL,true);oRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");oRequest.onreadystatechange=function()
{if(oRequest.readyState==4)
{fnCallback(oRequest.responseText);}}
oRequest.send(sParams);}
else if(navigator.javaEnabled()&&typeof java!="undefined"&&typeof java.net!="undefined")
{setTimeout(function()
{fnCallback(httpPost(sURL,sParams));},10);}
else
{alert("Your browser doesn't support HTTP requests.");}},scriptGet:function(sUrl,noCache)
{var script=document.createElement("script");script.type="text/javascript";if(noCache)
sUrl+="&dt="+(new Date()).toUTCString();script.src=sUrl;document.getElementsByTagName('head')[0].appendChild(script);}};var XBrowser={childNode:function(parent,idxOfNode)
{if(!parent)
return null;var children=parent.childNodes;if(!children)
return null;var childrenLength=children.length;if(idxOfNode>=childrenLength)
return null;var idxActual=0;var idxVirtual=0;var found=false;var child=null;while(!found&&idxActual<childrenLength)
{child=children[idxActual++];if(1==child.nodeType)
{if(idxOfNode==idxVirtual)
{found=true;break;}
idxVirtual++;}}
if(!found)
return null;else
return child;},nodeByPath:function(start,arrPaths)
{var node=start;var elem;while(!DataType.isUndefined(elem=arrPaths.shift())&&null!=node)
{if(".."==elem)
node=node.parentNode;else
node=this.childNode(node,elem);}
return node;},previousSibling:function(element)
{var found=false;var prev=element;while(true)
{if(!prev||!prev.previousSibling)
break;prev=prev.previousSibling;if(1==prev.nodeType)
{found=true;break;}}
if(!found)
return null;else
return prev;},childNodeById:function(parent,id)
{if(!parent)
return null;var children=parent.childNodes;if(!children)
return null;for(var idxChildren=children.length-1;idxChildren>=0;idxChildren--)
{var childNode=children[idxChildren];if(1==childNode.nodeType&&id==childNode.id)
{return childNode;}}
return null;},getElementsByClassName:function(parent,className,tagName)
{var found=[];if(!parent)
return found;var children=(tagName?parent.getElementsByTagName(tagName):parent.childNodes);if(!children||0==children.length)
return found;var re=new RegExp("(^| )"+className+"( |$)");for(var idxChildren=children.length-1;idxChildren>=0;idxChildren--)
{var child=children[idxChildren];if(!child.className)
continue;if(re.test(child.className))
found.push(child);}
return found;},getStyle:function(oElm,strCssRule){var strValue="";if(document.defaultView&&document.defaultView.getComputedStyle)
{var style=document.defaultView.getComputedStyle(oElm,"");if(null==style)
{if("display"==strCssRule)
strValue="none";else
{oElm.style.display='block';style=document.defaultView.getComputedStyle(oElm,"");strValue=style.getPropertyValue(strCssRule);oElm.style.display='none';}}
else
strValue=style.getPropertyValue(strCssRule);}
else if(oElm.currentStyle){strCssRule=strCssRule.replace(/-(w)/g,function(strMatch,p1){return p1.toUpperCase();});strValue=oElm.currentStyle[strCssRule];}
return strValue;},processXsl:function(xml,xsl)
{var oXml=new XmlDom();var oXsl=new XmlDom();oXml.loadXML(xml);oXsl.loadXML(xsl);if(window.ActiveXObject)
{return oXml.transformNode(oXsl);}
else if(window.XSLTProcessor)
{var processor=new XSLTProcessor();processor.importStylesheet(oXsl);var result=processor.transformToDocument(oXml);return result.documentElement.childNodes[0].xml;}
else
{throw new Error(0,"Browser does not support XSLT");}},setHeight:function(elemId)
{if(BrowserDetection.isMaxIE6)
{var elem=document.getElementById(elemId);window.setTimeout(function(){elem.style.height=elem.parentNode.clientHeight+'px';},50);}}};function Point(x,y)
{if("undefined"==typeof x)
x=0;if("undefined"==typeof y)
y=0;this.x=Math.round(x);this.y=Math.round(y);};Point.prototype={toString:function()
{return"("+this.x.toString()+","+this.y.toString()+")";}};function Rectangle(pt1,pt2)
{this.pt1=pt1;this.pt2=pt2;}
Rectangle.prototype={toString:function()
{return"["+this.pt1.toString()+", "+this.pt2.toString()+"]";}};var UI={getDocumentElement:function()
{if(!document.documentElement)
return document.body;else
return document.documentElement;},getViewportHeight:function(de)
{if(window.innerHeight)
return window.innerHeight;else
return de.offsetHeight;},getViewportWidth:function(de)
{if(window.innerWidth)
return window.innerWidth;else
return de.offsetWidth;},getViewportYOffset:function(de)
{if(window.pageYOffset)
return window.pageYOffset;else
return de.scrollTop;},getViewportXOffset:function(de)
{if(window.pageXOffset)
return window.pageXOffset;else
return de.scrollLeft;},getViewportRect:function(de)
{if("object"!=typeof de)
de=this.getDocumentElement();var pt1=new Point(this.getViewportXOffset(de),this.getViewportYOffset(de));var pt2=new Point(pt1.x+this.getViewportWidth(de),pt1.y+this.getViewportHeight(de));return new Rectangle(pt1,pt2);},getYCoord:function(node)
{var y=0;while(node)
{y+=node.offsetTop;node=node.offsetParent;}
return y;},getXCoord:function(node)
{var x=0;while(node)
{x+=node.offsetLeft;node=node.offsetParent;}
return x;},getAbsolutePos:function(node)
{var pt=new Point(node.offsetLeft,node.offsetTop);pt.xAdjust=0;pt.yAdjust=0;pt.scrollX=node.scrollLeft;pt.scrollY=node.scrollTop;node=node.offsetParent;while(node)
{pt.x+=node.offsetLeft;pt.y+=node.offsetTop;pt.scrollX+=node.scrollLeft;pt.scrollY+=node.scrollTop;var pos=null;if(0!=pt.xAdjust||0!=pt.yAdjust||"absolute"==(pos=XBrowser.getStyle(node,"position").toLowerCase())||"relative"==pos)
{pt.xAdjust+=node.offsetLeft;pt.yAdjust+=node.offsetTop;}
node=node.offsetParent;}
pt.adjustedX=pt.x-pt.xAdjust;pt.adjustedY=pt.y-pt.yAdjust;return pt;},onevent:function(element,eventName)
{var eventFunctionName=eventName+'Fn';var fnBodyAttrib;var fnBody;if((fnBodyAttrib=element.attributes[eventName])&&(fnBody=fnBodyAttrib.value))
{if(!element[eventFunctionName])
eval('element.'+eventFunctionName+' = function(){'+fnBody+'};');element[eventFunctionName](element);}},getDisplacement:function(pt1,pt2,m)
{var x=(m*pt2.x+(1-m)*pt1.x);var y=(m*pt2.y+(1-m)*pt1.y);return new Point(x,y);},fitInScreen:function(dstRect,noOverlapRect)
{var de=this.getDocumentElement();var viewport=this.getViewportRect(de);var yDelta=0,xDelta=0;if(dstRect.pt2.x>viewport.pt2.x&&dstRect.pt1.x>=viewport.pt1.x)
xDelta=dstRect.pt2.x-viewport.pt2.x;if(dstRect.pt2.y>viewport.pt2.y&&dstRect.pt1.y>=viewport.pt1.y)
yDelta=dstRect.pt2.y-viewport.pt2.y;this._transformRect(dstRect,"x",xDelta);this._transformRect(dstRect,"y",yDelta);yDelta=0;xDelta=0;var xIsOverlapping=(dstRect.pt2.x>noOverlapRect.pt1.x&&dstRect.pt1.x<noOverlapRect.pt2.x);var yIsOverlapping=(dstRect.pt2.y>noOverlapRect.pt1.y&&dstRect.pt1.y<noOverlapRect.pt2.y);if(xIsOverlapping&&yIsOverlapping)
{if(yIsOverlapping)
yDelta=dstRect.pt2.y-noOverlapRect.pt1.y;}
this._transformRect(dstRect,"x",xDelta);this._transformRect(dstRect,"y",yDelta);return{rect:dstRect,moveOrigin:(0!=xDelta||0!=yDelta)};},_transformRect:function(rect,ptMember,delta)
{if(0!=delta)
{rect.pt1[ptMember]-=delta;rect.pt2[ptMember]-=delta;}}};var Callback={_nextId:1,_freeList:[],addValue:function(val)
{if(null==val||"undefined"==typeof val)
throw new Error(0,"addValue must have a val.");var key;if(0<this._freeList.length)
key=this._freeList.pop();else
key=this._nextId++;this["__value-"+key]=val;return key;},getValue:function(key)
{return this["__value-"+key];},getParentValue:function(key)
{if(window.parent&&window.parent.Callback)
return window.parent.Callback.getValue(key);},removeValue:function(key)
{if(null!=this["__value-"+key])
{var ret=this["__value-"+key];this["__value-"+key]=null;this._freeList.push(key);return ret;}},startTimeout:function(period,sender,args,delegate)
{return this._start(1,setTimeout,period,sender,args,delegate);},startInterval:function(period,sender,args,delegate)
{return this._start(2,setInterval,period,sender,args,delegate);},endTimeout:function(timeoutId)
{this._end(timeoutId,clearTimeout);},endInterval:function(intervalId)
{this._end(intervalId,clearInterval);},onload:function(delegate)
{var cbId=this.addValue(delegate);var fn=this._getFn("Callback._onLoadBack(Event._xbGetEvent(),"+cbId+")",cbId);Event._xbAddEventListener(window,"load",fn);},getCallback:function(delegate)
{var cbId=this.addValue(delegate);var fn=this._getFn("Callback._callback.apply(Callback, ["+cbId+"].concat(Array.prototype.slice.apply(arguments, [0])))",cbId);return[fn,cbId];},cleanupCallback:function(cbId)
{this.removeValue(cbId);},_fnFact:new Object,_getFn:function(sMethodOrBody,cbId)
{var fnRet=null;var k=sMethodOrBody+cbId;if(null==(fnRet=this._fnFact[k]))
{if(0!=sMethodOrBody.indexOf("Callback."))
sMethodOrBody="Callback."+sMethodOrBody+"("+cbId+")"
fnRet=new Function(sMethodOrBody);this._fnFact[k]=fnRet;}
return fnRet;},_start:function(type,startFn,period,sender,args,delegate)
{var objInternal={s:sender,a:args,d:delegate,type:type};var cbId=this.addValue(objInternal);var fnInternal=this._getFn("_timerCallback",cbId);objInternal.timerId=startFn(fnInternal,period);return cbId;},_end:function(cbId,clearFn)
{var o=this.getValue(cbId);if(this._isIntValid(o))
{clearFn(o.timerId);this.removeValue(cbId);}},_isIntValid:function(o)
{return DataType.isObject(o)&&DataType.isFunction(o.fn)&&DataType.isNumber(o.timerId);},_callback:function(cbId)
{var del=this.getValue(cbId);del._fn.apply(del._t,Array.prototype.slice.apply(arguments,[0]));},_onLoadBack:function(evt,cbId)
{this.getValue(cbId).call(evt);this.removeValue(cbId);},_timerCallback:function(cbId)
{var o=this.getValue(cbId);o.d.call(o.s,o.a,cbId);if(1==o.type)
this.endTimeout(cbId);}};var Server={call:function(component,forceRefresh,delegate,cbIdParam,args)
{var cbId=Callback.addValue(delegate);var sb=new StringBuilder(component);sb.append("?");sb.append(encodeURIComponent(cbIdParam)).append("=").append(cbId);if(args&&0==args.length%2)
{for(var idxArg=0;idxArg<args.length;idxArg+=2)
{var param=args[idxArg];var value=args[idxArg+1];if(DataType.isUndefined(param)||DataType.isUndefined(value))
continue;sb.append("&").append(encodeURIComponent(param)).append("=").append(encodeURIComponent(value));}}
Http.scriptGet(sb.toString(),forceRefresh);}};function Cookies()
{this._cookies=[];this.refresh();}
Object.extend(Cookies,{setValue:function(name,value,expires,path,domain,secure)
{var today=new Date();if(expires)
expires=Math.round(expires*86400000);var expires_date=new Date(today.getTime()+expires);var cookieVal=name+"="+escape(value)
+((expires)?";expires="+expires_date.toGMTString():"")
+((path)?";path="+path:"")
+((domain)?";domain="+domain:"")
+((secure)?";secure":"");document.cookie=cookieVal;}});Cookies.prototype={getValue:function(cookieName)
{var cookie=this._cookies[cookieName];if("undefined"==typeof cookie||null==cookie)
return;return cookie.value;},getNames:function()
{var names=[];for(var name in this._cookies)
if("length"!=name)
names.push(name);return names;},setValue:function(name,value,expires,path,domain,secure)
{Cookies.setValue(name,value,expires,path,domain,secure);this._append(name,value);},getCookies:function()
{return this._cookies;},refresh:function()
{var sValue=document.cookie;if(!sValue||""==sValue)
return;var cookies=sValue.split(';');for(var idxCookies=cookies.length-1;idxCookies>=0;idxCookies--)
{var cookieParts=cookies[idxCookies].split('=');if(2!=cookieParts.length)
continue;this._append(cookieParts[0],cookieParts[1]);}},_append:function(name,value)
{var cookie={name:name,value:value};this._cookies.push(cookie);this._cookies[cookie.name]=cookie;}};function BitCollection(intOrArrInts)
{if(DataType.isNumber(intOrArrInts))
this._arr=[intOrArrInts];else
this._arr=intOrArrInts;this.length=this._arr.length*32;}
BitCollection.prototype={getVal:function(idx)
{return 0x1&(this._arr[Math.floor(idx/8)]>>(idx%8));},setVal:function(idx,val)
{var arrIdx=Math.floor(idx/8);var operand=1<<(idx%8);if(val)
this._arr[arrIdx]|=operand;else
this._arr[arrIdx]&=~operand;},toString:function()
{var sb=new StringBuilder("0x").append(this._arr[0].toString(16));for(var idxArr=1;idxArr<this._arr.length;idxArr++)
sb.append(",0x").append(this._arr[idxArr].toString(16));}};var Build={image:function(parent,className,src,alt)
{var ret=document.createElement("img");if(this._validP(className))
ret.className=className;if(this._validP(src))
ret.src=src;if(this._validP(alt))
ret.alt=alt;parent.appendChild(ret);return ret;},imageButton:function(parent,className,src,alt,id,name,isDisabled)
{var ret=document.createElement("input");ret.type="image";this._setFormProps(ret,className,id,name,isDisabled);if(this._validP(src))
ret.src=src;if(this._validP(alt))
ret.alt=alt;parent.appendChild(ret);return ret;},button:function(parent,className,value,id,name,isDisabled)
{return this._newInput("button",parent,className,value,id,name,isDisabled);},a:function(parent,className,href,innerHtml)
{var ret=this._newInner("a",parent,className,innerHtml);if(this._validP(href))
ret.href=href;return ret;},textBox:function(parent,className,value,id,name,isDisabled)
{return this._newInput("text",parent,className,value,id,name,isDisabled);},radio:function(parent,className,value,id,name,isChecked,isDisabled)
{var ret;if(BrowserDetection.isIE)
{var s=new StringBuilder("<input type='radio");if(this._validP(className))
s.append("' class='").append(className);if(this._validP(id))
s.append("' id='").append(id);if(this._validP(name))
s.append("' name='").append(name);if(this._validP(value))
s.append("' value='").append(value);if(this._validP(isChecked)&&isChecked)
s.append("' checked='checked");if(this._validP(isDisabled)&&isDisabled)
s.append("' disabled='disabled");s.append("' />");ret=document.createElement(s.toString());parent.appendChild(ret);}
else
{ret=this._newInput("radio",parent,className,value,id,name,isDisabled);if(this._validP(isChecked))
ret.checked=isChecked;}
return ret;},checkBox:function(parent,className,value,id,name,isChecked,isDisabled)
{var ret=this._newInput("checkbox",parent,className,value,id,name,isDisabled);if(this._validP(isChecked))
ret.checked=isChecked;return ret;},select:function(parent,className,innerHtml,id,name,isDisabled)
{var ret=this._newInner("select",parent,className,innerHtml);this._setFormProps(ret,className,id,name,isDisabled);return ret;},option:function(parent,className,innerHtml,value,isSelected,maxLength)
{var ret=document.createElement("option");if(this._validP(className))
ret.className=className;var textIsValid=this._validP(innerHtml);if(textIsValid)
{if(DataType.isNumber(maxLength)&&innerHtml.length>maxLength)
innerHtml=innerHtml.slice(0,maxLength);ret.innerHTML=innerHtml;}
if(this._validP(value))
ret.value=value;else if(textIsValid)
ret.value=innerHtml;if(this._validP(isSelected))
ret.selected=isSelected;parent.appendChild(ret);return ret;},textArea:function(parent,className,value,id,name,isDisabled)
{var ret=document.createElement("textarea");this._setFormProps(ret,className,id,name,isDisabled);if(this._validP(value))
ret.value=value;parent.appendChild(ret);return ret;},span:function(parent,className,innerHtml)
{return this._newInner("span",parent,className,innerHtml);},div:function(parent,className,innerHtml)
{return this._newInner("div",parent,className,innerHtml);},p:function(parent,className,innerHtml)
{return this._newInner("p",parent,className,innerHtml);},ul:function(parent,className,innerHtml)
{return this._newInner("ul",parent,className,innerHtml);},li:function(parent,className,innerHtml)
{return this._newInner("li",parent,className,innerHtml);},br:function(parent,className)
{return this._newInner("br",parent,className);},h1:function(parent,className,val)
{return this._newInner("h1",parent,className,val);},h2:function(parent,className,val)
{return this._newInner("h2",parent,className,val);},h3:function(parent,className,val)
{return this._newInner("h3",parent,className,val);},h4:function(parent,className,val)
{return this._newInner("h4",parent,className,val);},h5:function(parent,className,val)
{return this._newInner("h5",parent,className,val);},h6:function(parent,className,val)
{return this._newInner("h6",parent,className,val);},label:function(parent,className,bindingElem,val)
{var ret=this._newInner("label",parent,className,val);if(this._validP(bindingElem))
{if(!bindingElem.id)
bindingElem.id=this.nextId();ret.htmlFor=bindingElem.id;}
return ret;},text:function(parent,value)
{var ret=document.createTextNode(value);parent.appendChild(ret);return ret;},table:function(parent,className)
{return this._newInner("table",parent,className);},tHead:function(parent,className)
{return this._newInner("thead",parent,className);},th:function(parent,className,val)
{return this._newInner("th",parent,className,val);},tBody:function(parent,className)
{return this._newInner("tbody",parent,className);},tr:function(parent,className)
{return this._newInner("tr",parent,className);},td:function(parent,className,val)
{return this._newInner("td",parent,className,val);},nextId:function()
{if(DataType.isUndefined(Build._id))
Build._id=(new Date()).getTime();return"A"+Build._id++;},_newInner:function(eName,parent,className,innerHtml)
{var ret=document.createElement(eName);parent.appendChild(ret);if(this._validP(className))
ret.className=className;if(this._validP(innerHtml))
ret.innerHTML=innerHtml;return ret;},_newInput:function(type,parent,className,value,id,name,isDisabled)
{var ret=document.createElement("input");ret.type=type;if(this._validP(value))
ret.value=value;this._setFormProps(ret,className,id,name,isDisabled);parent.appendChild(ret);return ret;},_setFormProps:function(formElem,className,id,name,isDisabled)
{if(this._validP(className))
formElem.className=className;if(this._validP(id))
formElem.id=id;if(this._validP(name))
formElem.name=name;if(this._validP(isDisabled))
formElem.disabled=isDisabled;},_validP:function(val)
{return DataType.isParam(val);}};var DataType={isUndefined:function(ref)
{return"undefined"==typeof ref;},isObject:function(ref)
{return"object"==typeof ref;},isFunction:function(ref)
{return"function"==typeof ref||(BrowserDetection.isIE&&"object"==typeof ref);},isArray:function(ref)
{return"array"==typeof ref||("object"==typeof ref&&this.isNumber(ref.length));},isNumber:function(ref)
{return"number"==typeof ref;},isString:function(ref)
{return"string"==typeof ref;},isBoolean:function(ref)
{return"boolean"==typeof ref;},isNull:function(ref)
{return null==ref;},isEmpty:function(ref)
{return""==ref;},isTag:function(ref,tagName)
{return(this.isObject(ref)&&!this.isNull(ref)&&this.isString(this.tagName)&&this.tagName.toLowerCase()==tagName);},isParam:function(val)
{return!this.isUndefined(val)&&!this.isNull(val);},_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode64:function(input)
{var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do
{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2))
enc3=enc4=64;else if(isNaN(chr3))
enc4=64;output=output+this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+
this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);}while(i<input.length);return output;},decode64:function(input)
{var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do
{enc1=this._keyStr.indexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64)
output=output+String.fromCharCode(chr2);if(enc4!=64)
output=output+String.fromCharCode(chr3);}while(i<input.length);return output;},isCatIdValid:function(id)
{var re=this._makeRegEx("^([a-f\\d]{32};(:[a-f\\d]{32};)?)(;([a-f\\d]{32};(:[a-f\\d]{32};)?))*$");return(id&&this.isString(id)&&re.test(id));},isQuantityValid:function(qty)
{return((this.isNumber(qty)&&!isNaN(qty))||(this.isString(qty)&&!isNaN(Number(qty))));},isOrIdValid:function(id)
{var re=this._makeRegEx("^[a-f\\d]{8};-[a-f\\d]{4};-[a-f\\d]{4};-[a-f\\d]{4};-[a-f\\d]{12};$");return(id&&"string"==typeof id&&re.test(id));},formatDollarString:function(number,places)
{return"$"+number.toFixed(places);},formatPercentageString:function(number,places)
{return number.toFixed(places)+"%";},_encodeRegEx:function(regExExpression)
{return regExExpression.replace(/\};/g,"}");},_makeRegEx:function(regExExpression)
{return new RegExp(this._encodeRegEx(regExExpression),"gi");}};function Zip()
{}
Zip.prototype={_WSIZE:32768,_lbits:9,_dbits:6,_slide:null,_wp:undefined,_fixed_tl:null,_fixed_td:undefined,_fixed_bl:undefined,_bit_buf:undefined,_bit_len:undefined,_method:undefined,_eof:undefined,_copy_leng:undefined,_copy_dist:undefined,_tl:undefined,_td:undefined,_bl:undefined,_bd:undefined,_inflate_data:undefined,_inflate_pos:undefined,_MASK_BITS:new Array(0x0000,0x0001,0x0003,0x0007,0x000f,0x001f,0x003f,0x007f,0x00ff,0x01ff,0x03ff,0x07ff,0x0fff,0x1fff,0x3fff,0x7fff,0xffff),_cplens:new Array(3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0),_cplext:new Array(0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99),_cpdist:new Array(1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577),_cpdext:new Array(0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13),_border:new Array(16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15),_HuftBuild:function
(b,n,s,d,e,mm)
{this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;{var a;var c=new Array(this.BMAX+1);var el;var f;var g;var h;var i;var j;var k;var lx=new Array(this.BMAX+1);var p;var pidx;var q;var r=new this._HuftNode();var u=new Array(this.BMAX);var v=new Array(this.N_MAX);var w;var x=new Array(this.BMAX+1);var xp;var y;var z;var o;var tail;tail=this.root=null;for(i=0;i<c.length;i++)
c[i]=0;for(i=0;i<lx.length;i++)
lx[i]=0;for(i=0;i<u.length;i++)
u[i]=null;for(i=0;i<v.length;i++)
v[i]=0;for(i=0;i<x.length;i++)
x[i]=0;el=n>256?b[256]:this.BMAX;p=b;pidx=0;i=n;do
{c[p[pidx]]++;pidx++;}while(--i>0);if(c[0]==n)
{this.root=null;this.m=0;this.status=0;return;}
for(j=1;j<=this.BMAX;j++)
if(c[j]!=0)
break;k=j;if(mm<j)
mm=j;for(i=this.BMAX;i!=0;i--)
if(c[i]!=0)
break;g=i;if(mm>i)
mm=i;for(y=1<<j;j<i;j++,y<<=1)
if((y-=c[j])<0)
{this.status=2;this.m=mm;return;}
if((y-=c[i])<0)
{this.status=2;this.m=mm;return;}
c[i]+=y;x[1]=j=0;p=c;pidx=1;xp=2;while(--i>0)
x[xp++]=(j+=p[pidx++]);p=b;pidx=0;i=0;do
{if((j=p[pidx++])!=0)
v[x[j]++]=i;}while(++i<n);n=x[g];x[0]=i=0;p=v;pidx=0;h=-1;w=lx[0]=0;q=null;z=0;for(;k<=g;k++)
{a=c[k];while(a-->0)
{while(k>w+lx[1+h])
{w+=lx[1+h];h++;z=(z=g-w)>mm?mm:z;if((f=1<<(j=k-w))>a+1)
{f-=a+1;xp=k;while(++j<z)
{if((f<<=1)<=c[++xp])
break;f-=c[xp];}}
if(w+j>el&&w<el)
j=el-w;z=1<<j;lx[1+h]=j;q=new Array(z);for(o=0;o<z;o++)
{q[o]=new this._HuftNode();}
if(tail==null)
tail=this.root=new this._HuftList();else
tail=tail.next=new this._HuftList();tail.next=null;tail.list=q;u[h]=q;if(h>0)
{x[h]=i;r.b=lx[h];r.e=16+j;r.t=q;j=(i&((1<<w)-1))>>(w-lx[h]);u[h-1][j].e=r.e;u[h-1][j].b=r.b;u[h-1][j].n=r.n;u[h-1][j].t=r.t;}}
r.b=k-w;if(pidx>=n)
r.e=99;else if(p[pidx]<s)
{r.e=(p[pidx]<256?16:15);r.n=p[pidx++];}
else
{r.e=e[p[pidx]-s];r.n=d[p[pidx++]-s];}
f=1<<(k-w);for(j=i>>w;j<z;j+=f)
{q[j].e=r.e;q[j].b=r.b;q[j].n=r.n;q[j].t=r.t;}
for(j=1<<(k-1);(i&j)!=0;j>>=1)
i^=j;i^=j;while((i&((1<<w)-1))!=x[h])
{w-=lx[h];h--;}}}
this.m=lx[1];this.status=((y!=0&&g!=1)?1:0);}},_GET_BYTE:function()
{if(this._inflate_data.length==this._inflate_pos)
return-1;return this._inflate_data.charCodeAt(this._inflate_pos++)&0xff;},_NEEDBITS:function(n)
{while(this._bit_len<n)
{this._bit_buf|=this._GET_BYTE()<<this._bit_len;this._bit_len+=8;}},_GETBITS:function(n)
{return this._bit_buf&this._MASK_BITS[n];},_DUMPBITS:function(n)
{this._bit_buf>>=n;this._bit_len-=n;},_inflate_codes:function(buff,off,size)
{var e;var t;var n;if(size==0)
return 0;n=0;for(;;)
{this._NEEDBITS(this._bl);t=this._tl.list[this._GETBITS(this._bl)];e=t.e;while(e>16)
{if(e==99)
return-1;this._DUMPBITS(t.b);e-=16;this._NEEDBITS(e);t=t.t[this._GETBITS(e)];e=t.e;}
this._DUMPBITS(t.b);if(e==16)
{this._wp&=this._WSIZE-1;buff[off+n++]=this._slide[this._wp++]=t.n;if(n==size)
return size;continue;}
if(e==15)
break;this._NEEDBITS(e);this._copy_leng=t.n+this._GETBITS(e);this._DUMPBITS(e);this._NEEDBITS(this._bd);t=this._td.list[this._GETBITS(this._bd)];e=t.e;while(e>16)
{if(e==99)
return-1;this._DUMPBITS(t.b);e-=16;this._NEEDBITS(e);t=t.t[this._GETBITS(e)];e=t.e;}
this._DUMPBITS(t.b);this._NEEDBITS(e);this._copy_dist=this._wp-t.n-this._GETBITS(e);this._DUMPBITS(e);while(this._copy_leng>0&&n<size)
{this._copy_leng--;this._copy_dist&=this._WSIZE-1;this._wp&=this._WSIZE-1;buff[off+n++]=this._slide[this._wp++]=this._slide[this._copy_dist++];}
if(n==size)
return size;}
this._method=-1;return n;},_inflate_stored:function(buff,off,size)
{var n;n=this._bit_len&7;this._DUMPBITS(n);this._NEEDBITS(16);n=this._GETBITS(16);this._DUMPBITS(16);this._NEEDBITS(16);if(n!=((~this._bit_buf)&0xffff))
return-1;this._DUMPBITS(16);this._copy_leng=n;n=0;while(this._copy_leng>0&&n<size)
{this._copy_leng--;this._wp&=this._WSIZE-1;this._NEEDBITS(8);buff[off+n++]=this._slide[this._wp++]=this._GETBITS(8);this._DUMPBITS(8);}
if(this._copy_leng==0)
this._method=-1;return n;},_inflate_fixed:function(buff,off,size)
{if(this._fixed_tl==null)
{var i;var l=new Array(288);var h;for(i=0;i<144;i++)
l[i]=8;for(;i<256;i++)
l[i]=9;for(;i<280;i++)
l[i]=7;for(;i<288;i++)
l[i]=8;this._fixed_bl=7;h=new this._HuftBuild(l,288,257,this._cplens,this._cplext,this._fixed_bl);if(h.status!=0)
{alert("HufBuild error: "+h.status);return-1;}
this._fixed_tl=h.root;this._fixed_bl=h.m;for(i=0;i<30;i++)
l[i]=5;zip_fixed_bd=5;h=new this._HuftBuild(l,30,0,this._cpdist,this._cpdext,zip_fixed_bd);if(h.status>1)
{this._fixed_tl=null;alert("HufBuild error: "+h.status);return-1;}
this._fixed_td=h.root;zip_fixed_bd=h.m;}
this._tl=this._fixed_tl;this._td=this._fixed_td;this._bl=this._fixed_bl;this._bd=zip_fixed_bd;return this._inflate_codes(buff,off,size);},_inflate_dynamic:function(buff,off,size)
{var i;var j;var l;var n;var t;var nb;var nl;var nd;var ll=new Array(286+30);var h;for(i=0;i<ll.length;i++)
ll[i]=0;this._NEEDBITS(5);nl=257+this._GETBITS(5);this._DUMPBITS(5);this._NEEDBITS(5);nd=1+this._GETBITS(5);this._DUMPBITS(5);this._NEEDBITS(4);nb=4+this._GETBITS(4);this._DUMPBITS(4);if(nl>286||nd>30)
return-1;for(j=0;j<nb;j++)
{this._NEEDBITS(3);ll[this._border[j]]=this._GETBITS(3);this._DUMPBITS(3);}
for(;j<19;j++)
ll[this._border[j]]=0;this._bl=7;h=new this._HuftBuild(ll,19,19,null,null,this._bl);if(h.status!=0)
return-1;this._tl=h.root;this._bl=h.m;n=nl+nd;i=l=0;while(i<n)
{this._NEEDBITS(this._bl);t=this._tl.list[this._GETBITS(this._bl)];j=t.b;this._DUMPBITS(j);j=t.n;if(j<16)
ll[i++]=l=j;else if(j==16)
{this._NEEDBITS(2);j=3+this._GETBITS(2);this._DUMPBITS(2);if(i+j>n)
return-1;while(j-->0)
ll[i++]=l;}
else if(j==17)
{this._NEEDBITS(3);j=3+this._GETBITS(3);this._DUMPBITS(3);if(i+j>n)
return-1;while(j-->0)
ll[i++]=0;l=0;}
else
{this._NEEDBITS(7);j=11+this._GETBITS(7);this._DUMPBITS(7);if(i+j>n)
return-1;while(j-->0)
ll[i++]=0;l=0;}}
this._bl=this._lbits;h=new this._HuftBuild(ll,nl,257,this._cplens,this._cplext,this._bl);if(this._bl==0)
h.status=1;if(h.status!=0)
{if(h.status==1);return-1;}
this._tl=h.root;this._bl=h.m;for(i=0;i<nd;i++)
ll[i]=ll[i+nl];this._bd=this._dbits;h=new this._HuftBuild(ll,nd,0,this._cpdist,this._cpdext,this._bd);this._td=h.root;this._bd=h.m;if(this._bd==0&&nl>257)
{return-1;}
if(h.status==1)
{;}
if(h.status!=0)
return-1;return this._inflate_codes(buff,off,size);},_inflate_start:function()
{var i;if(this._slide==null)
this._slide=new Array(2*this._WSIZE);this._wp=0;this._bit_buf=0;this._bit_len=0;this._method=-1;this._eof=false;this._copy_leng=this._copy_dist=0;this._tl=null;},_inflate_internal:function(buff,off,size)
{var n,i;n=0;while(n<size)
{if(this._eof&&this._method==-1)
return n;if(this._copy_leng>0)
{if(this._method!=zip_STORED_BLOCK)
{while(this._copy_leng>0&&n<size)
{this._copy_leng--;this._copy_dist&=this._WSIZE-1;this._wp&=this._WSIZE-1;buff[off+n++]=this._slide[this._wp++]=this._slide[this._copy_dist++];}}
else
{while(this._copy_leng>0&&n<size)
{this._copy_leng--;this._wp&=this._WSIZE-1;this._NEEDBITS(8);buff[off+n++]=this._slide[this._wp++]=this._GETBITS(8);this._DUMPBITS(8);}
if(this._copy_leng==0)
this._method=-1;}
if(n==size)
return n;}
if(this._method==-1)
{if(this._eof)
break;this._NEEDBITS(1);if(this._GETBITS(1)!=0)
this._eof=true;this._DUMPBITS(1);this._NEEDBITS(2);this._method=this._GETBITS(2);this._DUMPBITS(2);this._tl=null;this._copy_leng=0;}
switch(this._method)
{case 0:i=this._inflate_stored(buff,off+n,size-n);break;case 1:if(this._tl!=null)
i=this._inflate_codes(buff,off+n,size-n);else
i=this._inflate_fixed(buff,off+n,size-n);break;case 2:if(this._tl!=null)
i=this._inflate_codes(buff,off+n,size-n);else
i=this._inflate_dynamic(buff,off+n,size-n);break;default:i=-1;break;}
if(i==-1)
{if(this._eof)
return 0;return-1;}
n+=i;}
return n;},inflate:function(str)
{var out,buff;var i,j;this._inflate_start();this._inflate_data=str;this._inflate_pos=0;buff=new Array(1024);out="";while((i=this._inflate_internal(buff,0,buff.length))>0)
{for(j=0;j<i;j++)
out+=String.fromCharCode(buff[j]);}
this._inflate_data=null;return out;}};Zip.prototype._HuftBuild.prototype={_HuftList:function()
{this.next=null;this.list=null;},_HuftNode:function()
{this.e=0;this.b=0;this.n=0;this.t=null;}};
function AjaxPanel(elemDiv,replacementExpression,replacementValue)
{this._div=elemDiv;this._replacementExpression=replacementExpression;this._replacementValue=replacementValue;}
Object.extend(AjaxPanel,{newO:function(idOrElem,regEx,replacementValue)
{var elem=PopupCommon._domFromIdOrElem(idOrElem);if(elem)
elem.ap=new AjaxPanel(elem,regEx,replacementValue);},load:function(This,ids)
{for(var idxId=ids.length-1;idxId>=0;idxId--)
{var child=document.getElementById(ids[idxId]);if(child&&child.ap)
child.ap.load();}}});AjaxPanel.prototype={load:function()
{if(this._loaded)
return;this._loaded=true;var div=this._div;div.style.display='block';div.innerHTML='Loading ...';this._callbackKey=Callback.addValue(this);Http.get(div.attributes['url'].value,new Function("result","Callback.getValue("+this._callbackKey+").finishLoad(result);"));},finishLoad:function(result)
{if(this._replacementExpression)
{result=result.replace(this._replacementExpression,this._replacementValue);}
var reScripts=/<script[^>]*>\r\n\/\/<!\[CDATA\[\r\n((\r\n|.)*)\/\/\]\]>(?:\r\n)*<\/script>/im;var scripts=result.match(reScripts);if(scripts)
result=result.replace(reScripts,"");this._div.innerHTML=result;if(scripts)
for(var idxScripts=1;idxScripts<scripts.length;idxScripts++)
eval(scripts[idxScripts]);Callback.removeValue(this._callbackKey);UI.onevent(this._div,'onloadfinished');}};function PopupCommon()
{}
Object.extend(PopupCommon,{_domFromIdOrElem:function(idOrElem)
{if(null==idOrElem)
return null;var elem=null;if("object"==typeof idOrElem)
elem=idOrElem;else if("string"==typeof idOrElem)
elem=document.getElementById(idOrElem);return elem;},_hideSelects:function(divExclude)
{var allSelects=document.getElementsByTagName('select');var selectsToHide=[];for(var idxAll=allSelects.length-1;idxAll>=0;idxAll--)
{var select=allSelects[idxAll];if(!this._inParentChain(select,divExclude))
selectsToHide.push(select);}
for(var idxToHide=selectsToHide.length-1;idxToHide>=0;idxToHide--)
FormUtil.hideSelect(selectsToHide[idxToHide]);return selectsToHide;},_showSelects:function(selects)
{for(var idxSelects=selects.length-1;idxSelects>=0;idxSelects--)
FormUtil.showSelect(selects[idxSelects]);},_inParentChain:function(child,parent)
{var pn=child.parentNode;do
{if(pn==parent)
return true;}while(null!=(pn=pn.parentNode));return false;}});function PopupPanel(elemDiv,tOutDelay,doNotIncludeMargin)
{this._div=elemDiv;if("number"!=typeof tOutDelay)
tOutDelay=300;this._tOutDelay=tOutDelay;this._includeMargin=(!doNotIncludeMargin);this._isAnimationShowing=false;this._isShowing=false;this._timeoutId=-1;this._timeoutCbId=-1;this._hiddenSelects=null;this._shadow=Build.div(elemDiv.parentNode,"PopupShadow");}
Object.extend(PopupPanel,{newO:function(idOrElem,delay,doNotIncludeMargin)
{var elem=PopupCommon._domFromIdOrElem(idOrElem);if(elem)
return(elem.popupPanel=new PopupPanel(elem,delay,doNotIncludeMargin));},show:function(idOrElem,srcElem)
{var elem=PopupCommon._domFromIdOrElem(idOrElem);if(elem&&elem.popupPanel)
elem.popupPanel.show(srcElem);},hide:function(idOrElem,srcElem)
{var elem=PopupCommon._domFromIdOrElem(idOrElem);if(elem&&elem.popupPanel)
elem.popupPanel.hide(srcElem);},_showTransform:function(x)
{return Math.pow(x,2);},_hideTransform:function(x)
{return Math.pow(x-1,2);}});PopupPanel.prototype={show:function(elem)
{this._transitionWhileShown(elem);if(this._div!=elem||null==this._startElem)
this._startElem=elem;UI.onevent(this._div,'onshow');this._delayCall(true);},hide:function(elem)
{this._undoTransitions(elem);if(this._div!=elem||null==this._startElem)
this._startElem=elem;UI.onevent(this._div,'onhide');this._delayCall(false);},resize:function(key)
{if("number"==typeof key)
Callback.removeValue(key);if(!this._animation)
{var divs=[this._div,this._startElem];var rectangles=[];for(var idx=0;idx<divs.length;idx++)
{var div=divs[idx];var pt=UI.getAbsolutePos(div);rectangles.push(new Rectangle(pt,new Point(pt.x+div.offsetWidth,pt.y+div.offsetHeight)));}
var fisRet=UI.fitInScreen(rectangles[0],rectangles[1]);var leftFinal=(fisRet.rect.pt1.x-rectangles[0].pt1.xAdjust);var topFinal=(fisRet.rect.pt1.y-rectangles[0].pt1.yAdjust);divs[0].style.left=leftFinal+'px';divs[0].style.top=topFinal+'px';var shadowStyle=this._shadow.style;shadowStyle.left=leftFinal+5+'px';shadowStyle.top=topFinal+5+'px';shadowStyle.width=divs[0].clientWidth+'px';shadowStyle.height=divs[0].clientHeight+'px';}},_delayCall:function(show)
{if(0==this._tOutDelay)
{this._postDelay(show);return;}
if(-1==this._timeoutCbId)
this._timeoutCbId=Callback.addValue(this);if(-1!=this._timeoutId)
window.clearTimeout(this._timeoutId);this._timeoutId=window.setTimeout("Callback.getValue("+this._timeoutCbId+")._postDelay("+show+")",this._tOutDelay);},_postDelay:function(show)
{if(-1!=this._timeoutCbId)
{Callback.removeValue(this._timeoutCbId);this._timeoutCbId=-1;}
this._timeoutId=-1;var showSameAsShowing=!(show^this._isShowing);var showSameAsAnimating=!(show^this._isAnimationShowing);var isAnimating=null!=this._animation;if((isAnimating&&showSameAsAnimating)||(!isAnimating&&showSameAsShowing))
return;if(!show)
this._shadow.style.display='none';if(isAnimating)
{if(show&&!this._isAnimationShowing)
this._animation.reverse(PopupPanel._showTransform,"_finishShow");else if(!show&&this._isAnimationShowing)
this._animation.reverse(PopupPanel._hideTransform,"_finishHide");}
else
{if(show)
this._animation=new AnimateObject(this,this._startElem,this._div,30,7,PopupPanel._showTransform,"_finishShow",this._includeMargin);else
this._animation=new AnimateObject(this,this._startElem,this._div,30,7,PopupPanel._hideTransform,"_finishHide",this._includeMargin);}
this._isAnimationShowing=show;},_transitionWhileShown:function(elem)
{if(elem&&"IMG"==elem.nodeName.toUpperCase())
{elem.alt_orig=elem.alt;elem.alt="";}
if(BrowserDetection.isMaxIE6)
this._hiddenSelects=PopupCommon._hideSelects(this._div);},_undoTransitions:function(elem)
{if(elem&&"IMG"==elem.nodeName.toUpperCase())
{elem.alt=elem.alt_orig;elem.alt_orig="";}
if(BrowserDetection.isMaxIE6)
PopupCommon._showSelects(this._hiddenSelects);},_finishShow:function()
{this._animation=null;this._isShowing=true;var key=Callback.addValue(this);setTimeout("Callback.getValue("+key+").resize("+key+");",10);this._shadow.style.display='block';},_finishHide:function()
{this._animation=null;this._isShowing=false;this._div.style.display='none';}};function AnimateObject(obj,startElem,animateElem,periodLength,periods,mTransform,onFinishMethod,includeMargin)
{this._currentPeriod=0;this._obj=obj;this._startElem=startElem;this._animateElem=animateElem;this._periods=periods;this._onFinishMethod=onFinishMethod;this._mTransform=mTransform;this._includeMargin=includeMargin;this._init(periodLength);}
AnimateObject.prototype={resize:function()
{var pt=UI.getAbsolutePos(this._startElem);var x,y;x=pt.x;y=pt.y+this._startElem.offsetHeight+(this._includeMargin?2:0);this._ptOrig1=new Point(x-pt.xAdjust,y-pt.yAdjust);var ptNew1=new Point(x,y);x+=Math.max(10,this._animateElem.offsetWidth);y+=Math.max(10,this._animateElem.offsetHeight);var ptNew2=new Point(x,y);var fisRet=UI.fitInScreen(new Rectangle(ptNew1,ptNew2),new Rectangle(pt,new Point(pt.x+this._startElem.offsetWidth,pt.y+this._startElem.offsetHeight)));this._ptNew1=new Point(fisRet.rect.pt1.x-pt.xAdjust,fisRet.rect.pt1.y-pt.yAdjust);this._ptNew2=new Point(fisRet.rect.pt2.x-pt.xAdjust,fisRet.rect.pt2.y-pt.yAdjust);if(fisRet.moveOrigin)
this._ptOrig1=new Point(pt.adjustedX-1,pt.adjustedY-10);},animate:function()
{var elem=this._animateElem;var style=elem.style;var ptNew1=this._ptNew1;var currentPeriod=this._currentPeriod++;var periods=this._periods;var m=this._mTransform(currentPeriod/periods);if(currentPeriod>=periods)
{clearInterval(this._intervalId);this._intervalId=0;Callback.removeValue(this._callbackId);style.left=ptNew1.x+'px';style.top=ptNew1.y+'px';style.width=this._origWidth;style.height=this._origHeight;style.overflow=this._origOverflow;this._obj[this._onFinishMethod]();}
else
{var pt1=UI.getDisplacement(this._ptOrig1,ptNew1,m);var pt2=UI.getDisplacement(this._ptOrig1,this._ptNew2,m);style.left=pt1.x+'px';style.top=pt1.y+'px';style.width=pt2.x-pt1.x+'px';style.height=pt2.y-pt1.y+'px';}},reverse:function(newMTransform,newOnFinishMethod)
{this._mTransform=newMTransform;this._onFinishMethod=newOnFinishMethod;this._currentPeriod=this._periods-this._currentPeriod;},_init:function(periodLength)
{var animStyle=this._animateElem.style;this._origWidth=animStyle.width;this._origHeight=animStyle.height;this._origOverflow=XBrowser.getStyle(this._animateElem,"overflow");var origZIndex=XBrowser.getStyle(this._animateElem,"zIndex");animStyle.zIndex=-1;animStyle.display='block';animStyle.overflow='hidden';this.resize();this.animate();animStyle.zIndex=origZIndex;this._callbackId=Callback.addValue(this);this._intervalId=setInterval("Callback.getValue("+this._callbackId.toString()+").animate()",periodLength);}};function ModalPopupPanel(elemDiv,shouldFloat)
{this._div=elemDiv;this._shouldFloat=shouldFloat;var offset=parseInt(XBrowser.getStyle(elemDiv,"top"));if(isNaN(offset)||0>=offset)
offset=20;this._floatOffset=offset;this._alphaBlend=Build.div(elemDiv.parentNode,"modalPopupAlphaBlendBackground");}
Object.extend(ModalPopupPanel,{newO:function(idOrElem,shouldFloat,showOnStartup)
{var elem=PopupCommon._domFromIdOrElem(idOrElem);if(elem)
{elem.modalPopupPanel=new ModalPopupPanel(elem,shouldFloat);if(showOnStartup)
Event.addDomEventListener(window,'load',elem.modalPopupPanel.show,elem.modalPopupPanel);return elem.modalPopupPanel;}},show:function(idOrElem)
{var elem=PopupCommon._domFromIdOrElem(idOrElem);if(elem&&elem.modalPopupPanel)
elem.modalPopupPanel.show();},hide:function(idOrElem)
{var elem=PopupCommon._domFromIdOrElem(idOrElem);if(elem&&elem.modalPopupPanel)
elem.modalPopupPanel.hide();}});ModalPopupPanel.prototype={show:function()
{var de=UI.getDocumentElement();var div=this._div;var dStyle=div.style;var vpHeight=UI.getViewportHeight(de),vpWidth=UI.getViewportWidth(de);dStyle.display='block';var divPos=UI.getAbsolutePos(div);var vpCenter=(vpWidth-div.offsetWidth)/2;dStyle.left=(vpCenter+UI.getViewportXOffset(de)-divPos.xAdjust)+'px';dStyle.top=(UI.getViewportYOffset(de)+this._floatOffset-divPos.yAdjust)+'px';if((this._floatOffset+div.offsetHeight+20)>vpHeight)
{dStyle.height=(vpHeight-50-this._floatOffset)+'px';if(BrowserDetection.isIE&&!BrowserDetection.isMinIE7)
dStyle.overflow="scroll";else
dStyle.overflowX="scroll";}
var aStyle=this._alphaBlend.style;aStyle.display='block';aStyle.width=Math.max(de.scrollWidth,vpWidth)+'px';aStyle.height=Math.max(de.scrollHeight,vpHeight)+'px';aStyle.left=(divPos.xAdjust*-1)+'px';aStyle.top=(divPos.yAdjust*-1)+'px';UI.onevent(div,'onshow');if(this._shouldFloat)
{Event.addDomEventListener(window,'scroll',this._doScroll,this);}},hide:function()
{var div=this._div;div.style.display='none';this._alphaBlend.style.display='none';if(this._shouldFloat)
Event.removeDomEventListener(window,'scroll',this._doScroll,this);UI.onevent(div,'onhide');},_doScroll:function(evt)
{var de=UI.getDocumentElement();this._div.style.top=(UI.getViewportYOffset(de)+this._floatOffset-UI.getAbsolutePos(this._div).yAdjust)+'px';}};function ErrorPanel(parent,className,title,closeDelegate,isChecked)
{this._div=Build.div(parent,(className+" ErrorModalPopup").trim());this._closeFn=closeDelegate;this._init(title,isChecked);}
Object.extend(ErrorPanel,{_queue:[],_show:function(ep)
{this._queue.push(ep);if(1==this._queue.length)
ModalPopupPanel.show(ep._div);},_close:function()
{var currEp=this._queue.shift();ModalPopupPanel.hide(currEp._div);if(0<this._queue.length)
ModalPopupPanel.show(this._queue[0]._div);}});ErrorPanel.prototype={show:function(){ErrorPanel._show(this);},set_Content:function(val)
{if(DataType.isString(val))
this._content.innerHTML=val.replace(/\n/g,"<br />");},get_Content:function()
{return this._content.innerHTML;},setNoShowContent:function(val)
{var labels=this._div.getElementsByTagName("label");if(0<labels.length)
labels[0].innerHTML=val;},_init:function(title,isChecked)
{ModalPopupPanel.newO(this._div,true);Build.div(this._div,"divErrorPanelTitle",title);var body=Build.div(this._div,"divErrorPanelBody");this._content=Build.div(body,"divErrorPanelContent");var footer=Build.div(body,"divErrorPanelFooter");if(DataType.isObject(this._closeFn))
{var noShow=Build.div(footer,"divErrorPanelFooterNoShow");this._chk=Build.checkBox(noShow,"inputErrorPanelFooterNoShow",null,Build.nextId(),null,isChecked);Build.label(noShow,"labelErrorPanelFooterNoShow",this._chk," Do not show this again");}
var buttonLine=Build.div(footer,"divErrorPanelFooterButton");var button=Build.button(buttonLine,"inputErrorPanelFooterButton","Close");Event.addDomEventListener(button,"click",this._close_click,this);},_close_click:function(evt)
{evt.preventDefault();if(this._closeFn)
this._closeFn.call(this._chk.checked);ErrorPanel._close();}};
function newPopupWindow(url,height,width,name)
{if(!DataType.isParam(height))
height=400;if(!DataType.isParam(width))
width=780;var options=new StringBuilder('status=0,scrollbars=1,resizable=1,width=')
options.append(width);options.append(',height=').append(height);window.open(url,name,options.toString());return false;}
function extLink(url)
{window.open(url);return false;}
function pagePrint(evt)
{if(evt)
evt.preventDefault();if(window.print)
window.print();else
alert("We're sorry but your browser doesn't support dynamic printing. Please find and use the browser's print button to print this page.");}
function CheckBoxValidatorEvaluateIsValid(val)
{var control=document.getElementById(val.controltovalidate);var mustBeChecked=Boolean(val.mustBeChecked);return control.checked==mustBeChecked;}
function Banner(popupId,iframeId,mapUrl)
{this._popup=document.getElementById(popupId);this._ifrm=document.getElementById(iframeId);this._mapUrl=mapUrl;}
Banner.prototype={showMap:function(src,evt,rid)
{var url=this._mapUrl+"Re="+rid;if(BrowserDetection.isIE&&"https:"==window.location.protocol)
{var sb=new StringBuilder("http://");sb.append(window.location.host);sb.append(url);newPopupWindow(sb.toString(),479,475);}
else
{if(!this._isInit)
{this._ifrm.src=url;this._isInit=true;}
ModalPopupPanel.show(this._popup,src);}
if(evt)
evt.preventDefault();}};function Master(modalPopupId,ifrmId)
{this._popupElem=document.getElementById(modalPopupId);this._ifrm=document.getElementById(ifrmId);}
Master.prototype={show:function(elem)
{this._ifrm.src=elem.href;ModalPopupPanel.show(this._popupElem);return false;},addBookmark:function(url,title)
{if("string"!=url||!url||""==url)
url=window.location.href;if("string"!=title||!title||""==title)
title=document.getElementsByTagName('title')[0].innerHTML
if(document.all)
window.external.AddFavorite(url,title);else if(window.sidebar)
window.sidebar.addPanel(title,url,'');else alert('We were unable to automatically create a bookmark in your browser. Please press Ctrl + D to bookmark this page.');},copyToClipboard:function(elem)
{if(!confirm('The link is about to be copied to your clipboard; after that you may paste it in your site. If you see a security dialog after this please say allow or yes.'))
return;window.clipboardData.setData('Text',elem.value);}};function RestFavorites(favoriteHelperId,firstTimeId,notLoggedInId,useLarge)
{this._divFavoriteHelper=document.getElementById(favoriteHelperId);this._divFirstTime=document.getElementById(firstTimeId);this._divNotLoggedIn=document.getElementById(notLoggedInId);this._useLarge=useLarge;this._init();}
RestFavorites.prototype={_AddBtnSrc:"/Images/Standard/small-fav.gif",_AddBtnSrcLg:"/Images/Standard/big-thumbsup.gif",_AddBtnAlt:"Thumbs up icon for Favorite Restaurant. Click to add this restaurant as one of your favorite restaurants.",_RemoveBtnSrc:"/Images/Standard/small-unfav.gif",_RemoveBtnSrcLg:"/Images/Standard/big-thumbsdown.gif",_RemoveBtnAlt:"Thumbs down icon for Favorite Restaurant. Click to remove this restaurant from your favorite restaurants.",checkFirstTimeDismissed:function(chk)
{if(chk&&chk.checked&&chk.checked.toString()!=chk.originalValue)
{Handlers.FavoriteRestaurants.DismissFavoriteRestaurantHelper(chk.checked);}},_init:function()
{if(!this._getFavorites())
return;var elements=XBrowser.getElementsByClassName(document,"FavoriteRestaurant","div");if(!elements||0==elements.length)
return;for(var idxElements=elements.length-1;idxElements>=0;idxElements--)
{var div=elements[idxElements];var restId=div.innerHTML.trim();div.restaurantId=restId;div.innerHTML="";var src,alt;if(div.isFavorite=this._isFavorite(restId))
{src=this._useLarge?this._RemoveBtnSrcLg:this._RemoveBtnSrc;alt=this._RemoveBtnAlt;}
else
{src=this._useLarge?this._AddBtnSrcLg:this._AddBtnSrc;alt=this._AddBtnAlt;}
var button=Build.imageButton(div,null,src,alt);button.setAttribute("isModal","true");Event.addDomEventListener(button,"mouseover",this._showHelper,this);Event.addDomEventListener(button,"mouseout",this._hideHelper,this);Event.addDomEventListener(button,"click",this._toggle,this);div.style.display='block';}},_isFavorite:function(restId)
{if(!this._favs||0==this._favs.length)
return false;if(-1==this._favs.indexOf(restId))
return false;return true;},_isFavoriteSearch:function()
{if(DataType.isUndefined(this._isFavSrch))
{var qsMap=new QueryStringMap();this._isFavSrch=("1"==qsMap["F"]);}
return this._isFavSrch;},_getFavorites:function()
{if(DataType.isUndefined(this._favs))
{var ajaxRet=Handlers.FavoriteRestaurants.GetJsonFavoriteRestaurants();if(ajaxRet.error)
return false;else
this._favs=ajaxRet.value}
return true;},_add:function(restaurantId)
{var ajaxRet=Handlers.FavoriteRestaurants.AddFavoriteRestaurant(restaurantId);if(ajaxRet.error)
{return;}
else
{switch(ajaxRet.value)
{case-1:alert('We are sorry, an error has occurred while attempting to add your favorite. Please notify support@2goclub.com about this.');return;case-2:ModalPopupPanel.show(this._divNotLoggedIn);return;default:if(ajaxRet.value<0)
ModalPopupPanel.show(this._divFirstTime);break;}}
this._favs.push(restaurantId);},_remove:function(restaurantId)
{var ajaxRet=Handlers.FavoriteRestaurants.DeleteFavoriteRestaurant(restaurantId);this._favs.remove(restaurantId);},_toggle:function(evt)
{evt.preventDefault();var div,input;if(evt.currentTarget.tagName.toLowerCase()=="input")
{input=evt.currentTarget;div=input.parentNode;}
else
{div=evt.currentTarget;input=div.childNodes[0];}
if(div.isFavorite)
{this._remove(div.restaurantId);input.src=this._useLarge?this._AddBtnSrcLg:this._AddBtnSrc;input.alt=this._AddBtnAlt;if(this._isFavoriteSearch())
div.parentNode.parentNode.style.display='none';}
else
{this._add(div.restaurantId);input.src=this._useLarge?this._RemoveBtnSrcLg:this._RemoveBtnSrc;input.alt=this._RemoveBtnAlt;}
div.isFavorite=!div.isFavorite;},_showHelper:function(evt)
{PopupPanel.show(this._divFavoriteHelper,evt.currentTarget);},_hideHelper:function(evt)
{PopupPanel.hide(this._divFavoriteHelper,evt.currentTarget);}};var InputHelperPopup={toggleOpenClose:function(imgElem,id)
{if(imgElem.isOpen)
{PopupPanel.hide(id,imgElem);imgElem.isOpen=false;}
else
{PopupPanel.show(id,imgElem);imgElem.isOpen=true;}},toggleDetails:function(button)
{}};function OneTimeHelper(mpuId,sFnDismiss,closeId,origVal)
{this._mpu=document.getElementById(mpuId);this._sFnDismiss=sFnDismiss;this._origVal=origVal;this._init(closeId);}
OneTimeHelper.prototype={_init:function(cId)
{var btnClose=document.getElementById(cId);Event.addDomEventListener(btnClose,"click",this._close,this);},_close:function(evt)
{evt.preventDefault();var e=evt.target;if(!this._origVal)
{var shouldDismiss=false;var inputs=e.parentNode.getElementsByTagName("input");if(inputs&&0<inputs.length)
for(var idxI=inputs.length-1;idxI>=0;idxI--)
if("checkbox"==inputs[idxI].type&&inputs[idxI].checked)
shouldDismiss=true;if(shouldDismiss)
eval(this._sFnDismiss+"()");}
ModalPopupPanel.hide(this._mpu);}};function LoginSupport(popupId,ifrmId,baseHref,successUrl,emailId,panelId)
{this._popup=document.getElementById(popupId);this._ifrm=document.getElementById(ifrmId);this._baseHref=baseHref;this._successUrl=successUrl;this._email=document.getElementById(emailId);this._panel=document.getElementById(panelId);Callback.onload(new Delegate(this._init,this));}
LoginSupport.prototype={_init:function()
{this._cs=0;var qsMap=new QueryStringMap();if("1"==qsMap["snu"])
this.showNewUser();else if("1"==qsMap["sfp"])
this.showForgotPassword();},setDefaultButton:function(buttonId)
{if(buttonId)
{this._defaultButtonId=buttonId;this._panel.onkeypress=null;Event.addDomEventListener(this._panel,"keypress",this._handleDefaultButton,this);this._panel=null;}},_handleDefaultButton:function(evt)
{if(!WebForm_FireDefaultButton(evt,this._defaultButtonId))
evt.preventDefault();},_redirectIfNotSsl:function(qsAddition)
{if("https:"!=window.location.protocol.toLowerCase())
{var url=this._baseHref+"Support/Login.aspx?"+qsAddition;window.location.assign(url);}},showNewUser:function(evt)
{if(evt)
evt.preventDefault();this._redirectIfNotSsl("snu=1");if(1!=this._cs)
{var cbId=Callback.addValue(this);this._ifrm.src=this._baseHref+"Support/ForceLogout.aspx?"
+"Ruwf="+encodeURIComponent(this._baseHref+"Account/NewAccount.aspx?"
+"key="+cbId);this._cs=1;}
ModalPopupPanel.show(this._popup);},showForgotPassword:function(evt,email)
{if(evt)
evt.preventDefault();this._redirectIfNotSsl("sfp=1");if(this._email)
{if(email)
this._email.value=email;else if(this._email.value)
email=this._email.value;}
var cbId=Callback.addValue(this);this._ifrm.src=this._baseHref+"Support/ForgotPassword.aspx?"
+"key="+cbId
+(email?"&E="+email:"");this._cs=2;ModalPopupPanel.show(this._popup);},close:function(cbId,shouldRefresh)
{if(shouldRefresh)
{Callback.removeValue(cbId);this._ifrm.src='';this._cs=0;if(this._successUrl)
window.location.assign(this._successUrl);}
ModalPopupPanel.hide(this._popup);}};
Object.extend=function(dest,source,replace){for(var prop in source){if(replace==false&&dest[prop]!=null){continue;}
dest[prop]=source[prop];}
return dest;};Object.extend(Function.prototype,{apply:function(o,a){var r,x="__fapply";if(typeof o!="object"){o={};}
o[x]=this;var s="r = o."+x+"(";for(var i=0;i<a.length;i++){if(i>0){s+=",";}
s+="a["+i+"]";}
s+=");";eval(s);delete o[x];return r;},bind:function(o){if(!Function.__objs){Function.__objs=[];Function.__funcs=[];}
var objId=o.__oid;if(!objId){Function.__objs[objId=o.__oid=Function.__objs.length]=o;}
var me=this;var funcId=me.__fid;if(!funcId){Function.__funcs[funcId=me.__fid=Function.__funcs.length]=me;}
if(!o.__closures){o.__closures=[];}
var closure=o.__closures[funcId];if(closure){return closure;}
o=null;me=null;return Function.__objs[objId].__closures[funcId]=function(){return Function.__funcs[funcId].apply(Function.__objs[objId],arguments);};}},false);Object.extend(Array.prototype,{push:function(o){this[this.length]=o;},addRange:function(items){if(items.length>0){for(var i=0;i<items.length;i++){this.push(items[i]);}}},clear:function(){this.length=0;return this;},shift:function(){if(this.length==0){return null;}
var o=this[0];for(var i=0;i<this.length-1;i++){this[i]=this[i+1];}
this.length--;return o;}},false);Object.extend(String.prototype,{trimLeft:function(){return this.replace(/^\s*/,"");},trimRight:function(){return this.replace(/\s*$/,"");},trim:function(){return this.trimRight().trimLeft();},endsWith:function(s){if(this.length==0||this.length<s.length){return false;}
return(this.substr(this.length-s.length)==s);},startsWith:function(s){if(this.length==0||this.length<s.length){return false;}
return(this.substr(0,s.length)==s);},split:function(c){var a=[];if(this.length==0)return a;var p=0;for(var i=0;i<this.length;i++){if(this.charAt(i)==c){a.push(this.substring(p,i));p=++i;}}
a.push(s.substr(p));return a;}},false);Object.extend(String,{format:function(s){for(var i=1;i<arguments.length;i++){s=s.replace("{"+(i-1)+"}",arguments[i]);}
return s;},isNullOrEmpty:function(s){if(s==null||s.length==0){return true;}
return false;}},false);if(typeof addEvent=="undefined")
addEvent=function(o,evType,f,capture){if(o==null){return false;}
if(o.addEventListener){o.addEventListener(evType,f,capture);return true;}else if(o.attachEvent){var r=o.attachEvent("on"+evType,f);return r;}else{try{o["on"+evType]=f;}catch(e){}}};if(typeof removeEvent=="undefined")
removeEvent=function(o,evType,f,capture){if(o==null){return false;}
if(o.removeEventListener){o.removeEventListener(evType,f,capture);return true;}else if(o.detachEvent){o.detachEvent("on"+evType,f);}else{try{o["on"+evType]=function(){};}catch(e){}}};
Object.extend(Function.prototype,{getArguments:function(){var args=[];for(var i=0;i<this.arguments.length;i++){args.push(this.arguments[i]);}
return args;}},false);var MS={"Browser":{}};Object.extend(MS.Browser,{isIE:navigator.userAgent.indexOf('MSIE')!=-1,isFirefox:navigator.userAgent.indexOf('Firefox')!=-1,isOpera:window.opera!=null},false);var AjaxPro={};AjaxPro.IFrameXmlHttp=function(){};AjaxPro.IFrameXmlHttp.prototype={onreadystatechange:null,headers:[],method:"POST",url:null,async:true,iframe:null,status:0,readyState:0,responseText:null,abort:function(){},readystatechanged:function(){var doc=this.iframe.contentDocument||this.iframe.document;if(doc!=null&&doc.readyState=="complete"&&doc.body!=null&&doc.body.res!=null){this.status=200;this.statusText="OK";this.readyState=4;this.responseText=doc.body.res;this.onreadystatechange();return;}
setTimeout(this.readystatechanged.bind(this),10);},open:function(method,url,async){if(async==false){alert("Synchronous call using IFrameXMLHttp is not supported.");return;}
if(this.iframe==null){var iframeID="hans";if(document.createElement&&document.documentElement&&(window.opera||navigator.userAgent.indexOf('MSIE 5.0')==-1))
{var ifr=document.createElement('iframe');ifr.setAttribute('id',iframeID);ifr.style.visibility='hidden';ifr.style.position='absolute';ifr.style.width=ifr.style.height=ifr.borderWidth='0px';this.iframe=document.getElementsByTagName('body')[0].appendChild(ifr);}
else if(document.body&&document.body.insertAdjacentHTML)
{document.body.insertAdjacentHTML('beforeEnd','<iframe name="'+iframeID+'" id="'+iframeID+'" style="border:1px solid black;display:none"></iframe>');}
if(window.frames&&window.frames[iframeID]){this.iframe=window.frames[iframeID];}
this.iframe.name=iframeID;this.iframe.document.open();this.iframe.document.write("<html><body></body></html>");this.iframe.document.close();}
this.method=method;this.url=url;this.async=async;},setRequestHeader:function(name,value){for(var i=0;i<this.headers.length;i++){if(this.headers[i].name==name){this.headers[i].value=value;return;}}
this.headers.push({"name":name,"value":value});},getResponseHeader:function(name,value){return null;},addInput:function(doc,form,name,value){var ele;var tag="input";if(value.indexOf("\n")>=0){tag="textarea";}
if(doc.all){ele=doc.createElement("<"+tag+" name=\""+name+"\" />");}else{ele=doc.createElement(tag);ele.setAttribute("name",name);}
ele.setAttribute("value",value);form.appendChild(ele);ele=null;},send:function(data){if(this.iframe==null){return;}
var doc=this.iframe.contentDocument||this.iframe.document;var form=doc.createElement("form");doc.body.appendChild(form);form.setAttribute("action",this.url);form.setAttribute("method",this.method);form.setAttribute("enctype","application/x-www-form-urlencoded");for(var i=0;i<this.headers.length;i++){switch(this.headers[i].name.toLowerCase()){case"content-length":case"accept-encoding":case"content-type":break;default:this.addInput(doc,form,this.headers[i].name,this.headers[i].value);}}
this.addInput(doc,form,"data",data);form.submit();setTimeout(this.readystatechanged.bind(this),0);}};var progids=["Msxml2.XMLHTTP","Microsoft.XMLHTTP"];var progid=null;if(typeof ActiveXObject!="undefined"){var ie7xmlhttp=false;if(typeof XMLHttpRequest=="object"){try{var o=new XMLHttpRequest();ie7xmlhttp=true;}catch(e){}}
if(typeof XMLHttpRequest=="undefined"||!ie7xmlhttp){XMLHttpRequest=function(){var xmlHttp=null;if(!AjaxPro.noActiveX){if(progid!=null){return new ActiveXObject(progid);}
for(var i=0;i<progids.length&&xmlHttp==null;i++){try{xmlHttp=new ActiveXObject(progids[i]);progid=progids[i];}catch(e){}}}
if(xmlHttp==null&&MS.Browser.isIE){return new AjaxPro.IFrameXmlHttp();}
return xmlHttp;};}}
Object.extend(AjaxPro,{noOperation:function(){},onLoading:function(){},onError:function(){},onTimeout:function(){},onStateChanged:function(){},cryptProvider:null,queue:null,token:"",version:"6.10.6.2",ID:"AjaxPro",noActiveX:false,timeoutPeriod:10*1000,queue:null,noUtcTime:false,m:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},toJSON:function(o){if(o==null){return"null";}
var v=[];var i;var c=o.constructor;if(c==Number){return isFinite(o)?o.toString():AjaxPro.toJSON(null);}else if(c==Boolean){return o.toString();}else if(c==String){if(/["\\\x00-\x1f]/.test(o)){o=o.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=AjaxPro.m[b];if(c){return c;}
c=b.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);});}
return'"'+o+'"';}else if(c==Array){for(i=0;i<o.length;i++){v.push(AjaxPro.toJSON(o[i]));}
return"["+v.join(",")+"]";}else if(c==Date){var d={};d.__type="System.DateTime";if(AjaxPro.noUtcTime==true){d.Year=o.getFullYear();d.Month=o.getMonth()+1;d.Day=o.getDate();d.Hour=o.getHours();d.Minute=o.getMinutes();d.Second=o.getSeconds();d.Millisecond=o.getMilliseconds();}else{d.Year=o.getUTCFullYear();d.Month=o.getUTCMonth()+1;d.Day=o.getUTCDate();d.Hour=o.getUTCHours();d.Minute=o.getUTCMinutes();d.Second=o.getUTCSeconds();d.Millisecond=o.getUTCMilliseconds();}
return AjaxPro.toJSON(d);}
if(typeof o.toJSON=="function"){return o.toJSON();}
if(typeof o=="object"){for(var attr in o){if(typeof o[attr]!="function"){v.push('"'+attr+'":'+AjaxPro.toJSON(o[attr]));}}
if(v.length>0){return"{"+v.join(",")+"}";}
return"{}";}
return o.toString();},dispose:function(){if(AjaxPro.queue!=null){AjaxPro.queue.dispose();}}},false);addEvent(window,"unload",AjaxPro.dispose);AjaxPro.Request=function(url){this.url=url;this.xmlHttp=null;};AjaxPro.Request.prototype={url:null,callback:null,onLoading:AjaxPro.noOperation,onError:AjaxPro.noOperation,onTimeout:AjaxPro.noOperation,onStateChanged:AjaxPro.noOperation,args:null,context:null,isRunning:false,abort:function(){if(this.timeoutTimer!=null){clearTimeout(this.timeoutTimer);}
if(this.xmlHttp){this.xmlHttp.onreadystatechange=AjaxPro.noOperation;this.xmlHttp.abort();}
if(this.isRunning){this.isRunning=false;this.onLoading(false);}},dispose:function(){this.abort();},getEmptyRes:function(){return{error:null,value:null,request:{method:this.method,args:this.args},context:this.context,duration:this.duration};},endRequest:function(res){this.abort();if(res.error!=null){this.onError(res.error,this);}
if(typeof this.callback=="function"){this.callback(res,this);}},mozerror:function(){if(this.timeoutTimer!=null){clearTimeout(this.timeoutTimer);}
var res=this.getEmptyRes();res.error={Message:"Unknown",Type:"ConnectFailure",Status:0};this.endRequest(res);},doStateChange:function(){this.onStateChanged(this.xmlHttp.readyState,this);if(this.xmlHttp.readyState!=4||!this.isRunning){return;}
this.duration=new Date().getTime()-this.__start;if(this.timeoutTimer!=null){clearTimeout(this.timeoutTimer);}
var res=this.getEmptyRes();if(this.xmlHttp.status==200&&this.xmlHttp.statusText=="OK"){res=this.createResponse(res);}else{res=this.createResponse(res,true);res.error={Message:this.xmlHttp.statusText,Type:"ConnectFailure",Status:this.xmlHttp.status};}
this.endRequest(res);},createResponse:function(r,noContent){if(!noContent){var responseText=""+this.xmlHttp.responseText;if(AjaxPro.cryptProvider!=null&&typeof AjaxPro.cryptProvider=="function"){responseText=AjaxPro.cryptProvider.decrypt(responseText);}
if(this.xmlHttp.getResponseHeader("Content-Type")=="text/xml"){r.value=this.xmlHttp.responseXML;}else{if(responseText!=null&&responseText.trim().length>0){r.json=responseText;eval("r.value = "+responseText+"*"+"/");}}}
return r;},timeout:function(){this.duration=new Date().getTime()-this.__start;var r=this.onTimeout(this.duration,this);if(typeof r=="undefined"||r!=false){this.abort();}else{this.timeoutTimer=setTimeout(this.timeout.bind(this),AjaxPro.timeoutPeriod);}},invoke:function(method,args,callback,context){this.__start=new Date().getTime();if(this.xmlHttp==null){this.xmlHttp=new XMLHttpRequest();}
this.isRunning=true;this.method=method;this.args=args;this.callback=callback;this.context=context;var async=typeof(callback)=="function"&&callback!=AjaxPro.noOperation;if(async){if(MS.Browser.isIE){this.xmlHttp.onreadystatechange=this.doStateChange.bind(this);}else{this.xmlHttp.onload=this.doStateChange.bind(this);this.xmlHttp.onerror=this.mozerror.bind(this);}
this.onLoading(true);}
var json=AjaxPro.toJSON(args)+"";if(AjaxPro.cryptProvider!=null){json=AjaxPro.cryptProvider.encrypt(json);}
this.xmlHttp.open("POST",this.url,async);this.xmlHttp.setRequestHeader("Content-Type","text/plain; charset=utf-8");this.xmlHttp.setRequestHeader("X-"+AjaxPro.ID+"-Method",method);if(AjaxPro.token!=null&&AjaxPro.token.length>0){this.xmlHttp.setRequestHeader("X-"+AjaxPro.ID+"-Token",AjaxPro.token);}
if(!MS.Browser.isIE){this.xmlHttp.setRequestHeader("Connection","close");}
this.timeoutTimer=setTimeout(this.timeout.bind(this),AjaxPro.timeoutPeriod);try{this.xmlHttp.send(json);}catch(e){}
if(!async){return this.createResponse({error:null,value:null});}
return true;}};AjaxPro.RequestQueue=function(conc){this.queue=[];this.requests=[];this.timer=null;if(isNaN(conc)){conc=2;}
for(var i=0;i<conc;i++){this.requests[i]=new AjaxPro.Request();this.requests[i].callback=function(res){var r=res.context;res.context=r[3][1];r[3][0](res,this);};this.requests[i].callbackHandle=this.requests[i].callback.bind(this.requests[i]);}};AjaxPro.RequestQueue.prototype={process:function(){this.timer=null;if(this.queue.length==0){return;}
for(var i=0;i<this.requests.length&&this.queue.length>0;i++){if(this.requests[i].isRunning==false){var r=this.queue.shift();this.requests[i].url=r[0];this.requests[i].onLoading=r[3].length>2&&r[3][2]!=null&&typeof r[3][2]=="function"?r[3][2]:AjaxPro.onLoading;this.requests[i].onError=r[3].length>3&&r[3][3]!=null&&typeof r[3][3]=="function"?r[3][3]:AjaxPro.onError;this.requests[i].onTimeout=r[3].length>4&&r[3][4]!=null&&typeof r[3][4]=="function"?r[3][4]:AjaxPro.onTimeout;this.requests[i].onStateChanged=r[3].length>5&&r[3][5]!=null&&typeof r[3][5]=="function"?r[3][5]:AjaxPro.onStateChanged;this.requests[i].invoke(r[1],r[2],this.requests[i].callbackHandle,r);r=null;}}
if(this.queue.length>0&&this.timer==null){this.timer=setTimeout(this.process.bind(this),0);}},add:function(url,method,args,e){this.queue.push([url,method,args,e]);this.process();},abort:function(){this.queue.length=0;if(this.timer!=null){clearTimeout(this.timer);}
this.timer=null;for(var i=0;i<this.requests.length;i++){if(this.requests[i].isRunning==true){this.requests[i].abort();}}},dispose:function(){for(var i=0;i<this.requests.length;i++){var r=this.requests[i];r.dispose();}
this.requests.clear();}};AjaxPro.queue=new AjaxPro.RequestQueue(2);AjaxPro.AjaxClass=function(url){this.url=url;};AjaxPro.AjaxClass.prototype={invoke:function(method,args,e){if(e!=null){if(e.length!=6){for(;e.length<6;){e.push(null);}}
if(e[0]!=null&&typeof(e[0])=="function"){return AjaxPro.queue.add(this.url,method,args,e);}}
var r=new AjaxPro.Request();r.url=this.url;return r.invoke(method,args);}};
if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.NameValueCollection=="undefined")Ajax.Web.NameValueCollection={};Ajax.Web.NameValueCollection=function(items){this.__type="System.Collections.Specialized.NameValueCollection";this.keys=[];this.values=[];if(items!=null&&!isNaN(items.length)){for(var i=0;i<items.length;i++)
this.add(items[i][0],items[i][1]);}};Object.extend(Ajax.Web.NameValueCollection.prototype,{add:function(k,v){if(k==null||k.constructor!=String||v==null||v.constructor!=String)
return-1;this.keys.push(k);this.values.push(v);return this.values.length-1;},containsKey:function(key){for(var i=0;i<this.keys.length;i++){if(this.keys[i]==key)return true;}
return false;},getKeys:function(){return this.keys;},getValue:function(k){for(var i=0;i<this.keys.length&&i<this.values.length;i++){if(this.keys[i]==k)return this.values[i];}
return null;},setValue:function(k,v){if(k==null||k.constructor!=String||v==null||v.constructor!=String)
return-1;for(var i=0;i<this.keys.length&&i<this.values.length;i++){if(this.keys[i]==k)this.values[i]=v;return i;}
return this.add(k,v);},toJSON:function(){return AjaxPro.toJSON({__type:this.__type,keys:this.keys,values:this.values});}},true);if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.DataSet=="undefined")Ajax.Web.DataSet={};Ajax.Web.DataSet=function(t){this.__type="System.Data.DataSet,System.Data";this.Tables=[];this.addTable=function(t){this.Tables.push(t);};if(t!=null){for(var i=0;i<t.length;i++){this.addTable(t[i]);}}};if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.DataTable=="undefined")Ajax.Web.DataTable={};Ajax.Web.DataTable=function(c,r){this.__type="System.Data.DataTable,System.Data";this.Columns=[];this.Rows=[];this.addColumn=function(name,type){this.Columns.push({Name:name,__type:type});};this.toJSON=function(){var dt={};var i;dt.Columns=[];for(i=0;i<this.Columns.length;i++)
dt.Columns.push([this.Columns[i].Name,this.Columns[i].__type]);dt.Rows=[];for(i=0;i<this.Rows.length;i++){var row=[];for(var j=0;j<this.Columns.length;j++)
row.push(this.Rows[i][this.Columns[j].Name]);dt.Rows.push(row);}
return AjaxPro.toJSON(dt);};this.addRow=function(row){this.Rows.push(row);};if(c!=null){for(var i=0;i<c.length;i++)
this.addColumn(c[i][0],c[i][1]);}
if(r!=null){for(var y=0;y<r.length;y++){var row={};for(var z=0;z<this.Columns.length&&z<r[y].length;z++)
row[this.Columns[z].Name]=r[y][z];this.addRow(row);}}};if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.Profile=="undefined")Ajax.Web.Profile={};Ajax.Web.Profile=function(){this.toJSON=function(){throw"Ajax.Web.Profile cannot be converted to JSON format.";};this.setProperty_callback=function(res){};this.setProperty=function(name,object){this[name]=object;AjaxPro.Services.Profile.SetProfile({name:o},this.setProperty_callback.bind(this));};};if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.Dictionary=="undefined")Ajax.Web.Dictionary={};Ajax.Web.Dictionary=function(type,items){this.__type=type;this.keys=[];this.values=[];if(items!=null&&!isNaN(items.length)){for(var i=0;i<items.length;i++)
this.add(items[i][0],items[i][1]);}};Object.extend(Ajax.Web.Dictionary.prototype,{add:function(k,v){this.keys.push(k);this.values.push(v);return this.values.length-1;},containsKey:function(key){for(var i=0;i<this.keys.length;i++){if(this.keys[i]==key)return true;}
return false;},getKeys:function(){return this.keys;},getValue:function(key){for(var i=0;i<this.keys.length&&i<this.values.length;i++){if(this.keys[i]==key){return this.values[i];}}
return null;},setValue:function(k,v){for(var i=0;i<this.keys.length&&i<this.values.length;i++){if(this.keys[i]==k){this.values[i]=v;}
return i;}
return this.add(k,v);},toJSON:function(){return AjaxPro.toJSON({__type:this.__type,keys:this.keys,values:this.values});}},true);
if(typeof Handlers=="undefined")Handlers={};if(typeof Handlers.Search=="undefined")Handlers.Search={};Handlers.Search_class=function(){};Object.extend(Handlers.Search_class.prototype,Object.extend(new AjaxPro.AjaxClass(),{GetStates:function(){return this.invoke("GetStates",{},this.GetStates.getArguments().slice(0));},GetCities:function(state){return this.invoke("GetCities",{"state":state},this.GetCities.getArguments().slice(1));},GetCuisines:function(){return this.invoke("GetCuisines",{},this.GetCuisines.getArguments().slice(0));},url:'/ajaxpro/Handlers.Search,App_Code.ashx'}));Handlers.Search=new Handlers.Search_class();
if(typeof Handlers=="undefined")Handlers={};if(typeof Handlers.Profiles=="undefined")Handlers.Profiles={};Handlers.Profiles_class=function(){};Object.extend(Handlers.Profiles_class.prototype,Object.extend(new AjaxPro.AjaxClass(),{GetAddressCheckoutInfo:function(){return this.invoke("GetAddressCheckoutInfo",{},this.GetAddressCheckoutInfo.getArguments().slice(0));},GetCreditCardCheckoutInfo:function(){return this.invoke("GetCreditCardCheckoutInfo",{},this.GetCreditCardCheckoutInfo.getArguments().slice(0));},IsEmailInUse:function(email){return this.invoke("IsEmailInUse",{"email":email},this.IsEmailInUse.getArguments().slice(1));},GetFrequentDinerPointsForRestaurant:function(restId){return this.invoke("GetFrequentDinerPointsForRestaurant",{"restId":restId},this.GetFrequentDinerPointsForRestaurant.getArguments().slice(1));},DismissOrderCompletedHelper:function(){return this.invoke("DismissOrderCompletedHelper",{},this.DismissOrderCompletedHelper.getArguments().slice(0));},DismissCreditCardPageHelper:function(){return this.invoke("DismissCreditCardPageHelper",{},this.DismissCreditCardPageHelper.getArguments().slice(0));},url:'/ajaxpro/Handlers.Profiles,App_Code.ashx'}));Handlers.Profiles=new Handlers.Profiles_class();
function OrderTypeNAddress
(divRadioContainerId,inputRadioId,divDisappearingId,selectChooseId,imgEditButtonId,pDisplayId,modalPopupId,ifrmPopupId,popupUrl,selectedId,valueField)
{if(divRadioContainerId){var radioContainer=document.getElementById(divRadioContainerId);FormUtil.checkFirstRadioIfNoneChecked(radioContainer);}
if(inputRadioId)
this._delRadio=document.getElementById(inputRadioId);if(selectChooseId)
this._addresses=document.getElementById(selectChooseId);CheckoutNav.addPageValidation(new Delegate(this._isPageValid,this));this._she=new ShowHideEdit(divRadioContainerId,inputRadioId,divDisappearingId,selectChooseId,imgEditButtonId,pDisplayId,modalPopupId,ifrmPopupId,popupUrl,selectedId,valueField,"Address",this._getAddresses);}
OrderTypeNAddress.prototype={_isPageValid:function()
{if(this._delRadio&&this._delRadio.checked)
{var selected=this._addresses.options[this._addresses.selectedIndex];if(""==selected.value||"NEW"==selected.value){alert("Please choose a valid address to continue.");return false;}
else if(selected.serverVal)
{var isValid=selected.serverVal.isValid();if(!isValid)
alert("Please choose a valid address to continue.");return isValid;}}
else
return true;},_getAddresses:function()
{var ret=Handlers.Profiles.GetAddressCheckoutInfo();if(ret.error||!ret.value||2!=ret.value.length)
{throw new Error(0,"Could not get addresses.");}
var addresses=ret.value[0];var supplemental=ret.value[1];if(null==addresses)
return[];if(supplemental)
for(var idxCombined=addresses.length-1;idxCombined>=0;idxCombined--)
{var address=addresses[idxCombined];var supplement=supplemental[idxCombined];Object.extend(address,supplement);}
return addresses;}};function PayTypeNCreditCards
(divRadioContainerId,inputRadioId,divDisappearingId,selectChooseId,imgEditButtonId,pDisplayId,modalPopupId,ifrmPopupId,popupUrl,selectedId,chkDiffPersonId,txtDiffPersonId)
{if(divRadioContainerId){var radioContainer=document.getElementById(divRadioContainerId);FormUtil.checkFirstRadioIfNoneChecked(radioContainer);}
if(inputRadioId)
this._ccRadio=document.getElementById(inputRadioId);if(selectChooseId)
this._creditCards=document.getElementById(selectChooseId);CheckoutNav.addPageValidation(new Delegate(this._isPageValid,this));this._she=new ShowHideEdit(divRadioContainerId,inputRadioId,divDisappearingId,selectChooseId,imgEditButtonId,pDisplayId,modalPopupId,ifrmPopupId,popupUrl,selectedId,"id","Credit Card",this._getCreditCards);this._chkDiffPerson=document.getElementById(chkDiffPersonId);this._txtDiffPerson=document.getElementById(txtDiffPersonId);this._init();}
PayTypeNCreditCards.prototype={_isPageValid:function()
{if(this._ccRadio&&this._ccRadio.checked)
{var selected=this._creditCards.options[this._creditCards.selectedIndex];if(""==selected.value||"NEW"==selected.value){alert("Please choose a valid credit card to continue.");return false;}
else if(selected.serverVal)
{var isValid=selected.serverVal.isValid();if(!isValid)
alert("Please choose a valid credit card to continue.");return isValid;}}
else
return true;return false;},_init:function()
{Event.addDomEventListener(this._chkDiffPerson,"click",this._chkDiffClicked,this);this._txtDiffPerson.disabled=!this._chkDiffPerson.checked;this._txtDiffPerson.className=(this._chkDiffPerson.checked?"":"GreyOut");},_getCreditCards:function()
{var ret=Handlers.Profiles.GetCreditCardCheckoutInfo();if(ret.error||!ret.value||2!=ret.value.length)
throw new Error(0xbadf00d,"Could not get credit cards.");var cards=ret.value[0];var supplemental=ret.value[1];if(!cards||!supplemental||cards.length!=supplemental.length)
return[];for(var idxCombined=cards.length-1;idxCombined>=0;idxCombined--)
{var card=cards[idxCombined];var supplement=supplemental[idxCombined];Object.extend(card,supplement);}
return cards;},_chkDiffClicked:function(evt)
{this._txtDiffPerson.disabled=!this._chkDiffPerson.checked;if(this._chkDiffPerson.checked)
{this._txtDiffPerson.className="";this._txtDiffPerson.focus();}
else
this._txtDiffPerson.className="GreyOut";}};function ShowHideEdit
(divRadioContainerId,radioHideShowId,divDisappearingId,selectChooseId,btnEditId,chooseDisplayId,modalPopupId,ifrmPopupId,popupUrl,selectedId,valueField,labelValue,getChooseValuesFn)
{if(divRadioContainerId)
this._radioContainer=document.getElementById(divRadioContainerId);if(radioHideShowId)
this._radioHideShow=document.getElementById(radioHideShowId);if(divDisappearingId)
this._divDisappearing=document.getElementById(divDisappearingId);this._selectChoose=document.getElementById(selectChooseId);this._btnEdit=document.getElementById(btnEditId);if(chooseDisplayId)
this._chooseDisplay=document.getElementById(chooseDisplayId);this._modalPopup=document.getElementById(modalPopupId);this._ifrmPopup=document.getElementById(ifrmPopupId);this._popupUrl=popupUrl;this._selectedId=selectedId;if(!valueField)
valueField="id";this._valueField=valueField;this._labelValue=labelValue;this._getChooseValuesFn=getChooseValuesFn;this.init();}
ShowHideEdit.prototype={init:function()
{Event.addDomEventListener(this._btnEdit,"click",this._editClick,this);if(this._radioContainer)
Event.addDomEventListener(this._radioContainer,"click",this._containerClick,this);if(!this._radioContainer||(this._radioHideShow&&this._radioHideShow.checked))
this._showPanel();},close:function(cbId,shouldRefresh)
{Callback.removeValue(cbId);this._ifrmPopup.src='';ModalPopupPanel.hide(this._modalPopup);var val=this._selectChoose.options[this._selectChoose.selectedIndex].value;var ids=[];if("NEW"==val)
{var children=this._selectChoose.childNodes;for(var idxChildren=children.length-1;idxChildren>=0;idxChildren--)
{var option=children[idxChildren];if(""!=option.value&&"NEW"!=option.value)
ids.push(option.value);}
ids.sort();}
else if(""!=val)
this._selectedId=val;this._buildSelectAndGetData();if("NEW"==val)
{var children=this._selectChoose.childNodes;for(var idxChildren=children.length-1;idxChildren>=0;idxChildren--)
{var option=children[idxChildren];if(""!=option.value&&"NEW"!=option.value)
{var found=false;for(var idxId=ids.length-1;idxId>=0;idxId--)
{var id=ids[idxId];if(option.value==id)
{ids=ids.splice(idxId,1);found=true;break;}}
if(!found)
{option.selected=true;break;}}}}},_showPanel:function()
{if(this._divDisappearing&&'block'!=this._divDisappearing.style.display)
{this._divDisappearing.style.display='block';}
if(!this._isAppInitialized)
this._initializeApp();},_hidePanel:function()
{if(this._divDisappearing&&'none'!=this._divDisappearing.style.display)
this._divDisappearing.style.display='none';},_initializeApp:function()
{var select=this._selectChoose;Event.addDomEventListener(select,"change",this._saChangeUpdateSelectedState,this);this._buildSelectAndGetData();},_buildSelectAndGetData:function()
{var select=this._selectChoose;select.innerHTML="";Build.option(select,"","Select an "+this._labelValue+"...","",false);Build.option(select,"","*Enter a New "+this._labelValue+"*","NEW",false);this._chooseOptions=this._getChooseValuesFn();if(0<this._chooseOptions.length)
Build.option(select,"","_____________________","",false);var selectedId=null;if(this._selectedId&&""!=this._selectedId)
{for(var idxChooseOptions=this._chooseOptions.length-1;idxChooseOptions>=0;idxChooseOptions--)
if(this._selectedId==this._chooseOptions[idxChooseOptions][this._valueField])
{selectedId=this._selectedId;break;}}
for(var idxChooseOptions=this._chooseOptions.length-1;idxChooseOptions>=0;idxChooseOptions--)
{var chooseOption=this._chooseOptions[idxChooseOptions];var o=Build.option(select,"",chooseOption.toCompactString(),chooseOption[this._valueField],(!selectedId&&chooseOption.isDefault)||(selectedId&&selectedId==chooseOption[this._valueField]));o.serverVal=chooseOption;if(null==selectedId&&chooseOption.isDefault)
selectedId=chooseOption[this._valueField];}
if(!selectedId)
this._clearChoose();else
this._displayChoose(selectedId);this._isAppInitialized=true;},_showPopup:function(urlSuffix)
{var cbId=Callback.addValue(this);this._ifrmPopup.src=this._popupUrl+"?key="+cbId+"&"+urlSuffix;ModalPopupPanel.show(this._modalPopup);},_clearChoose:function()
{if(this._chooseDisplay)
this._chooseDisplay.innerHTML="";this._btnEdit.className="GreyOut";},_displayChoose:function(chooseId)
{this._btnEdit.className="";if(!this._chooseDisplay)
return;var chooseOptionToUse=null;for(var idxChooseOptions=this._chooseOptions.length-1;idxChooseOptions>=0;idxChooseOptions--)
{var chooseOption=this._chooseOptions[idxChooseOptions];if(chooseId==chooseOption[this._valueField])
{chooseOptionToUse=chooseOption;break;}}
if(!chooseOptionToUse)
throw new Error(0,"This should not happen, the selected value was not found in the choose option list.");this._chooseDisplay.innerHTML=chooseOptionToUse.toString();},_containerClick:function(evt)
{if(this._radioHideShow&&this._radioHideShow.checked)
this._showPanel();else
this._hidePanel();},_saChangeUpdateSelectedState:function(evt)
{var val=this._selectChoose[this._selectChoose.selectedIndex].value;if(""==val)
this._clearChoose();else if("NEW"==val)
{this._clearChoose();this._showPopup('');}
else
this._displayChoose(val);},_editClick:function(evt)
{var val=this._selectChoose.value;if(null==val||""==val||"NEW"==val)
alert("Please choose an "+this._labelValue+" to edit.");else
this._showPopup('P='+val);}};function OrderTimeNContacts
(rdoNowId,rdoLaterId,rdoTodayId,rdoTomorrowId,selectHourId,selectMinuteId,selectAmPmId,spanForLaterPanelId,firstAvailableTime_R,restUtcOffset,hoursControlId)
{this.rdoNow=document.getElementById(rdoNowId);this.rdoLater=document.getElementById(rdoLaterId);this.rdoToday=document.getElementById(rdoTodayId);this.rdoTomorrow=document.getElementById(rdoTomorrowId);this.selectHour=document.getElementById(selectHourId);this.selectMinute=document.getElementById(selectMinuteId);this.selectAmPm=document.getElementById(selectAmPmId);this.forLaterPanel=document.getElementById(spanForLaterPanelId);this.restUtcOffset=restUtcOffset;this.hoursDisplay=new RestaurantHours(hoursControlId);this.firstAvailableTime_R=firstAvailableTime_R.toNewTimezone(restUtcOffset);this._init();}
OrderTimeNContacts.prototype={_init:function()
{this._enableDisableForLater();Event.addDomEventListener(this.rdoNow,"click",this._rdoNowOrLaterClick,this);Event.addDomEventListener(this.rdoLater,"click",this._rdoNowOrLaterClick,this);Event.addDomEventListener(this.rdoToday,"click",this._rdoTodayOrTomorrowClick,this);Event.addDomEventListener(this.rdoTomorrow,"click",this._rdoTodayOrTomorrowClick,this);Event.addDomEventListener(this.selectHour,"change",this._timeChanged,this);Event.addDomEventListener(this.selectMinute,"change",this._timeChanged,this);Event.addDomEventListener(this.selectAmPm,"change",this._timeChanged,this);},_enableDisableForLater:function()
{var notLater=!this.rdoLater.checked;this.rdoToday.disabled=notLater;this.rdoTomorrow.disabled=notLater;this.selectHour.disabled=notLater;this.selectMinute.disabled=notLater;this.selectAmPm.disabled=notLater;this.forLaterPanel.className=(notLater?"GreyOut":"");this._setHoursTodayOrTomorrow();},_setHoursTodayOrTomorrow:function()
{var now=new Date();var orderDay=new Date(now.getFullYear(),now.getMonth(),now.getDate()+(this.rdoLater.checked&&this.rdoTomorrow.checked?1:0));this.hoursDisplay.makeDayActive(orderDay.getDay());},_isTimeChangeValid:function(shouldAlert)
{var requested_R=this._getCtlsTime_R();var firstAvailableTime_R=this.firstAvailableTime_R.copy();if(requested_R<firstAvailableTime_R)
{var currTimeTo5Min_R=firstAvailableTime_R.copy();var minutes=currTimeTo5Min_R.getMinutes();currTimeTo5Min_R.setMinutes((Math.floor((minutes+4)/5))*5);this._setCtlsToTime(currTimeTo5Min_R);if(shouldAlert)
{var now_R=(new Date()).toNewTimezone(this.restUtcOffset);var hoursMod12=currTimeTo5Min_R.getHours()%12;alert("You may not order before "
+(0==hoursMod12?12:hoursMod12)+":"
+("0"+currTimeTo5Min_R.getMinutes()).slice(-2)
+(currTimeTo5Min_R.getDate()==now_R.getDate()?" today":" tomorrow"));}}},_getCtlsTime_R:function()
{var hour=parseInt(this.selectHour.value);var minute=parseInt(this.selectMinute.value);var amPm=this.selectAmPm.value;var isTomorrow=this.rdoTomorrow.checked;var now_R=(new Date()).toNewTimezone(this.restUtcOffset);return new Date(now_R.getFullYear(),now_R.getMonth(),now_R.getDate()+(isTomorrow?1:0),hour+("PM"==amPm&&hour!=12?12:0),minute);},_setCtlsToTime:function(newTime)
{var now_R=(new Date()).toNewTimezone(this.restUtcOffset);var hours=newTime.getHours();var hoursMod12=hours%12;FormUtil.selectSelectOption(this.selectHour,(0==hoursMod12?12:hoursMod12));var hoursDiv12=Math.floor(hours/12);FormUtil.selectSelectOption(this.selectAmPm,(0==hoursDiv12?"AM":"PM"));FormUtil.selectSelectOption(this.selectMinute,newTime.getMinutes());var isToday=now_R.getDate()==newTime.getDate();this.rdoToday.checked=isToday;this.rdoTomorrow.checked=!isToday;},_rdoNowOrLaterClick:function(evt)
{this._enableDisableForLater();},_timeChanged:function(evt)
{this._isTimeChangeValid(true);},_rdoTodayOrTomorrowClick:function(evt)
{this._setHoursTodayOrTomorrow();this._isTimeChangeValid(true);}};function ErrorBar(divId,barId)
{this._div=document.getElementById(divId);this._div.ebInstance=this;this._bar=document.getElementById(barId);this._intervalSize=110;this._maxInterval=10;this._init(this._intervalSize);}
ErrorBar.prototype={_init:function(interval)
{this._cbId=Callback.addValue(this);this._intervalId=setInterval("Callback.getValue("+this._cbId+")._nextInterval()",interval);this._currentInterval=1;},_nextInterval:function()
{this._bar.style.height=Math.pow(this._currentInterval/this._maxInterval,2)*100+'%';if(++this._currentInterval>this._maxInterval)
{clearInterval(this._intervalId);Callback.removeValue(this._cbId);}}};function TipCalculator(txtTipId,txtTotalId,txtPercentageId,rdoCustom,subTotal,total,tip)
{this._tips=[];this._totals=[];this._percentages=[];this._rdoCustom=document.getElementById(rdoCustom);this._subTotal=subTotal;this._total=total;this._init(txtTipId,txtTotalId,txtPercentageId,tip);}
TipCalculator.prototype={addTip:function(tipId)
{var tip=document.getElementById(tipId);if(!tip)
return;Event.addDomEventListener(tip,"change",this._tipUpdated,this);this._tips.push(tip);tip.value=this._tips[0].value;},addTotal:function(totalId)
{var total=document.getElementById(totalId);if(!total)
return;Event.addDomEventListener(total,"change",this._totalUpdated,this);this._totals.push(total);total.value=this._totals[0].value;},addPercentage:function(percentageId)
{var percentage=document.getElementById(percentageId);if(!percentage)
return;Event.addDomEventListener(percentage,"change",this._percentageUpdated,this);this._percentages.push(percentage);percentage.value=this._percentages[0].value;},setTip:function(tipVal)
{tipVal=this._round(tipVal,2);this._setTips(tipVal.toFixed(2));this._setTotals(this._round(this._total+tipVal,2).toFixed(2));var percVal='0';if(0!=tipVal)
{var perc=tipVal/this._subTotal*100;perc=this._round(perc,1);percVal=perc.toString();}
this._setPercentages(percVal);},_init:function(txtTipId,txtTotalId,txtPercentageId,tip)
{this.addTip(txtTipId);this.addTotal(txtTotalId);this.addPercentage(txtPercentageId);this.setTip(tip);if(this._rdoCustom)
Event.addDomEventListener(this._rdoCustom,"click",this._customClick,this);},_setTips:function(tipVal)
{for(var idxTips=this._tips.length-1;idxTips>=0;idxTips--)
this._tips[idxTips].value=tipVal;},_setTotals:function(totalVal)
{for(var idxTotals=this._totals.length-1;idxTotals>=0;idxTotals--)
this._totals[idxTotals].value=totalVal;},_setPercentages:function(percentage)
{for(var idxPercentages=this._percentages.length-1;idxPercentages>=0;idxPercentages--)
this._percentages[idxPercentages].value=percentage;},_checkCustomRadio:function()
{var custom=this._rdoCustom;if(custom)
custom.checked=1;},_round:function(toRound,numberOfDecimalPlaces)
{var powerOfTen=Math.pow(10,numberOfDecimalPlaces);return Math.round(toRound*powerOfTen)/powerOfTen;},_tipUpdated:function(evt)
{var tipVal=Number(evt.target.value);if(isNaN(tipVal))
return;this.setTip(tipVal);this._checkCustomRadio();},_totalUpdated:function(evt)
{var totalVal=Number(evt.target.value);if(isNaN(totalVal)||totalVal>(1.5*this._total))
return;if(totalVal<this._total)
{totalVal=this._total;this.value=totalVal;}
var tipVal=totalVal-this._total;this.setTip(tipVal);this._checkCustomRadio();},_percentageUpdated:function(evt)
{var percVal=Number(evt.target.value);if(isNaN(percVal)||percVal>99.9||percVal<0)
return;var tipVal=(percVal/100)*this._subTotal;this.setTip(tipVal);this._checkCustomRadio();},_customClick:function(evt)
{if(evt.target.checked)
this._txtTip.focus();}};function MiscInfo(txtSiId,defaultText,numDinersId)
{this._txtSi=document.getElementById(txtSiId);this._defaultText=defaultText;this._init(numDinersId);}
MiscInfo.prototype={_init:function(numDinersId)
{this._txtSi.mi=this;Event.addDomEventListener(this._txtSi,"focus",this._siFocus,this);Event.addDomEventListener(this._txtSi,"blur",this._siBlur,this);txtND=document.getElementById(numDinersId);txtND.setAttribute("min",1);Event.addDomEventListener(txtND,"keydown",this._numDiners_keydown,this);Event.addDomEventListener(txtND,"focus",function(evt){evt.currentTarget.select();});},_siFocus:function(evt)
{if(this._defaultText==evt.target.value)
evt.target.value="";},_siBlur:function(evt)
{if(""==evt.target.value)
evt.target.value=this._defaultText;},_numDiners_keydown:function(evt)
{TextUtil.numericScroll(evt.currentTarget,evt);CheckoutNav.markDirty();}};function TransmissionDetails(orderId)
{this._oid=orderId;this._start=new Date();this._estimate=300;this._isComplete=false;this._stepIds=[null,document.getElementById('TS_Submitted'),document.getElementById('TS_Transmitting'),document.getElementById('TS_Verifying'),document.getElementById('TS_Finished')];this._stepExplanationIds=[document.getElementById('TSE_Error'),document.getElementById('TSE_Submitted'),document.getElementById('TSE_Transmitting'),document.getElementById('TSE_Verifying'),document.getElementById('TSE_Finished')];this._callNumberAdded=0;this._init();}
TransmissionDetails.prototype={_init:function()
{this._estimateDisplay=document.getElementById('EstimatedTime');this._transDetails=document.getElementById('TransDetails');this._estimateDisplayUpdateId=Callback.startInterval(1000,this,null,new Delegate(this._updateEstimateDisplay,this));this._updateState();this._updateStateId=Callback.startInterval(15000,this,null,new Delegate(this._updateState,this));},_updateEstimateDisplay:function(sender,args,cbId)
{if(this._isComplete)
return;var startTicks=this._start.getTime();var nowTicks=(new Date()).getTime();var elapsed=(nowTicks-startTicks)/1000;var secondsLeft=this._estimate-elapsed;if(secondsLeft<5)
{this._estimate+=(0>=secondsLeft?0-secondsLeft:0)+30;}
if(secondsLeft<=0)
secondsLeft=1;var m=Math.floor(secondsLeft/60);var s=Math.floor(secondsLeft%60);this._estimateDisplay.innerHTML=m.toString()+":"+("0"+s.toString()).slice(-2);},_updateState:function()
{var ret=Handlers.OrderStatuses.GetOrderCompletionStatus(this._oid)
if(!ret.value)
this._errorOccurred();var state=ret.value;state.isAnySuccessful=this._isAnySuccessful;var stateIdx=0;for(var idx=2;idx<=7;idx++)
{if(1==(state.Status/Math.pow(2,idx))%2)
{stateIdx=idx-2+1;break;}}
if(3==stateIdx&&!state.isAnySuccessful())
stateIdx=2;this._setState(stateIdx);var isTransOrVer=(0!=(0x18&state.Status));if(isTransOrVer&&state.Transmissions&&0!=state.Transmissions.length)
{var idxOfLastTrans=state.Transmissions.length-1;if(!state.isAnySuccessful()&&1!=state.Transmissions[idxOfLastTrans].CallNumber)
{var currCallNumber=(idxOfLastTrans*4)+state.Transmissions[idxOfLastTrans].CallNumber;if(currCallNumber>this._callNumberAdded)
{this._estimate+=state.Transmissions[idxOfLastTrans].Duration;this._callNumberAdded=currCallNumber;}}}
var detailsTextArr=new StringBuilder("Processing order for transmission to the restaurant");switch(state.Status)
{case 0x8:detailsTextArr.append(this._getTransDetails(state.Transmissions));break;case 0x10:detailsTextArr.append(this._getTransDetails(state.Transmissions));if(state.isAnySuccessful())
detailsTextArr.append("<br />Fax transmission succeeded.");break;case 0x20:detailsTextArr.append(this._getTransDetails(state.Transmissions));detailsTextArr.append("<br />Fax transmission succeeded.<br />Your order was successful! Thank you for using 2GoClub.");break;case 0x40:detailsTextArr.append(this._getTransDetails(state.Transmissions));detailsTextArr.append("<br />Fax transmission succeeded.<br />Your order has been cancelled. You will recieve an email shortly explaining the cancellation.");break;}
this._transDetails.innerHTML=detailsTextArr.toString();if(0!=(state.Status&0x60))
this._finished();},_getTransDetails:function(transmissions)
{var length=transmissions.length;var sb=new StringBuilder();for(var idx=0;idx<length;idx++)
{var trans=transmissions[idx];var j=(idx==length-1?1:0);for(;j<trans.CallNumber;j++)
sb.append("<br />Attempting fax to the restaurant. Transmission failed.");}
sb.append("<br />Attempting fax to the restaurant.");return sb.toString();},_setState:function(idx)
{var length=this._stepIds.length;for(var i=1;i<length;i++)
{if(i==idx)
{this._stepExplanationIds[i].className='';this._stepIds[i].className='TransStep'}
else if(i<idx)
{this._stepExplanationIds[i].className='TransStepExplanationHidden';this._stepIds[i].className='TransStep'}
else
{this._stepExplanationIds[i].className='TransStepExplanationHidden';this._stepIds[i].className='TransStep GreyOut'}}},_isAnySuccessful:function()
{var length=this.Transmissions.length;if(0==length)
return false;for(var idx=0;idx<length;idx++)
{var trans=this.Transmissions[idx];if(trans.IsFinished&&trans.HasSucceeded)
return true;}
return false;},_finished:function()
{this._isComplete=true;this._estimateDisplay.innerHTML="Finished";Callback.endInterval(this._estimateDisplayUpdateId);Callback.endInterval(this._updateStateId);},_errorOccurred:function()
{alert('error occurred, finish this function.');},close:function()
{window.close();}};function Receipt()
{var aPR=document.getElementById("aPrintReceipt");if(aPR)
Event.addDomEventListener(aPR,"click",this._printReceipt,this);this._ifrmTransStatus=document.getElementById("ifrmTransStatus");var aToggleTransStatus=document.getElementById("aToggleTransStatus");if(aToggleTransStatus)
Event.addDomEventListener(aToggleTransStatus,"click",this._toggleTransmissionDetails,this);var aShowMap=document.getElementById("aShowMap");if(aShowMap)
Event.addDomEventListener(aShowMap,"click",this._viewMap,this);var aSaveFavorite=document.getElementById("aSaveFavorite");Event.addDomEventListener(aSaveFavorite,"click",this._saveAsFavorite,this);}
Receipt.prototype={_toggleTransmissionDetails:function(evt)
{var display,innerHTML;if("none"==this._ifrmTransStatus.style.display)
{display="block";innerHTML="Hide";}
else
{display="none";innerHTML="Show";}
this._ifrmTransStatus.style.display=display;evt.currentTarget.innerHTML=innerHTML;evt.preventDefault();},_saveAsFavorite:function(evt)
{var link=evt.currentTarget;var parent=link.parentNode;var request=new QueryStringMap;var div=Build.div(parent);new FavoriteSave(div,request['O']);link.className='';Event.removeDomEventListener(link,"click",this._saveAsFavorite,this);evt.preventDefault();},_printReceipt:function(evt)
{newPopupWindow("ReceiptPrint.aspx"+window.location.search,"Receipt for Print");evt.preventDefault();},_viewMap:function(evt)
{alert('view map');evt.preventDefault();}};var CheckoutNav={init:function()
{var inputs=document.getElementsByTagName("input");for(var idxInputs=inputs.length-1;idxInputs>=0;idxInputs--)
{var input=inputs[idxInputs];var isButton="button"==input.type||"image"==input.type;if(!isButton&&"hidden"!=input.type)
Event.addDomEventListener(input,"change",this.markDirty,this);else if(isButton)
{if(input.name.endsWith("btnNext"))
Event.addDomEventListener(input,"click",this.isValid,this);else if("true"!=input.getAttribute("ismodal"))
Event.addDomEventListener(input,"click",this._checkDirty,this);}}
this._assignEvents("textarea","change",this.markDirty,this);this._assignEvents("select","change",this.markDirty,this);this._assignEvents("a","click",this._checkDirty,this);},_assignEvents:function(tagName,evtName,method,This)
{var elems=document.getElementsByTagName(tagName);for(var idx=elems.length-1;idx>=0;idx--)
if("true"!=elems[idx].getAttribute("ismodal"))
Event.addDomEventListener(elems[idx],evtName,method,This);},isValid:function(evt)
{var retVal=true;if(!this._fns)
return true;for(var idxFn=this._fns.length-1;idxFn>=0;idxFn--)
retVal&=this._fns[idxFn].call();if(!retVal&&evt&&evt.preventDefault)
evt.preventDefault();return retVal;},addPageValidation:function(fnDelegate)
{if(!this._fns)
this._fns=[];this._fns.push(fnDelegate);},isDirty:function()
{return(true==this._dirty);},markDirty:function()
{this._dirty=true;},_checkDirty:function(evt)
{if(this.isDirty())
{var stop=!confirm("You have made changes that have not been saved. Use the next step button to save changes. Do you want to continue WITHOUT saving? Press OK to continue.");if(stop)
evt.preventDefault();}}};
var Address=function(addressId,addressName,locationType,businessName,street,suite,city,regionCode,postalCode,phone,email,crossStreet,specialInstructions,isTemporary,isDefaultAddress,hasValidLatLong,geoPointString)
{this.__type='SummitQuest.Web.CommerceServer.Profiles.Address,SummitQuest, Version=1.0.0.1, Culture=neutral, PublicKeyToken=b9428df1529fa578';this.id=addressId;this.isDefault=isDefaultAddress;this.AddressID=addressId;this.AddressName=addressName;this.LocationType=locationType;this.BusinessName=businessName;this.Street=street;this.Suite=suite;this.City=city;this.RegionCode=regionCode;this.PostalCode=postalCode;this.Phone=phone;this.EMail=email;this.CrossStreet=crossStreet;this.SpecialInstructions=specialInstructions;this.IsTemporary=isTemporary;this.IsDefaultAddress=isDefaultAddress;this.HasValidLatLong=hasValidLatLong;this.GeoPointString=geoPointString;};Address.prototype={toJSON:function(){var o=[this.AddressID,this.AddressName,this.LocationType,this.BusinessName,this.Street,this.Suite,this.City,this.RegionCode,this.PostalCode,this.Phone,this.EMail,this.CrossStreet,this.SpecialInstructions,this.IsTemporary,this.IsDefaultAddress];return AjaxPro.toJSON(o);},isValid:function(){return this.IsValid&&DataType.isNumber(this.DeliveryCharge);},toCompactString:function(){var sb=new StringBuilder;sb.append(this.AddressName);sb.append(', ');sb.append(this.Street.slice(0,15));if(15<this.Street.length)
sb.append('...');sb.append(', ');if(this.Suite&&0<this.Suite.length)
{sb.append(this.Suite.slice(0,10));if(10<this.Suite.length)
sb.append('...');sb.append(', ');}
sb.append(this.City.slice(0,5));if(5<this.City.length)
sb.append('...');sb.append(', ');sb.append(this.RegionCode);return sb.toString();},toString:function(){var isValid=DataType.isBoolean(this.IsValid)&&this.IsValid;var sb=new StringBuilder;sb.append(this.AddressName);if(this.IsDefaultAddress)
sb.append(" (Default)");sb.append('<br />');if(!isValid)
sb.append("<span class='InlineError'>According to the restaurant's policy this address is not available for delivery.</span><br /><br />");else if(!DataType.isNumber(this.DeliveryCharge))
sb.append("<span class='InlineError'>According to the restaurant's delivery policy, your order has not met the minimum order amount for delivery at this location. Please purchase more or choose a different delivery location.</span><br /><br />");if(this.BusinessName&&0<this.BusinessName.length)
{sb.append("<span class='AddressLabel'>Location:</span>");sb.append(this.LocationType);sb.append(" - ");sb.append(this.BusinessName);sb.append('<br />');}
sb.append(this.Street);sb.append('<br />');if(this.Suite&&0<this.Suite.length)
{sb.append(this.Suite);sb.append('<br />');}
sb.append(this.City);sb.append(', ');sb.append(this.RegionCode);sb.append('. ');sb.append(this.PostalCode);sb.append('<br />');sb.append('<br />');var isDistanceValid=("number"==typeof this.Distance&&-1!=this.Distance);var isChargeValid=(isValid&&DataType.isNumber(this.DeliveryCharge));if(isDistanceValid)
{sb.append("<span class='AddressLabel'>Distance to Restaurant: </span>");sb.append(this.Distance.toFixed(2));sb.append(" Mi.<br />");}
if(isChargeValid)
{sb.append("<span class='AddressLabel'>Delivery Charge: </span>$");sb.append(this.DeliveryCharge.toFixed(2));sb.append("<br />");}
if(isDistanceValid||isChargeValid)
sb.append("<br />");var isPhoneValid=this.Phone&&0<this.Phone.length;var isEmailValid=this.EMail&&0<this.EMail.length;if(isPhoneValid)
{sb.append("<span class='AddressLabel'>Phone: </span>");sb.append(this.Phone);sb.append('<br />');}
if(isEmailValid)
{sb.append("<span class='AddressLabel'>Email: </span>");sb.append(this.EMail);sb.append('<br />');}
if(this.CrossStreet&&0<this.CrossStreet.length)
{sb.append("<span class='AddressLabel'>Cross Street: </span>");sb.append(this.CrossStreet);sb.append('<br />');}
if(this.SpecialInstructions&&0<this.SpecialInstructions.length)
{sb.append("<span class='AddressLabel'>Comments: </span>");sb.append(this.SpecialInstructions);sb.append('<br />');}
return sb.toString();}};var CreditCard=function(id,cardName,name,cardNumber,expirationMonth,expirationYear,type,isTemporary,isDefault)
{this.__type='SummitQuest.Web.CommerceServer.Profiles.CreditCard,SummitQuest, Version=1.0.0.1, Culture=neutral, PublicKeyToken=b9428df1529fa578';this.id=id;this.isDefault=isDefault;this.Id=id;this.CardName=cardName;this.Name=name;this.CardNumber=cardNumber;this.ExpirationMonth=expirationMonth;this.ExpirationYear=expirationYear;this.Type=type;this.IsTemporary=isTemporary;this.IsDefault=isDefault;};CreditCard.prototype={toJSON:function(){var o=[this.Id,this.CardName,this.Name,this.CardNumber,this.ExpirationMonth,this.ExpirationYear,this.Type,this.IsTemporary,this.IsDefault];return AjaxPro.toJSON(o);},isValid:function(){var date=new Date(this.ExpirationYear,this.ExpirationMonth);date.setSeconds(date.getSeconds()-1);return(date>=new Date());},_formatType:function()
{switch(this.Type)
{case 0x1:return"Visa";case 0x2:return"MC";case 0x4:return"Amex";case 0x8:return"Disc";case 0x10:return"DineC";}},toCompactString:function()
{var sb=new StringBuilder;if(this.CardName&&0<this.CardName.length)
{sb.append(this.CardName);sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");}
sb.append(this._formatType());sb.append("-");sb.append(this.CardNumber.slice(-4));sb.append("&nbsp;&nbsp;&nbsp;");sb.append(("0"+this.ExpirationMonth).slice(-2));sb.append("/");sb.append(("0"+(this.ExpirationYear%100)).slice(-2));return sb.toString();},toString:function()
{var sb=new StringBuilder;if(this.CardName&&0<this.CardName.length)
{sb.append(this.CardName);if(this.IsDefault)
sb.append(" (Default Card)");sb.append("<br />");}
if(DataType.isBoolean(this.IsSupported)&&!this.IsSupported)
{sb.append("<span class='InlineError'>This restaurant does not support ");sb.append(this._formatType());sb.append(" cards.</span><br /><br />");}
if(this.Name&&0<this.Name.length)
{sb.append(this.Name);sb.append("<br />");}
sb.append(this._formatType());sb.append(" ");if(4==this.Type)
sb.append("*****-******-");else
sb.append("****-****-****-");sb.append(this.CardNumber.slice(-4));sb.append(" Exp. ");sb.append(("0"+this.ExpirationMonth).slice(-2));sb.append("/");sb.append(this.ExpirationYear);if(!this.isValid())
sb.append("<br /><span class='InlineError'>This credit card has expired. Please update it with the new number, security code and/or expiration date.</span>");return sb.toString();}};
function SearchNav(rootId,loggedIn,popupId)
{this._initState();this._root=document.getElementById(rootId);var ulTabs=XBrowser.nodeByPath(this._root,[1,0]);this._liTabs=[];for(var idxChild=0;idxChild<ulTabs.childNodes.length;idxChild++)
{var child=ulTabs.childNodes[idxChild];if(1==child.nodeType)
{this._liTabs.push(child);var a=XBrowser.childNode(child,0);a.href="#";Event.addDomEventListener(a,"click",this._setTabPage,this);}}
var contents=XBrowser.childNode(this._root,2);this._divInfoBar=XBrowser.childNode(contents,0);this._infoBarContents=["","This search will give you restaurants that will deliver to your location. Select an address or enter your zip code below.","This search will give you restaurants that are located near you. Select an address or enter your zip code below."];this._ddlStates=XBrowser.nodeByPath(contents,[2,0,1,0]);this._ddlCity=XBrowser.nodeByPath(contents,[2,1,1,0]);this._ddlCuisine=XBrowser.nodeByPath(contents,[2,3,1,0]);this._ddlRadius=XBrowser.nodeByPath(contents,[2,4,1,0]);this._getStates();Event.addDomEventListener(this._ddlStates,"change",this._getCities,this);this._getCuisines();this._setupRadius();var chkDelivery=XBrowser.nodeByPath(contents,[3,0,0]);var chkOnline=XBrowser.nodeByPath(contents,[3,1,0]);var chkFavorites=XBrowser.nodeByPath(contents,[3,2,0]);if(!loggedIn)
{var divFavorites=XBrowser.nodeByPath(contents,[3,2]);chkFavorites.disabled=true;var labelFavorite=XBrowser.childNode(divFavorites,1);Build.text(labelFavorite,"(requires ");var a=Build.a(labelFavorite,null,"#","login");Build.text(labelFavorite,")");Event.addDomEventListener(a,"click",this._login,this);var address=XBrowser.nodeByPath(contents,[1,1]);address.innerHTML="";Build.text(address,"Requires ");a=Build.a(address,null,"#","login");Event.addDomEventListener(a,"click",this._login,this);}
else
{new OrderTypeNAddress(null,null,null,"SelectedAddress","selectedAddressEditButton",null,popupId,"ifrmAddressEditNew","/Account/Address.aspx",SearchState.LatLong.value,"GeoPointString");this._selectAddress=XBrowser.nodeByPath(contents,[1,1,0]);Event.addDomEventListener(this._selectAddress,"change",this._addressUpdated,this);this._setFormProcessingInput([this._selectAddress],[SearchState.LatLong],[[1,2]]);}
this._txtZip=XBrowser.nodeByPath(contents,[2,2,1,0]);this._txtZip.length=10;this._txtZip.setAttribute("validchars","0123456789-\n");this._txtZip.setAttribute("validationexpression","^(\\d{5}(\\-\\d{4})?)?$");Event.addDomEventListener(this._txtZip,"keypress",this._zipUpdated,this);Event.addDomEventListener(this._txtZip,"blur",this._zipBlur,this);this._txtZipError=Build.span(this._txtZip.parentNode,"InlineError","Please enter a valid zip code in the 12345 or 12345-6789 formats.");this._txtZipError.style.display='none';var zipVal=SearchState.Zip.value;if(!DataType.isUndefined(zipVal)&&""!=zipVal)
{this._txtZip.value=SearchState.Zip.value;this._resetAddresses();}
this._btnChange=XBrowser.nodeByPath(contents,[4,0,0]);var search=XBrowser.nodeByPath(contents,[4,1,0]);Event.addDomEventListener(this._btnChange,"click",this._navChange,this);Event.addDomEventListener(search,"click",this._search,this);contents.elemToClick=search;Event.addDomEventListener(contents,"keypress",TextUtil.clickOnEnter);this._setFormProcessingInput([this._ddlStates,this._ddlCity,this._ddlCuisine,this._ddlRadius,chkDelivery,chkOnline,chkFavorites,this._txtZip],[SearchState.State,SearchState.City,SearchState.Cuisine,SearchState.Radius,SearchState.SupportsDelivery,SearchState.OnlineMenusOnly,SearchState.FavoriteRestaurantsSearch,SearchState.Zip],[[-3,-2,-1,0],[-3,-2,-1,0],[-3,-2,-1,0,1,2],[2],[0],[0,1,2],[0,1,2],[1,2],]);this._tabId=~this._tabId;this._navChange();Callback.onload(new Delegate(this._onload,this));}
SearchNav.prototype={_onload:function()
{if("undefined"!=typeof MapHelper&&MapHelper.instance)
MapHelper.instance.addEventListener("onClose",this._map_close,this);},_map_close:function()
{var qsMap=new QueryStringMap();qsMap[SearchState.IsMap.key]=0;this._redirect(qsMap);},_initState:function()
{var tId=parseInt(SearchState.TabId.value);if(isNaN(tId))
tId=-1;this._tabId=tId;},_setFormProcessingInput:function(inputs,keys,validTabs)
{for(var idxArr=keys.length-1;idxArr>=0;idxArr--)
{inputs[idxArr].qsKey=keys[idxArr].key;inputs[idxArr].validTabs=validTabs[idxArr];}},_getStates:function()
{var cb=Callback.getCallback(new Delegate(this._fGetStates,this));Handlers.Search.GetStates(cb[0]);},_fGetStates:function(cbId,ajaxRet)
{var statesOpt=Build.option(this._ddlStates,null,"All","");if(!ajaxRet.error)
for(var idxState=0;idxState<ajaxRet.value.length;idxState++)
Build.option(this._ddlStates,null,ajaxRet.value[idxState]);FormUtil.selectSelectOption(this._ddlStates,SearchState.State.value);this._getCities();Callback.cleanupCallback(cbId);this._resizeDdlLeftRight(this._ddlStates);},_getCities:function()
{this._ddlCity.innerHTML="";var selectedValue=this._ddlStates.options[this._ddlStates.selectedIndex].text;if("All"==selectedValue||!selectedValue)
{this._ddlCity.disabled=true;return;}
this._ddlCity.disabled=false;var cb=Callback.getCallback(new Delegate(this._fGetCities,this));Handlers.Search.GetCities(selectedValue,cb[0]);},_fGetCities:function(cbId,ajaxRet)
{var cityOpt=Build.option(this._ddlCity,null,"All","");if(!ajaxRet.error&&ajaxRet.value)
for(var idxCity=0;idxCity<ajaxRet.value.length;idxCity++)
Build.option(this._ddlCity,null,ajaxRet.value[idxCity]);FormUtil.selectSelectOption(this._ddlCity,SearchState.City.value);if(BrowserDetection.isIE)
this._ddlCity.parentNode.style.width=(this._ddlCity.offsetWidth+2)+"px";Callback.cleanupCallback(cbId);this._resizeDdlLeftRight(this._ddlCity);},_getCuisines:function()
{var cb=Callback.getCallback(new Delegate(this._fGetCuisines,this));Handlers.Search.GetCuisines(cb[0]);},_fGetCuisines:function(cbId,ajaxRet)
{Build.option(this._ddlCuisine,null,"All","");var arr=ajaxRet.value;if(!ajaxRet.error&&arr)
for(var idxCuisine=0;idxCuisine<arr.length;idxCuisine+=2)
Build.option(this._ddlCuisine,null,arr[idxCuisine+1],arr[idxCuisine]);FormUtil.selectSelectOption(this._ddlCuisine,SearchState.Cuisine.value);Callback.cleanupCallback(cbId);this._resizeDdlLeftRight(this._ddlCuisine);},_resizeAllDdls:function()
{this._resizeDdlLeftRight(this._ddlStates);this._resizeDdlLeftRight(this._ddlCity);this._resizeDdlLeftRight(this._ddlCuisine);},_resizeDdlLeftRight:function(ddl)
{if(!BrowserDetection.isIE)
return;var r=ddl.parentNode;var p=r.parentNode;var l=p.firstChild;r.style.width=ddl.offsetWidth+'px';p.style.width=(l.offsetWidth+5+r.offsetWidth)+'px'},_setupRadius:function()
{var arr=[1,2,3,5,7,10,13,15,20,25];for(var idxArr=0;idxArr<arr.length;idxArr++)
{Build.option(this._ddlRadius,null,arr[idxArr],null,(2==idxArr));}
FormUtil.selectSelectOption(this._ddlRadius,SearchState.Radius.value);},_isBasic:function()
{return(0>this._tabId);},_getCurrentQsMap:function()
{var qsMap=new QueryStringMap();var elements=this._root.getElementsByTagName("input");for(var idxElements=elements.length-1;idxElements>=0;idxElements--)
{var elem=elements[idxElements];if("image"==elem.type||"button"==elem.type)
continue;var value="";if(0<=elem.validTabs.binarySearch(this._tabId))
{if("checkbox"==elem.type)
value=elem.checked;else
value=elem.value;}
qsMap[elem.qsKey]=value;}
elements=this._root.getElementsByTagName("select");for(var idxElements=elements.length-1;idxElements>=0;idxElements--)
{var elem=elements[idxElements];var value="";if(0<=elem.validTabs.binarySearch(this._tabId)&&-1!=elem.selectedIndex)
value=elem.options[elem.selectedIndex].value;qsMap[elem.qsKey]=value;}
qsMap[SearchState.TabId.key]=this._tabId;qsMap[SearchState.DeliversToMe.key]=(1==this._tabId);qsMap[SearchState.PageIndex.key]=0;return qsMap;},_resetAddresses:function()
{if(this._selectAddress)
this._selectAddress.selectedIndex=0;},_navChange:function(evt)
{var isBasic=this._isBasic();this._tabId=~this._tabId;if(!isBasic)
{this._root.className="SN C";this._btnChange.innerHTML="Advanced";this._resizeAllDdls();}
else
{this._btnChange.innerHTML="Basic";this._setTabPage();}
if(evt)
evt.currentTarget.blur();},_setTabPage:function(evt)
{var newTabId=this._tabId;if(evt)
{var node=evt.currentTarget;while(null!=node&&"li"!=node.nodeName.toLowerCase())
node=node.parentNode;newTabId=0;for(newTabId=this._liTabs.length-1;newTabId>=0;newTabId--)
if(node==this._liTabs[newTabId])
break;evt.currentTarget.blur();evt.preventDefault();}
for(var idxTab=this._liTabs.length-1;idxTab>=0;idxTab--)
this._liTabs[idxTab].className=(idxTab==newTabId?"Active":"");this._root.className="SN T T"+newTabId;this._divInfoBar.innerHTML=this._infoBarContents[newTabId];this._tabId=newTabId;this._resizeAllDdls();},_addressUpdated:function(evt)
{this._txtZip.value="";},_zipUpdated:function(evt)
{this._resetAddresses();if(!TextUtil.allowChars(this._txtZip,evt,false))
evt.preventDefault();},_zipBlur:function(evt)
{if(!TextUtil.blurBlock2(this._txtZip))
{evt.preventDefault();this._txtZip.focus();this._txtZipError.style.display='inline';}
else
this._txtZipError.style.display='none';},_login:function(evt)
{evt.preventDefault();var qsMap=this._getCurrentQsMap();window.location.assign("Support/Login.aspx?R="+encodeURIComponent("../Search.aspx?"+qsMap.toString()));},_search:function(evt)
{evt.preventDefault();var qsMap=this._getCurrentQsMap();this._redirect(qsMap);},_redirect:function(qsMap)
{window.location.assign('Search.aspx?'+qsMap.toString());}};var SearchState={init:function(argNames,argValues)
{var qsMap=new QueryStringMap();for(var idx=argNames.length-1;idx>=0;idx--)
{this[argNames[idx]]=new this._stateKey(argValues[idx],qsMap);}},_stateKey:function(key,qsMap)
{this.key=key;this.value=qsMap[key];}};
