var Spry;if(!Spry){Spry={};}if(!Spry.Utils){Spry.Utils={};}Spry.Utils.msProgIDs=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];Spry.Utils.createXMLHttpRequest=function(){var _1=null;try{if(window.ActiveXObject){while(!_1&&Spry.Utils.msProgIDs.length){try{_1=new ActiveXObject(Spry.Utils.msProgIDs[0]);}catch(e){_1=null;}if(!_1){Spry.Utils.msProgIDs.splice(0,1);}}}if(!_1&&window.XMLHttpRequest){_1=new XMLHttpRequest();}}catch(e){_1=null;}if(!_1){Spry.Debug.reportError("Failed to create an XMLHttpRequest object!");}return _1;};Spry.Utils.loadURL=function(_2,_3,_4,_5,_6){var _7=new Spry.Utils.loadURL.Request();_7.method=_2;_7.url=_3;_7.async=_4;_7.successCallback=_5;Spry.Utils.setOptions(_7,_6);try{_7.xhRequest=Spry.Utils.createXMLHttpRequest();if(!_7.xhRequest){return null;}if(_7.async){_7.xhRequest.onreadystatechange=function(){Spry.Utils.loadURL.callback(_7);};}_7.xhRequest.open(_7.method,_7.url,_7.async,_7.username,_7.password);if(_7.headers){for(var _8 in _7.headers){_7.xhRequest.setRequestHeader(_8,_7.headers[_8]);}}_7.xhRequest.send(_7.postData);if(!_7.async){Spry.Utils.loadURL.callback(_7);}}catch(e){if(_7.errorCallback){_7.errorCallback(_7);}else{Spry.Debug.reportError("Exception caught while loading "+_3+": "+e);}_7=null;}return _7;};Spry.Utils.loadURL.callback=function(_9){if(!_9||_9.xhRequest.readyState!=4){return;}if(_9.successCallback&&(_9.xhRequest.status==200||_9.xhRequest.status==0)){_9.successCallback(_9);}else{if(_9.errorCallback){_9.errorCallback(_9);}}};Spry.Utils.loadURL.Request=function(){var _a=Spry.Utils.loadURL.Request.props;var _b=_a.length;for(var i=0;i<_b;i++){this[_a[i]]=null;}this.method="GET";this.async=true;this.headers={};};Spry.Utils.loadURL.Request.props=["method","url","async","username","password","postData","successCallback","errorCallback","headers","userData","xhRequest"];Spry.Utils.loadURL.Request.prototype.extractRequestOptions=function(_d,_e){if(!_d){return;}var _f=Spry.Utils.loadURL.Request.props;var _10=_f.length;for(var i=0;i<_10;i++){var _12=_f[i];if(_d[_12]!=undefined){this[_12]=_d[_12];if(_e){_d[_12]=undefined;}}}};Spry.Utils.loadURL.Request.prototype.clone=function(){var _13=Spry.Utils.loadURL.Request.props;var _14=_13.length;var req=new Spry.Utils.loadURL.Request;for(var i=0;i<_14;i++){req[_13[i]]=this[_13[i]];}if(this.headers){req.headers={};Spry.Utils.setOptions(req.headers,this.headers);}return req;};Spry.Utils.setInnerHTML=function(ele,str,_19){if(!ele){return;}ele=Spry.$(ele);var _1a="<script[^>]*>(.|s|\n|\r)*?</script>";ele.innerHTML=str.replace(new RegExp(_1a,"img"),"");if(_19){return;}var _1b=str.match(new RegExp(_1a,"img"));if(_1b){var _1c=_1b.length;for(var i=0;i<_1c;i++){var s=_1b[i].replace(/<script[^>]*>[\s\r\n]*(<\!--)?|(-->)?[\s\r\n]*<\/script>/img,"");Spry.Utils.eval(s);}}};Spry.Utils.updateContent=function(ele,url,_21,_22){Spry.Utils.loadURL("GET",url,true,function(req){Spry.Utils.setInnerHTML(ele,req.xhRequest.responseText);if(_21){_21(ele,url);}},_22);};Spry.Utils.addEventListener=function(_24,_25,_26,_27){try{_24=Spry.$(_24);if(_24.addEventListener){_24.addEventListener(_25,_26,_27);}else{if(_24.attachEvent){_24.attachEvent("on"+_25,_26);}}}catch(e){}};Spry.Utils.removeEventListener=function(_28,_29,_2a,_2b){try{_28=Spry.$(_28);if(_28.removeEventListener){_28.removeEventListener(_29,_2a,_2b);}else{if(_28.detachEvent){_28.detachEvent("on"+_29,_2a);}}}catch(e){}};Spry.Utils.addLoadListener=function(_2c){if(typeof window.addEventListener!="undefined"){window.addEventListener("load",_2c,false);}else{if(typeof document.addEventListener!="undefined"){document.addEventListener("load",_2c,false);}else{if(typeof window.attachEvent!="undefined"){window.attachEvent("onload",_2c);}}}};Spry.Utils.eval=function(str){return eval(str);};Spry.Utils.escapeQuotesAndLineBreaks=function(str){if(str){str=str.replace(/\\/g,"\\\\");str=str.replace(/["']/g,"\\$&");str=str.replace(/\n/g,"\\n");str=str.replace(/\r/g,"\\r");}return str;};Spry.Utils.encodeEntities=function(str){if(str&&str.search(/[&<>"]/)!=-1){str=str.replace(/&/g,"&amp;");str=str.replace(/</g,"&lt;");str=str.replace(/>/g,"&gt;");str=str.replace(/"/g,"&quot;");}return str;};Spry.Utils.decodeEntities=function(str){var d=Spry.Utils.decodeEntities.div;if(!d){d=document.createElement("div");Spry.Utils.decodeEntities.div=d;if(!d){return str;}}d.innerHTML=str;if(d.childNodes.length==1&&d.firstChild.nodeType==3&&d.firstChild.nextSibling==null){str=d.firstChild.data;}else{str=str.replace(/&lt;/gi,"<");str=str.replace(/&gt;/gi,">");str=str.replace(/&quot;/gi,"\"");str=str.replace(/&amp;/gi,"&");}return str;};Spry.Utils.fixupIETagAttributes=function(_32){var _33="";var _34=_32.match(/^<[^\s>]+\s*/)[0];var _35=_32.match(/\s*\/?>$/)[0];var _36=_32.replace(/^<[^\s>]+\s*|\s*\/?>/g,"");_33+=_34;if(_36){var _37=0;var _38=0;while(_37<_36.length){while(_36.charAt(_38)!="="&&_38<_36.length){++_38;}if(_38>=_36.length){_33+=_36.substring(_37,_38);break;}++_38;_33+=_36.substring(_37,_38);_37=_38;if(_36.charAt(_38)=="\""||_36.charAt(_38)=="'"){var _39=_38++;while(_38<_36.length){if(_36.charAt(_38)==_36.charAt(_39)){_38++;break;}else{if(_36.charAt(_38)=="\\"){_38++;}}_38++;}_33+=_36.substring(_37,_38);_37=_38;}else{_33+="\"";var _3a=_36.slice(_38).search(/\s/);_38=(_3a!=-1)?(_38+_3a):_36.length;_33+=_36.slice(_37,_38);_33+="\"";_37=_38;}}}_33+=_35;return _33;};Spry.Utils.fixUpIEInnerHTML=function(_3b){var _3c="";var _3d=new RegExp("<\\!--|<\\!\\[CDATA\\[|<\\w+[^<>]*>|-->|\\]\\](>|&gt;)","g");var _3e=0;var _3f=0;while(_3b.length){var _40=_3d.exec(_3b);if(!_40||!_40[0]){_3c+=_3b.substr(_3e,_3b.length-_3e);break;}if(_40.index!=_3e){_3c+=_3b.substr(_3e,_40.index-_3e);}if(_40[0]=="<!--"||_40[0]=="<![CDATA["){++_3f;_3c+=_40[0];}else{if(_40[0]=="-->"||_40[0]=="]]>"||(_3f&&_40[0]=="]]&gt;")){--_3f;_3c+=_40[0];}else{if(!_3f&&_40[0].charAt(0)=="<"){_3c+=Spry.Utils.fixupIETagAttributes(_40[0]);}else{_3c+=_40[0];}}}_3e=_3d.lastIndex;}return _3c;};Spry.Utils.stringToXMLDoc=function(str){var _42=null;try{var _43=new ActiveXObject("Microsoft.XMLDOM");_43.async=false;_43.loadXML(str);_42=_43;}catch(e){try{var _44=new DOMParser;_42=_44.parseFromString(str,"text/xml");}catch(e){Spry.Debug.reportError("Caught exception in Spry.Utils.stringToXMLDoc(): "+e+"\n");_42=null;}}return _42;};Spry.Utils.serializeObject=function(obj){var str="";var _47=true;if(obj==null||obj==undefined){return str+obj;}var _48=typeof obj;if(_48=="number"||_48=="boolean"){str+=obj;}else{if(_48=="string"){str+="\""+Spry.Utils.escapeQuotesAndLineBreaks(obj)+"\"";}else{if(obj.constructor==Array){str+="[";for(var i=0;i<obj.length;i++){if(!_47){str+=", ";}str+=Spry.Utils.serializeObject(obj[i]);_47=false;}str+="]";}else{if(_48=="object"){str+="{";for(var p in obj){if(!_47){str+=", ";}str+="\""+p+"\": "+Spry.Utils.serializeObject(obj[p]);_47=false;}str+="}";}}}}return str;};Spry.Utils.getNodesByFunc=function(_4b,_4c){var _4d=new Array;var _4e=new Array;var _4f=_4b;while(_4f){if(_4c(_4f)){_4e.push(_4f);}if(_4f.hasChildNodes()){_4d.push(_4f);_4f=_4f.firstChild;}else{if(_4f==_4b){_4f=null;}else{try{_4f=_4f.nextSibling;}catch(e){_4f=null;}}}while(!_4f&&_4d.length>0){_4f=_4d.pop();if(_4f==_4b){_4f=null;}else{try{_4f=_4f.nextSibling;}catch(e){_4f=null;}}}}if(_4d&&_4d.length>0){Spry.Debug.trace("-- WARNING: Spry.Utils.getNodesByFunc() failed to traverse all nodes!\n");}return _4e;};Spry.Utils.addClassName=function(ele,_51){ele=Spry.$(ele);if(!ele||!_51||(ele.className&&ele.className.search(new RegExp("\\b"+_51+"\\b"))!=-1)){return;}ele.className+=(ele.className?" ":"")+_51;};Spry.Utils.removeClassName=function(ele,_53){ele=Spry.$(ele);if(!ele||!_53||(ele.className&&ele.className.search(new RegExp("\\b"+_53+"\\b"))==-1)){return;}ele.className=ele.className.replace(new RegExp("\\s*\\b"+_53+"\\b","g"),"");};Spry.Utils.getFirstChildWithNodeName=function(_54,_55){var _56=_54.firstChild;while(_56){if(_56.nodeName==_55){return _56;}_56=_56.nextSibling;}return null;};Spry.Utils.nodeContainsElementNode=function(_57){if(_57){_57=_57.firstChild;while(_57){if(_57.nodeType==1){return true;}_57=_57.nextSibling;}}return false;};Spry.Utils.getNodeText=function(_58){var txt="";if(!_58){return;}try{var _5a=_58.firstChild;while(_5a){try{if(_5a.nodeType==3){txt+=Spry.Utils.encodeEntities(_5a.data);}else{if(_5a.nodeType==4){txt+=_5a.data;}}}catch(e){Spry.Debug.reportError("Spry.Utils.getNodeText() exception caught: "+e+"\n");}_5a=_5a.nextSibling;}}catch(e){Spry.Debug.reportError("Spry.Utils.getNodeText() exception caught: "+e+"\n");}return txt;};Spry.Utils.CreateObjectForNode=function(_5b){if(!_5b){return null;}var obj=new Object();var i=0;var _5e=null;try{for(i=0;i<_5b.attributes.length;i++){_5e=_5b.attributes[i];if(_5e&&_5e.nodeType==2){obj["@"+_5e.name]=_5e.value;}}}catch(e){Spry.Debug.reportError("Spry.Utils.CreateObjectForNode() caught exception while accessing attributes: "+e+"\n");}var _5f=_5b.firstChild;if(_5f&&!_5f.nextSibling&&_5f.nodeType!=1){obj[_5b.nodeName]=Spry.Utils.getNodeText(_5b);}while(_5f){if(_5f.nodeType==1){if(!Spry.Utils.nodeContainsElementNode(_5f)){obj[_5f.nodeName]=Spry.Utils.getNodeText(_5f);try{var _60=_5f.nodeName+"/@";for(i=0;i<_5f.attributes.length;i++){_5e=_5f.attributes[i];if(_5e&&_5e.nodeType==2){obj[_60+_5e.name]=_5e.value;}}}catch(e){Spry.Debug.reportError("Spry.Utils.CreateObjectForNode() caught exception while accessing attributes: "+e+"\n");}}}_5f=_5f.nextSibling;}return obj;};Spry.Utils.getRecordSetFromXMLDoc=function(_61,_62,_63){if(!_61||!_62){return null;}var _64=new Object();_64.xmlDoc=_61;_64.xmlPath=_62;_64.dataHash=new Object;_64.data=new Array;_64.getData=function(){return this.data;};var ctx=new ExprContext(_61);var _66=xpathParse(_62);var e=_66.evaluate(ctx);var _68=e.nodeSetValue();var _69=true;if(_68&&_68.length>0){_69=_68[0].nodeType!=2;}var _6a=0;for(var i=0;i<_68.length;i++){var _6c=null;if(_63){_6c=new Object;}else{if(_69){_6c=Spry.Utils.CreateObjectForNode(_68[i]);}else{_6c=new Object;_6c["@"+_68[i].name]=_68[i].value;}}if(_6c){_6c["ds_RowID"]=_6a++;_6c["ds_XMLNode"]=_68[i];_64.dataHash[_6c["ds_RowID"]]=_6c;_64.data.push(_6c);}}return _64;};Spry.Utils.setOptions=function(obj,_6e,_6f){if(!_6e){return;}for(var _70 in _6e){if(_6f&&_6e[_70]==undefined){continue;}obj[_70]=_6e[_70];}};Spry.Utils.SelectionManager={};Spry.Utils.SelectionManager.selectionGroups=new Object;Spry.Utils.SelectionManager.SelectionGroup=function(){this.selectedElements=new Array;};Spry.Utils.SelectionManager.SelectionGroup.prototype.select=function(_71,_72,_73){var _74=null;if(!_73){this.clearSelection();}else{for(var i=0;i<this.selectedElements.length;i++){_74=this.selectedElements[i].element;if(_74.element==_71){if(_74.className!=_72){Spry.Utils.removeClassName(_71,_74.className);Spry.Utils.addClassName(_71,_72);}return;}}}_74=new Object;_74.element=_71;_74.className=_72;this.selectedElements.push(_74);Spry.Utils.addClassName(_71,_72);};Spry.Utils.SelectionManager.SelectionGroup.prototype.unSelect=function(_76){for(var i=0;i<this.selectedElements.length;i++){var _78=this.selectedElements[i].element;if(_78.element==_76){Spry.Utils.removeClassName(_78.element,_78.className);return;}}};Spry.Utils.SelectionManager.SelectionGroup.prototype.clearSelection=function(){var _79=null;do{_79=this.selectedElements.shift();if(_79){Spry.Utils.removeClassName(_79.element,_79.className);}}while(_79);};Spry.Utils.SelectionManager.getSelectionGroup=function(_7a){if(!_7a){return null;}var _7b=Spry.Utils.SelectionManager.selectionGroups[_7a];if(!_7b){_7b=new Spry.Utils.SelectionManager.SelectionGroup();Spry.Utils.SelectionManager.selectionGroups[_7a]=_7b;}return _7b;};Spry.Utils.SelectionManager.select=function(_7c,_7d,_7e,_7f){var _80=Spry.Utils.SelectionManager.getSelectionGroup(_7c);if(!_80){return;}_80.select(_7d,_7e,_7f);};Spry.Utils.SelectionManager.unSelect=function(_81,_82){var _83=Spry.Utils.SelectionManager.getSelectionGroup(_81);if(!_83){return;}_83.unSelect(_82,className);};Spry.Utils.SelectionManager.clearSelection=function(_84){var _85=Spry.Utils.SelectionManager.getSelectionGroup(_84);if(!_85){return;}_85.clearSelection();};Spry.$=function(_86){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++){elements.push(Spry.$(arguments[i]));}return elements;}if(typeof _86=="string"){_86=document.getElementById(_86);}return _86;};Spry.Utils.Notifier=function(){this.observers=[];this.suppressNotifications=0;};Spry.Utils.Notifier.prototype.addObserver=function(_88){if(!_88){return;}var len=this.observers.length;for(var i=0;i<len;i++){if(this.observers[i]==_88){return;}}this.observers[len]=_88;};Spry.Utils.Notifier.prototype.removeObserver=function(_8b){if(!_8b){return;}for(var i=0;i<this.observers.length;i++){if(this.observers[i]==_8b){this.observers.splice(i,1);break;}}};Spry.Utils.Notifier.prototype.notifyObservers=function(_8d,_8e){if(!_8d){return;}if(!this.suppressNotifications){var len=this.observers.length;for(var i=0;i<len;i++){var obs=this.observers[i];if(obs){if(typeof obs=="function"){obs(_8d,this,_8e);}else{if(obs[_8d]){obs[_8d](this,_8e);}}}}}};Spry.Utils.Notifier.prototype.enableNotifications=function(){if(--this.suppressNotifications<0){this.suppressNotifications=0;Spry.Debug.reportError("Unbalanced enableNotifications() call!\n");}};Spry.Utils.Notifier.prototype.disableNotifications=function(){++this.suppressNotifications;};Spry.Debug={};Spry.Debug.enableTrace=true;Spry.Debug.debugWindow=null;Spry.Debug.onloadDidFire=false;Spry.Utils.addLoadListener(function(){Spry.Debug.onloadDidFire=true;Spry.Debug.flushQueuedMessages();});Spry.Debug.flushQueuedMessages=function(){if(Spry.Debug.flushQueuedMessages.msgs){var _92=Spry.Debug.flushQueuedMessages.msgs;for(var i=0;i<_92.length;i++){Spry.Debug.debugOut(_92[i].msg,_92[i].color);}Spry.Debug.flushQueuedMessages.msgs=null;}};Spry.Debug.createDebugWindow=function(){if(!Spry.Debug.enableTrace||Spry.Debug.debugWindow||!Spry.Debug.onloadDidFire){return;}try{Spry.Debug.debugWindow=document.createElement("div");var div=Spry.Debug.debugWindow;div.style.fontSize="12px";div.style.fontFamily="console";div.style.position="absolute";div.style.width="400px";div.style.height="300px";div.style.overflow="auto";div.style.border="solid 1px black";div.style.backgroundColor="white";div.style.color="black";div.style.bottom="0px";div.style.right="0px";div.setAttribute("id","SpryDebugWindow");document.body.appendChild(Spry.Debug.debugWindow);}catch(e){}};Spry.Debug.debugOut=function(str,_96){if(!Spry.Debug.debugWindow){Spry.Debug.createDebugWindow();if(!Spry.Debug.debugWindow){if(!Spry.Debug.flushQueuedMessages.msgs){Spry.Debug.flushQueuedMessages.msgs=new Array;}Spry.Debug.flushQueuedMessages.msgs.push({msg:str,color:_96});return;}}var d=document.createElement("div");if(_96){d.style.backgroundColor=_96;}d.innerHTML=str;Spry.Debug.debugWindow.appendChild(d);};Spry.Debug.trace=function(str){Spry.Debug.debugOut(str);};Spry.Debug.reportError=function(str){Spry.Debug.debugOut(str,"red");};Spry.Data={};Spry.Data.regionsArray={};Spry.Data.initRegions=function(_9a){if(!_9a){_9a=document.body;}var _9b=null;var _9c=Spry.Utils.getNodesByFunc(_9a,function(_9d){try{if(_9d.nodeType!=1){return false;}var _9e="spry:region";var _9f=_9d.attributes.getNamedItem(_9e);if(!_9f){_9e="spry:detailregion";_9f=_9d.attributes.getNamedItem(_9e);}if(_9f){if(_9b){var _a0=_9d.parentNode;while(_a0){if(_a0==_9b){Spry.Debug.reportError("Found a nested "+_9e+" in the following markup. Nested regions are currently not supported.<br/><pre>"+Spry.Utils.encodeEntities(_a0.innerHTML)+"</pre>");return false;}_a0=_a0.parentNode;}}if(_9f.value){_9f=_9d.attributes.getNamedItem("id");if(!_9f||!_9f.value){_9d.setAttribute("id","spryregion"+(++Spry.Data.initRegions.nextUniqueRegionID));}_9b=_9d;return true;}else{Spry.Debug.reportError(_9e+" attributes require one or more data set names as values!");}}}catch(e){}return false;});var _a1,dataSets,i;for(i=0;i<_9c.length;i++){var rgn=_9c[i];var _a3=false;_a1=rgn.attributes.getNamedItem("id").value;attr=rgn.attributes.getNamedItem("spry:region");if(!attr){attr=rgn.attributes.getNamedItem("spry:detailregion");_a3=true;}if(!attr.value){Spry.Debug.reportError("spry:region and spry:detailregion attributes require one or more data set names as values!");continue;}rgn.attributes.removeNamedItem(attr.nodeName);Spry.Utils.removeClassName(rgn,Spry.Data.Region.hiddenRegionClassName);dataSets=Spry.Data.Region.strToDataSetsArray(attr.value);if(!dataSets.length){Spry.Debug.reportError("spry:region or spry:detailregion attribute has no data set!");continue;}var _a4=false;var _a5=false;var _a6="";var _a7=null;var _a8={};var _a9={};attr=rgn.attributes.getNamedItem("spry:readystate");if(attr&&attr.value){_a9["ready"]=attr.value;}attr=rgn.attributes.getNamedItem("spry:errorstate");if(attr&&attr.value){_a9["error"]=attr.value;}attr=rgn.attributes.getNamedItem("spry:loadingstate");if(attr&&attr.value){_a9["loading"]=attr.value;}attr=rgn.attributes.getNamedItem("spry:expiredstate");if(attr&&attr.value){_a9["expired"]=attr.value;}var _aa=Spry.Utils.getNodesByFunc(rgn,function(_ab){try{if(_ab.nodeType==1){var _ac=_ab.attributes;var _ad=Spry.Data.Region.PI.orderedInstructions.length;var _ae=null;var _af=null;for(var i=0;i<_ad;i++){var _b1=Spry.Data.Region.PI.orderedInstructions[i];var _b2=_ac.getNamedItem(_b1);if(!_b2){continue;}var _b3=Spry.Data.Region.PI.instructions[_b1];var _b4=(_ab==rgn)?true:_b3.childrenOnly;var _b5=_b3.getOpenTag(_ab,_b1);var _b6=_b3.getCloseTag(_ab,_b1);if(_b4){var _b7=document.createComment(_b5);var _b8=document.createComment(_b6);if(!_ae){_ab.insertBefore(_b7,_ab.firstChild);}else{_ab.insertBefore(_b7,_ae.nextSibling);}_ae=_b7;if(!_af){_ab.appendChild(_b8);}else{_ab.insertBefore(_b8,_af);}_af=_b8;}else{var _b9=_ab.parentNode;_b9.insertBefore(document.createComment(_b5),_ab);_b9.insertBefore(document.createComment(_b6),_ab.nextSibling);}if(_b1=="spry:state"){_a8[_b2.value]=true;}_ab.removeAttribute(_b1);}if(Spry.Data.Region.enableBehaviorAttributes){var _ba=Spry.Data.Region.behaviorAttrs;for(var _bb in _ba){var _bc=_ac.getNamedItem(_bb);if(_bc){_a4=true;if(_ba[_bb].setup){_ba[_bb].setup(_ab,_bc.value);}}}}}}catch(e){}return false;});_a6=rgn.innerHTML;if(window.ActiveXObject&&!Spry.Data.Region.disableIEInnerHTMLFixUp&&_a6.search(/=\{/)!=-1){if(Spry.Data.Region.debug){Spry.Debug.trace("<hr />Performing IE innerHTML fix up of Region: "+_a1+"<br /><br />"+Spry.Utils.encodeEntities(_a6));}_a6=Spry.Utils.fixUpIEInnerHTML(_a6);}if(Spry.Data.Region.debug){Spry.Debug.trace("<hr />Region template markup for '"+_a1+"':<br /><br />"+Spry.Utils.encodeEntities(_a6));}if(!_a5){rgn.innerHTML="";}var _bd=new Spry.Data.Region(rgn,_a1,_a3,_a6,dataSets,_a8,_a9,_a4);Spry.Data.regionsArray[_bd.name]=_bd;}Spry.Data.updateAllRegions();};Spry.Data.initRegions.nextUniqueRegionID=0;Spry.Data.updateRegion=function(_be){if(!_be||!Spry.Data.regionsArray||!Spry.Data.regionsArray[_be]){return;}try{Spry.Data.regionsArray[_be].updateContent();}catch(e){Spry.Debug.reportError("Spry.Data.updateRegion("+_be+") caught an exception: "+e+"\n");}};Spry.Data.getRegion=function(_bf){return Spry.Data.regionsArray[_bf];};Spry.Data.updateAllRegions=function(){if(!Spry.Data.regionsArray){return;}for(var _c0 in Spry.Data.regionsArray){Spry.Data.updateRegion(_c0);}};Spry.Data.DataSet=function(_c1){Spry.Utils.Notifier.call(this);this.name="";this.internalID=Spry.Data.DataSet.nextDataSetID++;this.curRowID=0;this.data=[];this.unfilteredData=null;this.dataHash={};this.columnTypes={};this.filterFunc=null;this.filterDataFunc=null;this.distinctOnLoad=false;this.distinctFieldsOnLoad=null;this.sortOnLoad=null;this.sortOrderOnLoad="ascending";this.keepSorted=false;this.dataWasLoaded=false;this.pendingRequest=null;this.lastSortColumns=[];this.lastSortOrder="";this.loadIntervalID=0;Spry.Utils.setOptions(this,_c1);};Spry.Data.DataSet.prototype=new Spry.Utils.Notifier();Spry.Data.DataSet.prototype.constructor=Spry.Data.DataSet;Spry.Data.DataSet.prototype.getData=function(_c2){return (_c2&&this.unfilteredData)?this.unfilteredData:this.data;};Spry.Data.DataSet.prototype.getUnfilteredData=function(){return this.getData(true);};Spry.Data.DataSet.prototype.getLoadDataRequestIsPending=function(){return this.pendingRequest!=null;};Spry.Data.DataSet.prototype.getDataWasLoaded=function(){return this.dataWasLoaded;};Spry.Data.DataSet.prototype.setDataFromArray=function(arr,_c4){this.notifyObservers("onPreLoad");this.unfilteredData=null;this.filteredData=null;this.data=[];this.dataHash={};var _c5=arr.length;for(var i=0;i<_c5;i++){var row=arr[i];if(row.ds_RowID==undefined){row.ds_RowID=i;}this.dataHash[row.ds_RowID]=row;this.data.push(row);}this.loadData(_c4);};Spry.Data.DataSet.prototype.loadData=function(_c8){var _c9=this;this.pendingRequest=new Object;this.dataWasLoaded=false;var _ca=function(){_c9.pendingRequest=null;_c9.dataWasLoaded=true;_c9.applyColumnTypes();_c9.filterAndSortData();_c9.notifyObservers("onPostLoad");_c9.notifyObservers("onDataChanged");};if(_c8){_ca();}else{this.pendingRequest.timer=setTimeout(_ca,0);}};Spry.Data.DataSet.prototype.filterAndSortData=function(){if(this.filterDataFunc){this.filterData(this.filterDataFunc,true);}if(this.distinctOnLoad){this.distinct(this.distinctFieldsOnLoad);}if(this.keepSorted&&this.getSortColumn()){this.sort(this.lastSortColumns,this.lastSortOrder);}else{if(this.sortOnLoad){this.sort(this.sortOnLoad,this.sortOrderOnLoad);}}if(this.filterFunc){this.filter(this.filterFunc,true);}if(this.data&&this.data.length>0){this.curRowID=this.data[0]["ds_RowID"];}else{this.curRowID=0;}};Spry.Data.DataSet.prototype.cancelLoadData=function(){if(this.pendingRequest&&this.pendingRequest.timer){clearTimeout(this.pendingRequest.timer);}this.pendingRequest=null;};Spry.Data.DataSet.prototype.getRowCount=function(_cb){var _cc=this.getData(_cb);return _cc?_cc.length:0;};Spry.Data.DataSet.prototype.getRowByID=function(_cd){if(!this.data){return null;}return this.dataHash[_cd];};Spry.Data.DataSet.prototype.getRowByRowNumber=function(_ce,_cf){var _d0=this.getData(_cf);if(_d0&&_ce>=0&&_ce<_d0.length){return _d0[_ce];}return null;};Spry.Data.DataSet.prototype.getCurrentRow=function(){return this.getRowByID(this.curRowID);};Spry.Data.DataSet.prototype.setCurrentRow=function(_d1){if(this.curRowID==_d1){return;}var _d2={oldRowID:this.curRowID,newRowID:_d1};this.curRowID=_d1;this.notifyObservers("onCurrentRowChanged",_d2);};Spry.Data.DataSet.prototype.getRowNumber=function(row,_d4){if(row){var _d5=this.getData(_d4);if(_d5&&_d5.length){var _d6=_d5.length;for(var i=0;i<_d6;i++){if(_d5[i]==row){return i;}}}}return -1;};Spry.Data.DataSet.prototype.getCurrentRowNumber=function(){return this.getRowNumber(this.getCurrentRow());};Spry.Data.DataSet.prototype.getCurrentRowID=function(){return this.curRowID;};Spry.Data.DataSet.prototype.setCurrentRowNumber=function(_d8){if(!this.data||_d8>=this.data.length){Spry.Debug.trace("Invalid row number: "+_d8+"\n");return;}var _d9=this.data[_d8]["ds_RowID"];if(_d9==undefined||this.curRowID==_d9){return;}this.setCurrentRow(_d9);};Spry.Data.DataSet.prototype.findRowsWithColumnValues=function(_da,_db,_dc){var _dd=[];var _de=this.getData(_dc);if(_de){var _df=_de.length;for(var i=0;i<_df;i++){var row=_de[i];var _e2=true;for(var _e3 in _da){if(_da[_e3]!=row[_e3]){_e2=false;break;}}if(_e2){if(_db){return row;}_dd.push(row);}}}return _db?null:_dd;};Spry.Data.DataSet.prototype.setColumnType=function(_e4,_e5){if(_e4){if(typeof _e4=="string"){_e4=[_e4];}for(var i=0;i<_e4.length;i++){this.columnTypes[_e4[i]]=_e5;}}};Spry.Data.DataSet.prototype.getColumnType=function(_e7){if(this.columnTypes[_e7]){return this.columnTypes[_e7];}return "string";};Spry.Data.DataSet.prototype.applyColumnTypes=function(){var _e8=this.getData(true);var _e9=_e8.length;var _ea=[];if(_e9<1){return;}for(var _eb in this.columnTypes){var _ec=this.columnTypes[_eb];if(_ec!="string"){for(var i=0;i<_e9;i++){var row=_e8[i];var val=row[_eb];if(val!=undefined){if(_ec=="number"){row[_eb]=new Number(val);}else{if(_ec=="html"){row[_eb]=Spry.Utils.decodeEntities(val);}}}}}}};Spry.Data.DataSet.prototype.distinct=function(_f0){if(this.data){var _f1=this.data;this.data=[];this.dataHash={};var _f2=false;var _f3={};var i=0;var _f5=[];if(typeof _f0=="string"){_f5=[_f0];}else{if(_f0){_f5=_f0;}else{for(var _f6 in _f1[0]){_f5[i++]=_f6;}}}for(var i=0;i<_f1.length;i++){var rec=_f1[i];var _f9="";for(var j=0;j<_f5.length;j++){_f6=_f5[j];if(_f6!="ds_RowID"){if(_f9){_f9+=",";}_f9+=_f6+":"+"\""+rec[_f6]+"\"";}}if(!_f3[_f9]){this.data.push(rec);this.dataHash[rec["ds_RowID"]]=rec;_f3[_f9]=true;}else{_f2=true;}}if(_f2){this.notifyObservers("onDataChanged");}}};Spry.Data.DataSet.prototype.getSortColumn=function(){return (this.lastSortColumns&&this.lastSortColumns.length>0)?this.lastSortColumns[0]:"";};Spry.Data.DataSet.prototype.getSortOrder=function(){return this.lastSortOrder?this.lastSortOrder:"";};Spry.Data.DataSet.prototype.sort=function(_fb,_fc){if(!_fb){return;}if(typeof _fb=="string"){_fb=[_fb,"ds_RowID"];}else{if(_fb.length<2&&_fb[0]!="ds_RowID"){_fb.push("ds_RowID");}}if(!_fc){_fc="toggle";}if(_fc=="toggle"){if(this.lastSortColumns.length>0&&this.lastSortColumns[0]==_fb[0]&&this.lastSortOrder=="ascending"){_fc="descending";}else{_fc="ascending";}}if(_fc!="ascending"&&_fc!="descending"){Spry.Debug.reportError("Invalid sort order type specified: "+_fc+"\n");return;}var _fd={oldSortColumns:this.lastSortColumns,oldSortOrder:this.lastSortOrder,newSortColumns:_fb,newSortOrder:_fc};this.notifyObservers("onPreSort",_fd);var _fe=_fb[_fb.length-1];var _ff=Spry.Data.DataSet.prototype.sort.getSortFunc(_fe,this.getColumnType(_fe),_fc);for(var i=_fb.length-2;i>=0;i--){_fe=_fb[i];_ff=Spry.Data.DataSet.prototype.sort.buildSecondarySortFunc(Spry.Data.DataSet.prototype.sort.getSortFunc(_fe,this.getColumnType(_fe),_fc),_ff);}if(this.unfilteredData){this.unfilteredData.sort(_ff);if(this.filterFunc){this.filter(this.filterFunc,true);}}else{this.data.sort(_ff);}this.lastSortColumns=_fb.slice(0);this.lastSortOrder=_fc;this.notifyObservers("onPostSort",_fd);};Spry.Data.DataSet.prototype.sort.getSortFunc=function(prop,type,_103){var _104=null;if(type=="number"){if(_103=="ascending"){_104=function(a,b){a=a[prop];b=b[prop];if(a==undefined||b==undefined){return (a==b)?0:(a?1:-1);}return a-b;};}else{_104=function(a,b){a=a[prop];b=b[prop];if(a==undefined||b==undefined){return (a==b)?0:(a?-1:1);}return b-a;};}}else{if(type=="date"){if(_103=="ascending"){_104=function(a,b){var dA=a[prop];var dB=b[prop];dA=dA?(new Date(dA)):0;dB=dB?(new Date(dB)):0;return dA-dB;};}else{_104=function(a,b){var dA=a[prop];var dB=b[prop];dA=dA?(new Date(dA)):0;dB=dB?(new Date(dB)):0;return dB-dA;};}}else{if(_103=="ascending"){_104=function(a,b){a=a[prop];b=b[prop];if(a==undefined||b==undefined){return (a==b)?0:(a?1:-1);}var tA=a.toString();var tB=b.toString();var tA_l=tA.toLowerCase();var tB_l=tB.toLowerCase();var _117=tA.length>tB.length?tB.length:tA.length;for(var i=0;i<_117;i++){var _119=tA_l.charAt(i);var _11a=tB_l.charAt(i);var a_c=tA.charAt(i);var b_c=tB.charAt(i);if(_119>_11a){return 1;}else{if(_119<_11a){return -1;}else{if(a_c>b_c){return 1;}else{if(a_c<b_c){return -1;}}}}}if(tA.length==tB.length){return 0;}else{if(tA.length>tB.length){return 1;}}return -1;};}else{_104=function(a,b){a=a[prop];b=b[prop];if(a==undefined||b==undefined){return (a==b)?0:(a?-1:1);}var tA=a.toString();var tB=b.toString();var tA_l=tA.toLowerCase();var tB_l=tB.toLowerCase();var _123=tA.length>tB.length?tB.length:tA.length;for(var i=0;i<_123;i++){var _125=tA_l.charAt(i);var _126=tB_l.charAt(i);var a_c=tA.charAt(i);var b_c=tB.charAt(i);if(_125>_126){return -1;}else{if(_125<_126){return 1;}else{if(a_c>b_c){return -1;}else{if(a_c<b_c){return 1;}}}}}if(tA.length==tB.length){return 0;}else{if(tA.length>tB.length){return -1;}}return 1;};}}}return _104;};Spry.Data.DataSet.prototype.sort.buildSecondarySortFunc=function(_129,_12a){return function(a,b){var ret=_129(a,b);if(ret==0){ret=_12a(a,b);}return ret;};};Spry.Data.DataSet.prototype.filterData=function(_12e,_12f){var _130=false;if(!_12e){this.filterDataFunc=null;_130=true;}else{this.filterDataFunc=_12e;if(this.dataWasLoaded&&((this.unfilteredData&&this.unfilteredData.length)||(this.data&&this.data.length))){if(this.unfilteredData){this.data=this.unfilteredData;this.unfilteredData=null;}var _131=this.data;this.data=[];this.dataHash={};for(var i=0;i<_131.length;i++){var _133=_12e(this,_131[i],i);if(_133){this.data.push(_133);this.dataHash[_133["ds_RowID"]]=_133;}}_130=true;}}if(_130){if(!_12f){this.disableNotifications();if(this.filterFunc){this.filter(this.filterFunc,true);}this.enableNotifications();}this.notifyObservers("onDataChanged");}};Spry.Data.DataSet.prototype.filter=function(_134,_135){var _136=false;if(!_134){if(this.filterFunc&&this.unfilteredData){this.data=this.unfilteredData;this.unfilteredData=null;this.filterFunc=null;_136=true;}}else{this.filterFunc=_134;if(this.dataWasLoaded&&(this.unfilteredData||(this.data&&this.data.length))){if(!this.unfilteredData){this.unfilteredData=this.data;}var _137=this.unfilteredData;this.data=[];for(var i=0;i<_137.length;i++){var _139=_134(this,_137[i],i);if(_139){this.data.push(_139);}}_136=true;}}if(_136){this.notifyObservers("onDataChanged");}};Spry.Data.DataSet.prototype.startLoadInterval=function(_13a){this.stopLoadInterval();if(_13a>0){var self=this;this.loadInterval=_13a;this.loadIntervalID=setInterval(function(){self.loadData();},_13a);}};Spry.Data.DataSet.prototype.stopLoadInterval=function(){if(this.loadIntervalID){clearInterval(this.loadIntervalID);}this.loadInterval=0;this.loadIntervalID=null;};Spry.Data.DataSet.nextDataSetID=0;Spry.Data.HTTPSourceDataSet=function(_13c,_13d){Spry.Data.DataSet.call(this);this.url=_13c;this.dataSetsForDataRefStrings=new Array;this.hasDataRefStrings=false;this.useCache=true;this.setRequestInfo(_13d,true);Spry.Utils.setOptions(this,_13d,true);this.recalculateDataSetDependencies();if(this.loadInterval>0){this.startLoadInterval(this.loadInterval);}};Spry.Data.HTTPSourceDataSet.prototype=new Spry.Data.DataSet();Spry.Data.HTTPSourceDataSet.prototype.constructor=Spry.Data.HTTPSourceDataSet;Spry.Data.HTTPSourceDataSet.prototype.setRequestInfo=function(_13e,_13f){this.requestInfo=new Spry.Utils.loadURL.Request();this.requestInfo.extractRequestOptions(_13e,_13f);if(this.requestInfo.method=="POST"){if(!this.requestInfo.headers){this.requestInfo.headers={};}if(!this.requestInfo.headers["Content-Type"]){this.requestInfo.headers["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8";}}};Spry.Data.HTTPSourceDataSet.prototype.recalculateDataSetDependencies=function(){this.hasDataRefStrings=false;var i=0;for(i=0;i<this.dataSetsForDataRefStrings.length;i++){var ds=this.dataSetsForDataRefStrings[i];if(ds){ds.removeObserver(this);}}this.dataSetsForDataRefStrings=new Array();var _142=this.getDataRefStrings();var _143=0;for(var n=0;n<_142.length;n++){var _145=Spry.Data.Region.getTokensFromStr(_142[n]);for(i=0;_145&&i<_145.length;i++){if(_145[i].search(/{[^}:]+::[^}]+}/)!=-1){var _146=_145[i].replace(/^\{|::.*\}/g,"");var ds=null;if(!this.dataSetsForDataRefStrings[_146]){try{ds=eval(_146);}catch(e){ds=null;}if(_146&&ds){this.dataSetsForDataRefStrings[_146]=ds;this.dataSetsForDataRefStrings[_143++]=ds;this.hasDataRefStrings=true;}}}}}for(i=0;i<this.dataSetsForDataRefStrings.length;i++){var ds=this.dataSetsForDataRefStrings[i];ds.addObserver(this);}};Spry.Data.HTTPSourceDataSet.prototype.getDataRefStrings=function(){var _149=[];if(this.url){_149.push(this.url);}if(this.requestInfo&&this.requestInfo.postData){_149.push(this.requestInfo.postData);}return _149;};Spry.Data.HTTPSourceDataSet.prototype.attemptLoadData=function(){for(var i=0;i<this.dataSetsForDataRefStrings.length;i++){var ds=this.dataSetsForDataRefStrings[i];if(ds.getLoadDataRequestIsPending()||!ds.getDataWasLoaded()){return;}}this.loadData();};Spry.Data.HTTPSourceDataSet.prototype.onCurrentRowChanged=function(ds,data){this.attemptLoadData();};Spry.Data.HTTPSourceDataSet.prototype.onPostSort=function(ds,data){this.attemptLoadData();};Spry.Data.HTTPSourceDataSet.prototype.onDataChanged=function(ds,data){this.attemptLoadData();};Spry.Data.HTTPSourceDataSet.prototype.loadData=function(){if(!this.url){return;}this.cancelLoadData();var url=this.url;var _153=this.requestInfo.postData;if(this.hasDataRefStrings){var _154=true;for(var i=0;i<this.dataSetsForDataRefStrings.length;i++){var ds=this.dataSetsForDataRefStrings[i];if(ds.getLoadDataRequestIsPending()){_154=false;}else{if(!ds.getDataWasLoaded()){ds.loadData();_154=false;}}}if(!_154){return;}url=Spry.Data.Region.processDataRefString(null,this.url,this.dataSetsForDataRefStrings);if(!url){return;}if(_153&&(typeof _153)=="string"){_153=Spry.Data.Region.processDataRefString(null,_153,this.dataSetsForDataRefStrings);}}this.notifyObservers("onPreLoad");this.data=null;this.dataWasLoaded=false;this.unfilteredData=null;this.dataHash=null;this.curRowID=0;var req=this.requestInfo.clone();req.url=url;req.postData=_153;this.pendingRequest=new Object;this.pendingRequest.data=Spry.Data.HTTPSourceDataSet.LoadManager.loadData(req,this,this.useCache);};Spry.Data.HTTPSourceDataSet.prototype.cancelLoadData=function(){if(this.pendingRequest){Spry.Data.HTTPSourceDataSet.LoadManager.cancelLoadData(this.pendingRequest.data,this);this.pendingRequest=null;}};Spry.Data.HTTPSourceDataSet.prototype.getURL=function(){return this.url;};Spry.Data.HTTPSourceDataSet.prototype.setURL=function(url,_159){if(this.url==url){if(!_159||(this.requestInfo.method==_159.method&&(_159.method!="POST"||this.requestInfo.postData==_159.postData))){return;}}this.url=url;this.setRequestInfo(_159);this.cancelLoadData();this.recalculateDataSetDependencies();this.dataWasLoaded=false;};Spry.Data.HTTPSourceDataSet.prototype.setDataFromDoc=function(_15a){this.pendingRequest=null;this.loadDataIntoDataSet(_15a);this.applyColumnTypes();this.filterAndSortData();this.notifyObservers("onPostLoad");this.notifyObservers("onDataChanged");};Spry.Data.HTTPSourceDataSet.prototype.loadDataIntoDataSet=function(_15b){this.dataHash=new Object;this.data=new Array;this.dataWasLoaded=true;};Spry.Data.HTTPSourceDataSet.prototype.xhRequestProcessor=function(_15c){var resp=_15c.responseText;if(_15c.status==200||_15c.status==0){return resp;}return null;};Spry.Data.HTTPSourceDataSet.prototype.sessionExpiredChecker=function(req){if(req.xhRequest.responseText=="session expired"){return true;}return false;};Spry.Data.HTTPSourceDataSet.prototype.setSessionExpiredChecker=function(_15f){this.sessionExpiredChecker=_15f;};Spry.Data.HTTPSourceDataSet.prototype.onRequestResponse=function(_160,req){this.setDataFromDoc(_160.rawData);};Spry.Data.HTTPSourceDataSet.prototype.onRequestError=function(_162,req){this.notifyObservers("onLoadError",req);};Spry.Data.HTTPSourceDataSet.prototype.onRequestSessionExpired=function(_164,req){this.notifyObservers("onSessionExpired",req);};Spry.Data.HTTPSourceDataSet.LoadManager={};Spry.Data.HTTPSourceDataSet.LoadManager.cache=[];Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest=function(_166,_167,_168){Spry.Utils.Notifier.call(this);this.reqInfo=_166;this.rawData=null;this.timer=null;this.state=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.NOT_LOADED;this.xhRequestProcessor=_167;this.sessionExpiredChecker=_168;};Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.prototype=new Spry.Utils.Notifier();Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.prototype.constructor=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest;Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.NOT_LOADED=1;Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_REQUESTED=2;Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_FAILED=3;Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_SUCCESSFUL=4;Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.prototype.loadDataCallback=function(req){if(req.xhRequest.readyState!=4){return;}var _16a=null;if(this.xhRequestProcessor){_16a=this.xhRequestProcessor(req.xhRequest);}if(this.sessionExpiredChecker){Spry.Utils.setOptions(req,{"rawData":_16a},false);if(this.sessionExpiredChecker(req)){this.state=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_FAILED;this.notifyObservers("onRequestSessionExpired",req);this.observers.length=0;return;}}if(!_16a){this.state=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_FAILED;this.notifyObservers("onRequestError",req);this.observers.length=0;return;}this.rawData=_16a;this.state=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_SUCCESSFUL;this.notifyObservers("onRequestResponse",req);this.observers.length=0;};Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.prototype.loadData=function(){var self=this;this.cancelLoadData();this.rawData=null;this.state=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_REQUESTED;var _16c=this.reqInfo.clone();_16c.successCallback=function(req){self.loadDataCallback(req);};_16c.errorCallback=_16c.successCallback;this.timer=setTimeout(function(){self.timer=null;Spry.Utils.loadURL(_16c.method,_16c.url,_16c.async,_16c.successCallback,_16c);},0);};Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.prototype.cancelLoadData=function(){if(this.state==Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_REQUESTED){if(this.timer){this.timer.clearTimeout();this.timer=null;}this.rawData=null;this.state=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.NOT_LOADED;}};Spry.Data.HTTPSourceDataSet.LoadManager.getCacheKey=function(_16e){return _16e.method+"::"+_16e.url+"::"+_16e.postData+"::"+_16e.username;};Spry.Data.HTTPSourceDataSet.LoadManager.loadData=function(_16f,ds,_171){if(!_16f){return null;}var _172=null;var _173=null;if(_171){_173=Spry.Data.HTTPSourceDataSet.LoadManager.getCacheKey(_16f);_172=Spry.Data.HTTPSourceDataSet.LoadManager.cache[_173];}if(_172){if(_172.state==Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_REQUESTED){if(ds){_172.addObserver(ds);}return _172;}else{if(_172.state==Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_SUCCESSFUL){if(ds){setTimeout(function(){ds.setDataFromDoc(_172.rawData);},0);}return _172;}}}if(!_172){_172=new Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest(_16f,(ds?ds.xhRequestProcessor:null),(ds?ds.sessionExpiredChecker:null));if(_171){Spry.Data.HTTPSourceDataSet.LoadManager.cache[_173]=_172;_172.addObserver({onRequestError:function(){Spry.Data.HTTPSourceDataSet.LoadManager.cache[_173]=undefined;}});}}if(ds){_172.addObserver(ds);}_172.loadData();return _172;};Spry.Data.HTTPSourceDataSet.LoadManager.cancelLoadData=function(_174,ds){if(_174){if(ds){_174.removeObserver(ds);}else{_174.cancelLoadData();}}};Spry.Data.XMLDataSet=function(_176,_177,_178){this.xpath=_177;this.doc=null;this.subPaths=[];Spry.Data.HTTPSourceDataSet.call(this,_176,_178);var _179=typeof this.subPaths;if(_179=="string"||(_179=="object"&&this.subPaths.constructor!=Array)){this.subPaths=[this.subPaths];}};Spry.Data.XMLDataSet.prototype=new Spry.Data.HTTPSourceDataSet();Spry.Data.XMLDataSet.prototype.constructor=Spry.Data.XMLDataSet;Spry.Data.XMLDataSet.prototype.getDataRefStrings=function(){var _17a=[];if(this.url){_17a.push(this.url);}if(this.xpath){_17a.push(this.xpath);}if(this.requestInfo&&this.requestInfo.postData){_17a.push(this.requestInfo.postData);}return _17a;};Spry.Data.XMLDataSet.prototype.getDocument=function(){return this.doc;};Spry.Data.XMLDataSet.prototype.getXPath=function(){return this.xpath;};Spry.Data.XMLDataSet.prototype.setXPath=function(path){if(this.xpath!=path){this.xpath=path;if(this.dataWasLoaded&&this.doc){this.notifyObservers("onPreLoad");this.setDataFromDoc(this.doc);}}};Spry.Data.XMLDataSet.PathNode=function(path){this.path=path;this.subPaths=[];this.xpath="";};Spry.Data.XMLDataSet.PathNode.prototype.addSubPath=function(path){var node=this.findSubPath(path);if(!node){node=new Spry.Data.XMLDataSet.PathNode(path);this.subPaths.push(node);}return node;};Spry.Data.XMLDataSet.PathNode.prototype.findSubPath=function(path){var _180=this.subPaths.length;for(var i=0;i<_180;i++){var _182=this.subPaths[i];if(path==_182.path){return _182;}}return null;};Spry.Data.XMLDataSet.PathNode.prototype.consolidate=function(){var _183=this.subPaths.length;if(!this.xpath&&_183==1){var _184=this.subPaths[0];this.path+=((_184[0]!="/")?"/":"")+_184.path;this.xpath=_184.xpath;this.subPaths=_184.subPaths;this.consolidate();return;}for(var i=0;i<_183;i++){this.subPaths[i].consolidate();}};Spry.Data.XMLDataSet.prototype.convertXPathsToPathTree=function(_186){var _187=_186.length;var root=new Spry.Data.XMLDataSet.PathNode("");for(var i=0;i<_187;i++){var _18a=_186[i];var _18b=_18a.replace(/\/\//g,"/__SPRYDS__");_18b=_18b.replace(/^\//,"");var _18c=_18b.split(/\//);var _18d=_18c.length;var node=root;for(var j=0;j<_18d;j++){var path=_18c[j].replace(/__SPRYDS__/,"//");node=node.addSubPath(path);}node.xpath=_18a;}root.consolidate();return root;};Spry.Data.XMLDataSet.prototype.flattenSubPaths=function(rs,_192){if(!rs||!_192){return;}var _193=_192.length;if(_193<1){return;}var data=rs.data;var _195={};var _196=[];var _197=[];for(var i=0;i<_193;i++){var _199=_192[i];if(typeof _199=="object"){_199=_199.path;}if(!_199){_199="";}_196[i]=Spry.Data.Region.processDataRefString(null,_199,this.dataSetsForDataRefStrings);_197[i]=_196[i].replace(/\[.*\]/g,"");}var row;var _19b=data.length;var _19c=[];for(var i=0;i<_19b;i++){row=data[i];var _19e=[row];for(var j=0;j<_193;j++){var _1a0=Spry.Utils.getRecordSetFromXMLDoc(row.ds_XMLNode,_196[j],(_192[j].xpath?false:true));if(_1a0&&_1a0.data&&_1a0.data.length){if(typeof _192[j]=="object"&&_192[j].subPaths){var sp=_192[j].subPaths;spType=typeof sp;if(spType=="string"){sp=[sp];}else{if(spType=="object"&&spType.constructor==Object){sp=[sp];}}this.flattenSubPaths(_1a0,sp);}var _1a2=_1a0.data;var _1a3=_1a2.length;var _1a4=_197[j]+"/";var _1a5=_19e.length;var _1a6=[];for(var k=0;k<_1a5;k++){var _1a8=_19e[k];for(var l=0;l<_1a3;l++){var _1aa=new Object;var _1ab=_1a2[l];for(prop in _1a8){_1aa[prop]=_1a8[prop];}for(var prop in _1ab){var _1ad=_1a4+prop;if(_1a4==(prop+"/")||_1a4.search(new RegExp("\\/"+prop+"\\/$"))!=-1){_1ad=_197[j];}_1aa[_1ad]=_1ab[prop];}_1a6.push(_1aa);}}_19e=_1a6;}}_19c=_19c.concat(_19e);}data=_19c;_19b=data.length;for(i=0;i<_19b;i++){row=data[i];row.ds_RowID=i;_195[row.ds_RowID]=row;}rs.data=data;rs.dataHash=_195;};Spry.Data.XMLDataSet.prototype.loadDataIntoDataSet=function(_1ae){var rs=null;var _1b0=Spry.Data.Region.processDataRefString(null,this.xpath,this.dataSetsForDataRefStrings);var _1b1=this.subPaths;var _1b2=false;if(this.subPaths&&this.subPaths.length>0){var _1b3=[];var _1b4=_1b1.length;for(var i=0;i<_1b4;i++){var _1b6=Spry.Data.Region.processDataRefString(null,_1b1[i],this.dataSetsForDataRefStrings);if(_1b6.charAt(0)!="/"){_1b6=_1b0+"/"+_1b6;}_1b3.push(_1b6);}_1b3.unshift(_1b0);var _1b7=this.convertXPathsToPathTree(_1b3);_1b0=_1b7.path;_1b1=_1b7.subPaths;_1b2=_1b7.xpath?false:true;}rs=Spry.Utils.getRecordSetFromXMLDoc(_1ae,_1b0,_1b2);if(!rs){Spry.Debug.reportError("Spry.Data.XMLDataSet.loadDataIntoDataSet() failed to create dataSet '"+this.name+"'for '"+this.xpath+"' - "+this.url+"\n");return;}this.flattenSubPaths(rs,_1b1);this.doc=rs.xmlDoc;this.data=rs.data;this.dataHash=rs.dataHash;this.dataWasLoaded=(this.doc!=null);};Spry.Data.XMLDataSet.prototype.xhRequestProcessor=function(_1b8){var resp=_1b8.responseXML;var _1ba=false;if(_1b8.status!=200){if(_1b8.status==0){if(_1b8.responseText&&(!resp||!resp.firstChild)){_1ba=true;}}}else{if(!resp){_1ba=true;}}if(_1ba){resp=Spry.Utils.stringToXMLDoc(_1b8.responseText);}if(!resp||!resp.firstChild||resp.firstChild.nodeName=="parsererror"){return null;}return resp;};Spry.Data.XMLDataSet.prototype.sessionExpiredChecker=function(req){if(req.xhRequest.responseText=="session expired"){return true;}else{if(req.rawData){var _1bc=req.rawData.documentElement.firstChild;if(_1bc&&_1bc.nodeValue=="session expired"){return true;}}}return false;};Spry.Data.Region=function(_1bd,name,_1bf,data,_1c1,_1c2,_1c3,_1c4){this.regionNode=_1bd;this.name=name;this.isDetailRegion=_1bf;this.data=data;this.dataSets=_1c1;this.hasBehaviorAttributes=_1c4;this.tokens=null;this.currentState=null;this.states={ready:true};this.stateMap={};Spry.Utils.setOptions(this.states,_1c2);Spry.Utils.setOptions(this.stateMap,_1c3);for(var i=0;i<this.dataSets.length;i++){var ds=this.dataSets[i];try{if(ds){ds.addObserver(this);}}catch(e){Spry.Debug.reportError("Failed to add '"+this.name+"' as a dataSet observer!\n");}}};Spry.Data.Region.hiddenRegionClassName="SpryHiddenRegion";Spry.Data.Region.evenRowClassName="even";Spry.Data.Region.oddRowClassName="odd";Spry.Data.Region.notifiers={};Spry.Data.Region.evalScripts=true;Spry.Data.Region.addObserver=function(_1c7,_1c8){var n=Spry.Data.Region.notifiers[_1c7];if(!n){n=new Spry.Utils.Notifier();Spry.Data.Region.notifiers[_1c7]=n;}n.addObserver(_1c8);};Spry.Data.Region.removeObserver=function(_1ca,_1cb){var n=Spry.Data.Region.notifiers[_1ca];if(n){n.removeObserver(_1cb);}};Spry.Data.Region.notifyObservers=function(_1cd,_1ce,data){var n=Spry.Data.Region.notifiers[_1ce.name];if(n){var _1d1={};if(data&&typeof data=="object"){_1d1=data;}else{_1d1.data=data;}_1d1.region=_1ce;_1d1.regionID=_1ce.name;_1d1.regionNode=_1ce.regionNode;n.notifyObservers(_1cd,_1d1);}};Spry.Data.Region.RS_Error=1;Spry.Data.Region.RS_LoadingData=2;Spry.Data.Region.RS_PreUpdate=4;Spry.Data.Region.RS_PostUpdate=8;Spry.Data.Region.prototype.getState=function(){return this.currentState;};Spry.Data.Region.prototype.mapState=function(_1d2,_1d3){this.stateMap[_1d2]=_1d3;};Spry.Data.Region.prototype.getMappedState=function(_1d4){var _1d5=this.stateMap[_1d4];return _1d5?_1d5:_1d4;};Spry.Data.Region.prototype.setState=function(_1d6,_1d7){var _1d8={state:_1d6,mappedState:this.getMappedState(_1d6)};if(!_1d7){Spry.Data.Region.notifyObservers("onPreStateChange",this,_1d8);}this.currentState=_1d8.mappedState?_1d8.mappedState:_1d6;if(this.states[_1d6]){var _1d9={state:this.currentState};if(!_1d7){Spry.Data.Region.notifyObservers("onPreUpdate",this,_1d9);}var str=this.transform();if(Spry.Data.Region.debug){Spry.Debug.trace("<hr />Generated region markup for '"+this.name+"':<br /><br />"+Spry.Utils.encodeEntities(str));}Spry.Utils.setInnerHTML(this.regionNode,str,!Spry.Data.Region.evalScripts);if(this.hasBehaviorAttributes){this.attachBehaviors();}if(!_1d7){Spry.Data.Region.notifyObservers("onPostUpdate",this,_1d9);}}if(!_1d7){Spry.Data.Region.notifyObservers("onPostStateChange",this,_1d8);}};Spry.Data.Region.prototype.getDataSets=function(){return this.dataSets;};Spry.Data.Region.prototype.addDataSet=function(_1db){if(!_1db){return;}if(!this.dataSets){this.dataSets=new Array;}for(var i=0;i<this.dataSets.length;i++){if(this.dataSets[i]==_1db){return;}}this.dataSets.push(_1db);_1db.addObserver(this);};Spry.Data.Region.prototype.removeDataSet=function(_1dd){if(!_1dd||this.dataSets){return;}for(var i=0;i<this.dataSets.length;i++){if(this.dataSets[i]==_1dd){this.dataSets.splice(i,1);_1dd.removeObserver(this);return;}}};Spry.Data.Region.prototype.onPreLoad=function(_1df){if(this.currentState!="loading"){this.setState("loading");}};Spry.Data.Region.prototype.onLoadError=function(_1e0){if(this.currentState!="error"){this.setState("error");}Spry.Data.Region.notifyObservers("onError",this);};Spry.Data.Region.prototype.onSessionExpired=function(_1e1){if(this.currentState!="expired"){this.setState("expired");}Spry.Data.Region.notifyObservers("onExpired",this);};Spry.Data.Region.prototype.onCurrentRowChanged=function(_1e2,data){if(this.isDetailRegion){this.updateContent();}};Spry.Data.Region.prototype.onPostSort=function(_1e4,data){this.updateContent();};Spry.Data.Region.prototype.onDataChanged=function(_1e6,data){this.updateContent();};Spry.Data.Region.enableBehaviorAttributes=true;Spry.Data.Region.behaviorAttrs={};Spry.Data.Region.behaviorAttrs["spry:select"]={attach:function(rgn,node,_1ea){var _1eb=null;try{_1eb=node.attributes.getNamedItem("spry:selectgroup").value;}catch(e){}if(!_1eb){_1eb="default";}Spry.Utils.addEventListener(node,"click",function(_1ec){Spry.Utils.SelectionManager.select(_1eb,node,_1ea);},false);if(node.attributes.getNamedItem("spry:selected")){Spry.Utils.SelectionManager.select(_1eb,node,_1ea);}}};Spry.Data.Region.behaviorAttrs["spry:hover"]={attach:function(rgn,node,_1ef){Spry.Utils.addEventListener(node,"mouseover",function(_1f0){Spry.Utils.addClassName(node,_1ef);},false);Spry.Utils.addEventListener(node,"mouseout",function(_1f1){Spry.Utils.removeClassName(node,_1ef);},false);}};Spry.Data.Region.setUpRowNumberForEvenOddAttr=function(node,attr,_1f4,_1f5){if(!_1f4){Spry.Debug.showError("The "+attr+" attribute requires a CSS class name as its value!");node.attributes.removeNamedItem(attr);return;}var _1f6="";var _1f7=_1f4.split(/\s/);if(_1f7.length>1){_1f6=_1f7[0];node.setAttribute(attr,_1f7[1]);}node.setAttribute(_1f5,"{"+(_1f6?(_1f6+"::"):"")+"ds_RowNumber}");};Spry.Data.Region.behaviorAttrs["spry:even"]={setup:function(node,_1f9){Spry.Data.Region.setUpRowNumberForEvenOddAttr(node,"spry:even",_1f9,"spryevenrownumber");},attach:function(rgn,node,_1fc){if(_1fc){rowNumAttr=node.attributes.getNamedItem("spryevenrownumber");if(rowNumAttr&&rowNumAttr.value){var _1fd=parseInt(rowNumAttr.value);if(_1fd%2){Spry.Utils.addClassName(node,_1fc);}}}node.removeAttribute("spry:even");node.removeAttribute("spryevenrownumber");}};Spry.Data.Region.behaviorAttrs["spry:odd"]={setup:function(node,_1ff){Spry.Data.Region.setUpRowNumberForEvenOddAttr(node,"spry:odd",_1ff,"spryoddrownumber");},attach:function(rgn,node,_202){if(_202){rowNumAttr=node.attributes.getNamedItem("spryoddrownumber");if(rowNumAttr&&rowNumAttr.value){var _203=parseInt(rowNumAttr.value);if(_203%2==0){Spry.Utils.addClassName(node,_202);}}}node.removeAttribute("spry:odd");node.removeAttribute("spryoddrownumber");}};Spry.Data.Region.setRowAttrClickHandler=function(node,_205,_206,_207){if(_205){var ds=null;try{ds=Spry.Utils.eval(_205);}catch(e){ds=null;}if(ds){rowIDAttr=node.attributes.getNamedItem(_206);if(rowIDAttr){var _209=rowIDAttr.value;if(_209){Spry.Utils.addEventListener(node,"click",function(_20a){ds[_207](_209);},false);}}}}};Spry.Data.Region.behaviorAttrs["spry:setrow"]={setup:function(node,_20c){if(!_20c){Spry.Debug.reportError("The spry:setrow attribute requires a data set name as its value!");node.removeAttribute("spry:setrow");return;}node.setAttribute("spryrowid","{"+_20c+"::ds_RowID}");},attach:function(rgn,node,_20f){Spry.Data.Region.setRowAttrClickHandler(node,_20f,"spryrowid","setCurrentRow");node.removeAttribute("spry:setrow");node.removeAttribute("spryrowid");}};Spry.Data.Region.behaviorAttrs["spry:setrownumber"]={setup:function(node,_211){if(!_211){Spry.Debug.reportError("The spry:setrownumber attribute requires a data set name as its value!");node.removeAttribute("spry:setrownumber");return;}node.setAttribute("spryrownumber","{"+_211+"::ds_RowID}");},attach:function(rgn,node,_214){Spry.Data.Region.setRowAttrClickHandler(node,_214,"spryrownumber","setCurrentRowNumber");node.removeAttribute("spry:setrownumber");node.removeAttribute("spryrownumber");}};Spry.Data.Region.behaviorAttrs["spry:sort"]={attach:function(rgn,node,_217){if(!_217){return;}var ds=rgn.getDataSets()[0];var _219="toggle";var _21a=_217.split(/\s/);if(_21a.length>1){try{var _21b=eval(_21a[0]);if(_21b&&(typeof _21b)=="object"){ds=_21b;_21a.shift();}}catch(e){}if(_21a.length>1){var str=_21a[_21a.length-1];if(str=="ascending"||str=="descending"||str=="toggle"){_219=str;_21a.pop();}}}if(ds&&_21a.length>0){Spry.Utils.addEventListener(node,"click",function(_21d){ds.sort(_21a,_219);},false);}node.removeAttribute("spry:sort");}};Spry.Data.Region.prototype.attachBehaviors=function(){var rgn=this;Spry.Utils.getNodesByFunc(this.regionNode,function(node){if(!node||node.nodeType!=1){return false;}try{var _220=Spry.Data.Region.behaviorAttrs;for(var _221 in _220){var attr=node.attributes.getNamedItem(_221);if(attr){var _223=_220[_221];if(_223&&_223.attach){_223.attach(rgn,node,attr.value);}}}}catch(e){}return false;});};Spry.Data.Region.prototype.updateContent=function(){var _224=true;var _225=this.getDataSets();if(!_225||_225.length<1){Spry.Debug.reportError("updateContent(): Region '"+this.name+"' has no data set!\n");return;}for(var i=0;i<_225.length;i++){var ds=_225[i];if(ds){if(ds.getLoadDataRequestIsPending()){_224=false;}else{if(!ds.getDataWasLoaded()){ds.loadData();_224=false;}}}}if(!_224){Spry.Data.Region.notifyObservers("onLoadingData",this);return;}this.setState("ready");};Spry.Data.Region.prototype.clearContent=function(){this.regionNode.innerHTML="";};Spry.Data.Region.processContentPI=function(_228){var _229="";var _22a=/<!--\s*<\/?spry:content\s*[^>]*>\s*-->/mg;var _22b=0;var _22c=0;while(_228.length){var _22d=_22a.exec(_228);if(!_22d||!_22d[0]){_229+=_228.substr(_22b,_228.length-_22b);break;}if(!_22c&&_22d.index!=_22b){_229+=_228.substr(_22b,_22d.index-_22b);}if(_22d[0].search(/<\//)!=-1){--_22c;if(_22c){Spry.Debug.reportError("Nested spry:content regions are not allowed!\n");}}else{++_22c;var _22e=_22d[0].replace(/.*\bdataref="/,"");_229+=_22e.replace(/".*$/,"");}_22b=_22a.lastIndex;}return _229;};Spry.Data.Region.prototype.tokenizeData=function(_22f){if(!_22f){return null;}var _230=new Spry.Data.Region.Token(Spry.Data.Region.Token.LIST_TOKEN,null,null,null);var _231=new Array;var _232=Spry.Data.Region.processContentPI(_22f);_231.push(_230);var _233=/((<!--\s*){0,1}<\/{0,1}spry:[^>]+>(\s*-->){0,1})|((\{|%7[bB])[^\}\s%]+(\}|%7[dD]))/mg;var _234=0;while(_232.length){var _235=_233.exec(_232);var _236=null;if(!_235||!_235[0]){var str=_232.substr(_234,_232.length-_234);_236=new Spry.Data.Region.Token(Spry.Data.Region.Token.STRING_TOKEN,null,str,str);_231[_231.length-1].addChild(_236);break;}if(_235.index!=_234){var str=_232.substr(_234,_235.index-_234);_236=new Spry.Data.Region.Token(Spry.Data.Region.Token.STRING_TOKEN,null,str,str);_231[_231.length-1].addChild(_236);}if(_235[0].search(/^({|%7[bB])/)!=-1){var _239=_235[0];var _23a=_235[0];_239=_239.replace(/^({|%7[bB])/,"");_239=_239.replace(/(}|%7[dD])$/,"");var _23b=null;var _23c=_239.split(/::/);if(_23c.length>1){_23b=_23c[0];_239=_23c[1];}_23a=_23a.replace(/^%7[bB]/,"{");_23a=_23a.replace(/%7[dD]$/,"}");_236=new Spry.Data.Region.Token(Spry.Data.Region.Token.VALUE_TOKEN,_23b,_239,new String(_23a));_231[_231.length-1].addChild(_236);}else{if(_235[0].charAt(0)=="<"){var _23d=_235[0].replace(/^(<!--\s*){0,1}<\/?/,"");_23d=_23d.replace(/>(\s*-->){0,1}|\s.*$/,"");if(_235[0].search(/<\//)!=-1){if(_231[_231.length-1].tokenType!=Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN){Spry.Debug.reportError("Invalid processing instruction close tag: "+_23d+" -- "+_235[0]+"\n");return null;}_231.pop();}else{var _23e=Spry.Data.Region.PI.instructions[_23d];if(_23e){var _23f=null;var _240="";if(_235[0].search(/^.*\bselect=\"/)!=-1){_240=_235[0].replace(/^.*\bselect=\"/,"");_240=_240.replace(/".*$/,"");if(_240){try{_23f=eval(_240);}catch(e){Spry.Debug.reportError("Caught exception in tokenizeData() while trying to retrieve data set ("+_240+"): "+e+"\n");_23f=null;_240="";}}}var _241=null;if(_235[0].search(/^.*\btest=\"/)!=-1){_241=_235[0].replace(/^.*\btest=\"/,"");_241=_241.replace(/".*$/,"");_241=Spry.Utils.decodeEntities(_241);}var _242=null;if(_235[0].search(/^.*\bname=\"/)!=-1){_242=_235[0].replace(/^.*\bname=\"/,"");_242=_242.replace(/".*$/,"");_242=Spry.Utils.decodeEntities(_242);}var _243=new Spry.Data.Region.Token.PIData(_23d,_240,_241,_242);_236=new Spry.Data.Region.Token(Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN,_23f,_243,new String(_235[0]));_231[_231.length-1].addChild(_236);_231.push(_236);}else{Spry.Debug.reportError("Unsupported region processing instruction: "+_235[0]+"\n");return null;}}}else{Spry.Debug.reportError("Invalid region token: "+_235[0]+"\n");return null;}}_234=_233.lastIndex;}return _230;};Spry.Data.Region.prototype.processTokenChildren=function(_244,_245,_246){var _247=_245.children;var len=_247.length;for(var i=0;i<len;i++){this.processTokens(_244,_247[i],_246);}};Spry.Data.Region.prototype.processTokens=function(_24a,_24b,_24c){var i=0;switch(_24b.tokenType){case Spry.Data.Region.Token.LIST_TOKEN:this.processTokenChildren(_24a,_24b,_24c);break;case Spry.Data.Region.Token.STRING_TOKEN:_24a.push(_24b.data);break;case Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN:if(_24b.data.name=="spry:repeat"){var _24e=null;if(_24b.dataSet){_24e=_24b.dataSet;}else{_24e=this.dataSets[0];}if(_24e){var _24f=_24c.getDataSetContext(_24e);if(!_24f){Spry.Debug.reportError("processTokens() failed to get a data set context!\n");break;}_24f.pushState();var _250=_24f.getData();var _251=_250.length;for(i=0;i<_251;i++){_24f.setRowIndex(i);var _252=true;if(_24b.data.jsExpr){var _253=Spry.Data.Region.processDataRefString(_24c,_24b.data.jsExpr,null,true);try{_252=Spry.Utils.eval(_253);}catch(e){Spry.Debug.trace("Caught exception in Spry.Data.Region.prototype.processTokens while evaluating: "+_253+"\n    Exception:"+e+"\n");_252=true;}}if(_252){this.processTokenChildren(_24a,_24b,_24c);}}_24f.popState();}}else{if(_24b.data.name=="spry:if"){var _254=true;if(_24b.data.jsExpr){var _255=Spry.Data.Region.processDataRefString(_24c,_24b.data.jsExpr,null,true);try{_254=Spry.Utils.eval(_255);}catch(e){Spry.Debug.trace("Caught exception in Spry.Data.Region.prototype.processTokens while evaluating: "+_255+"\n    Exception:"+e+"\n");_254=true;}}if(_254){this.processTokenChildren(_24a,_24b,_24c);}}else{if(_24b.data.name=="spry:choose"){var _256=null;var _257=null;var _258=false;var j=0;for(j=0;j<_24b.children.length;j++){var _25a=_24b.children[j];if(_25a.tokenType==Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN){if(_25a.data.name=="spry:when"){if(_25a.data.jsExpr){var _25b=Spry.Data.Region.processDataRefString(_24c,_25a.data.jsExpr,null,true);try{_258=Spry.Utils.eval(_25b);}catch(e){Spry.Debug.trace("Caught exception in Spry.Data.Region.prototype.processTokens while evaluating: "+_25b+"\n    Exception:"+e+"\n");_258=false;}if(_258){_257=_25a;break;}}}else{if(_25a.data.name=="spry:default"){_256=_25a;}}}}if(!_257&&_256){_257=_256;}if(_257){this.processTokenChildren(_24a,_257,_24c);}}else{if(_24b.data.name=="spry:state"){var _25c=true;if(!_24b.data.regionState||_24b.data.regionState==this.currentState){this.processTokenChildren(_24a,_24b,_24c);}}else{Spry.Debug.reportError("processTokens(): Unknown processing instruction: "+_24b.data.name+"\n");return "";}}}}break;case Spry.Data.Region.Token.VALUE_TOKEN:var _25d=_24b.dataSet;if(!_25d&&this.dataSets&&this.dataSets.length>0&&this.dataSets[0]){_25d=this.dataSets[0];}if(!_25d){Spry.Debug.reportError("processTokens(): Value reference has no data set specified: "+_24b.regionStr+"\n");return "";}var _25e=_24c.getDataSetContext(_25d);if(!_25e){Spry.Debug.reportError("processTokens: Failed to get a data set context!\n");return "";}var ds=_25e.getDataSet();if(_24b.data=="ds_RowNumber"){_24a.push(_25e.getRowIndex());}else{if(_24b.data=="ds_RowNumberPlus1"){_24a.push(_25e.getRowIndex()+1);}else{if(_24b.data=="ds_RowCount"){_24a.push(_25e.getNumRows());}else{if(_24b.data=="ds_UnfilteredRowCount"){_24a.push(_25e.getNumRows(true));}else{if(_24b.data=="ds_CurrentRowNumber"){_24a.push(ds.getRowNumber(ds.getCurrentRow()));}else{if(_24b.data=="ds_CurrentRowID"){_24a.push(ds.getCurrentRowID());}else{if(_24b.data=="ds_EvenOddRow"){_24a.push((_25e.getRowIndex()%2)?Spry.Data.Region.evenRowClassName:Spry.Data.Region.oddRowClassName);}else{if(_24b.data=="ds_SortOrder"){_24a.push(ds.getSortOrder());}else{if(_24b.data=="ds_SortColumn"){_24a.push(ds.getSortColumn());}else{var _260=_25e.getCurrentRow();if(_260){_24a.push(_260[_24b.data]);}}}}}}}}}}break;default:Spry.Debug.reportError("processTokens(): Invalid token type: "+_24b.regionStr+"\n");break;}};Spry.Data.Region.prototype.transform=function(){if(this.data&&!this.tokens){this.tokens=this.tokenizeData(this.data);}if(!this.tokens){return "";}processContext=new Spry.Data.Region.ProcessingContext(this);if(!processContext){return "";}var _261=[""];this.processTokens(_261,this.tokens,processContext);return _261.join("");};Spry.Data.Region.PI={};Spry.Data.Region.PI.instructions={};Spry.Data.Region.PI.buildOpenTagForValueAttr=function(ele,_263,_264){if(!ele||!_263){return "";}var _265="";try{var _266=ele.attributes.getNamedItem(_263);if(_266&&_266.value){_265=Spry.Utils.encodeEntities(_266.value);}}catch(e){_265="";}if(!_265){Spry.Debug.reportError(_263+" attribute requires a JavaScript expression that returns true or false!\n");return "";}return "<"+Spry.Data.Region.PI.instructions[_263].tagName+" "+_264+"=\""+_265+"\">";};Spry.Data.Region.PI.buildOpenTagForTest=function(ele,_268){return Spry.Data.Region.PI.buildOpenTagForValueAttr(ele,_268,"test");};Spry.Data.Region.PI.buildOpenTagForState=function(ele,_26a){return Spry.Data.Region.PI.buildOpenTagForValueAttr(ele,_26a,"name");};Spry.Data.Region.PI.buildOpenTagForRepeat=function(ele,_26c){if(!ele||!_26c){return "";}var _26d="";try{var _26e=ele.attributes.getNamedItem(_26c);if(_26e&&_26e.value){_26d=_26e.value;_26d=_26d.replace(/\s/g,"");}}catch(e){_26d="";}if(!_26d){Spry.Debug.reportError(_26c+" attribute requires a data set name!\n");return "";}var _26f="";try{var _270=ele.attributes.getNamedItem("spry:test");if(_270){if(_270.value){_26f=" test=\""+Spry.Utils.encodeEntities(_270.value)+"\"";}ele.attributes.removeNamedItem(_270.nodeName);}}catch(e){_26f="";}return "<"+Spry.Data.Region.PI.instructions[_26c].tagName+" select=\""+_26d+"\""+_26f+">";};Spry.Data.Region.PI.buildOpenTagForContent=function(ele,_272){if(!ele||!_272){return "";}var _273="";try{var _274=ele.attributes.getNamedItem(_272);if(_274&&_274.value){_273=Spry.Utils.encodeEntities(_274.value);}}catch(e){_273="";}if(!_273){Spry.Debug.reportError(_272+" attribute requires a data reference!\n");return "";}return "<"+Spry.Data.Region.PI.instructions[_272].tagName+" dataref=\""+_273+"\">";};Spry.Data.Region.PI.buildOpenTag=function(ele,_276){return "<"+Spry.Data.Region.PI.instructions[_276].tagName+">";};Spry.Data.Region.PI.buildCloseTag=function(ele,_278){return "</"+Spry.Data.Region.PI.instructions[_278].tagName+">";};Spry.Data.Region.PI.instructions["spry:state"]={tagName:"spry:state",childrenOnly:false,getOpenTag:Spry.Data.Region.PI.buildOpenTagForState,getCloseTag:Spry.Data.Region.PI.buildCloseTag};Spry.Data.Region.PI.instructions["spry:if"]={tagName:"spry:if",childrenOnly:false,getOpenTag:Spry.Data.Region.PI.buildOpenTagForTest,getCloseTag:Spry.Data.Region.PI.buildCloseTag};Spry.Data.Region.PI.instructions["spry:repeat"]={tagName:"spry:repeat",childrenOnly:false,getOpenTag:Spry.Data.Region.PI.buildOpenTagForRepeat,getCloseTag:Spry.Data.Region.PI.buildCloseTag};Spry.Data.Region.PI.instructions["spry:repeatchildren"]={tagName:"spry:repeat",childrenOnly:true,getOpenTag:Spry.Data.Region.PI.buildOpenTagForRepeat,getCloseTag:Spry.Data.Region.PI.buildCloseTag};Spry.Data.Region.PI.instructions["spry:choose"]={tagName:"spry:choose",childrenOnly:true,getOpenTag:Spry.Data.Region.PI.buildOpenTag,getCloseTag:Spry.Data.Region.PI.buildCloseTag};Spry.Data.Region.PI.instructions["spry:when"]={tagName:"spry:when",childrenOnly:false,getOpenTag:Spry.Data.Region.PI.buildOpenTagForTest,getCloseTag:Spry.Data.Region.PI.buildCloseTag};Spry.Data.Region.PI.instructions["spry:default"]={tagName:"spry:default",childrenOnly:false,getOpenTag:Spry.Data.Region.PI.buildOpenTag,getCloseTag:Spry.Data.Region.PI.buildCloseTag};Spry.Data.Region.PI.instructions["spry:content"]={tagName:"spry:content",childrenOnly:true,getOpenTag:Spry.Data.Region.PI.buildOpenTagForContent,getCloseTag:Spry.Data.Region.PI.buildCloseTag};Spry.Data.Region.PI.orderedInstructions=["spry:state","spry:if","spry:repeat","spry:repeatchildren","spry:choose","spry:when","spry:default","spry:content"];Spry.Data.Region.getTokensFromStr=function(str){if(!str){return null;}return str.match(/{[^}]+}/g);};Spry.Data.Region.processDataRefString=function(_27a,_27b,_27c,_27d){if(!_27b){return "";}if(!_27a&&!_27c){return _27b;}var _27e="";var re=new RegExp("\\{([^\\}:]+::)?[^\\}]+\\}","g");var _280=0;while(_280<_27b.length){var _281=re.exec(_27b);if(!_281||!_281[0]){_27e+=_27b.substr(_280,_27b.length-_280);return _27e;}if(_281.index!=_280){_27e+=_27b.substr(_280,_281.index-_280);}var _282="";if(_281[0].search(/^\{[^}:]+::/)!=-1){_282=_281[0].replace(/^\{|::.*/g,"");}var _283=_281[0].replace(/^\{|.*::|\}/g,"");var row=null;if(_27a){var _285=_27a.getDataSetContext(_282);if(_283=="ds_RowNumber"){_27e+=_285.getRowIndex();row=null;}else{if(_283=="ds_RowNumberPlus1"){_27e+=(_285.getRowIndex()+1);row=null;}else{if(_283=="ds_RowCount"){_27e+=_285.getNumRows();row=null;}else{if(_283=="ds_UnfilteredRowCount"){_27e+=_285.getNumRows(true);row=null;}else{if(_283=="ds_CurrentRowNumber"){var ds=_285.getDataSet();_27e+=ds.getRowNumber(ds.getCurrentRow());row=null;}else{if(_283=="ds_CurrentRowID"){var ds=_285.getDataSet();_27e+=""+ds.getCurrentRowID();row=null;}else{if(_283=="ds_EvenOddRow"){_27e+=(_285.getRowIndex()%2)?Spry.Data.Region.evenRowClassName:Spry.Data.Region.oddRowClassName;row=null;}else{if(_283=="ds_SortOrder"){_27e+=_285.getDataSet().getSortOrder();row=null;}else{if(_283=="ds_SortColumn"){_27e+=_285.getDataSet().getSortColumn();row=null;}else{row=_27a.getCurrentRowForDataSet(_282);}}}}}}}}}}else{var ds=_282?_27c[_282]:_27c[0];if(ds){row=ds.getCurrentRow();}}if(row){_27e+=_27d?Spry.Utils.escapeQuotesAndLineBreaks(""+row[_283]):row[_283];}if(_280==re.lastIndex){var _289=_281.index+_281[0].length;if(_289<_27b.length){_27e+=_27b.substr(_289);}break;}_280=re.lastIndex;}return _27e;};Spry.Data.Region.strToDataSetsArray=function(str,_28b){var _28c=new Array;var _28d={};if(!str){return _28c;}str=str.replace(/\s+/g," ");str=str.replace(/^\s|\s$/g,"");var arr=str.split(/ /);for(var i=0;i<arr.length;i++){if(arr[i]&&!Spry.Data.Region.PI.instructions[arr[i]]){try{var _290=eval(arr[i]);if(!_28d[arr[i]]){if(_28b){_28c.push(arr[i]);}else{_28c.push(_290);}_28d[arr[i]]=true;}}catch(e){}}}return _28c;};Spry.Data.Region.DSContext=function(_291,_292){var _293=_291;var _294=_292;var _295=[{rowIndex:-1}];var _296=null;var _297=[];function getInternalRowIndex(){return _295[_295.length-1].rowIndex;}this.resetAll=function(){_295=[{rowIndex:_293.getCurrentRow()}];};this.getDataSet=function(){return _293;};this.getNumRows=function(_298){var data=this.getCurrentState().data;return data?data.length:_293.getRowCount(_298);};this.getData=function(){var data=this.getCurrentState().data;return data?data:_293.getData();};this.setData=function(data){this.getCurrentState().data=data;};this.getCurrentRow=function(){if(_295.length<2||getInternalRowIndex()<0){return _293.getCurrentRow();}var data=this.getData();var _29d=getInternalRowIndex();if(_29d<0||_29d>data.length){Spry.Debug.reportError("Invalid index used in Spry.Data.Region.DSContext.getCurrentRow()!\n");return null;}return data[_29d];};this.getRowIndex=function(){var _29e=getInternalRowIndex();if(_29e>=0){return _29e;}return _293.getRowNumber(_293.getCurrentRow());};this.setRowIndex=function(_29f){this.getCurrentState().rowIndex=_29f;var data=this.getData();var _2a1=_297.length;for(var i=0;i<_2a1;i++){_297[i].syncDataWithParentRow(this,_29f,data);}};this.syncDataWithParentRow=function(_2a3,_2a4,_2a5){var row=_2a5[_2a4];if(row){nestedDS=_293.getNestedDataSetForParentRow(row);if(nestedDS){var _2a7=this.getCurrentState();_2a7.data=nestedDS.getData();_2a7.rowIndex=nestedDS.getCurrentRowNumber();var _2a8=_297.length;for(var i=0;i<_2a8;i++){_297[i].syncDataWithParentRow(this,_2a7.rowIndex,_2a7.data);}}}};this.pushState=function(){var _2aa=this.getCurrentState();var _2ab=new Object;_2ab.rowIndex=_2aa.rowIndex;_2ab.data=_2aa.data;_295.push(_2ab);var _2ac=_297.length;for(var i=0;i<_2ac;i++){_297[i].pushState();}};this.popState=function(){if(_295.length<2){Spry.Debug.reportError("Stack underflow in Spry.Data.Region.DSContext.popState()!\n");return;}var _2ae=_297.length;for(var i=0;i<_2ae;i++){_297[i].popState();}_295.pop();};this.getCurrentState=function(){return _295[_295.length-1];};this.addChild=function(_2b0){var _2b1=_297.length;for(var i=0;i<_2b1;i++){if(_297[i]==_2b0){return;}}_297.push(_2b0);};};Spry.Data.Region.ProcessingContext=function(_2b3){this.region=_2b3;this.dataSetContexts=[];if(_2b3&&_2b3.dataSets){var _2b4=_2b3.dataSets.slice(0);var _2b5=_2b4.length;for(var i=0;i<_2b5;i++){var ds=_2b3.dataSets[i];while(ds&&ds.getParentDataSet){var _2b8=false;ds=ds.getParentDataSet();if(ds&&this.indexOf(_2b4,ds)==-1){_2b4.push(ds);}}}for(i=0;i<_2b4.length;i++){this.dataSetContexts.push(new Spry.Data.Region.DSContext(_2b4[i],this));}var _2b9=this.dataSetContexts;var _2ba=_2b9.length;for(i=0;i<_2ba;i++){var dsc=_2b9[i];var ds=dsc.getDataSet();if(ds.getParentDataSet){var _2bd=ds.getParentDataSet();if(_2bd){var pdsc=this.getDataSetContext(_2bd);if(pdsc){pdsc.addChild(dsc);}}}}}};Spry.Data.Region.ProcessingContext.prototype.indexOf=function(arr,item){if(arr){var _2c1=arr.length;for(var i=0;i<_2c1;i++){if(arr[i]==item){return i;}}}return -1;};Spry.Data.Region.ProcessingContext.prototype.getDataSetContext=function(_2c3){if(!_2c3){if(this.dataSetContexts.length>0){return this.dataSetContexts[0];}return null;}if(typeof _2c3=="string"){try{_2c3=eval(_2c3);}catch(e){_2c3=null;}if(!_2c3){return null;}}for(var i=0;i<this.dataSetContexts.length;i++){var dsc=this.dataSetContexts[i];if(dsc.getDataSet()==_2c3){return dsc;}}return null;};Spry.Data.Region.ProcessingContext.prototype.getCurrentRowForDataSet=function(_2c6){var dsc=this.getDataSetContext(_2c6);if(dsc){return dsc.getCurrentRow();}return null;};Spry.Data.Region.Token=function(_2c8,_2c9,data,_2cb){var self=this;this.tokenType=_2c8;this.dataSet=_2c9;this.data=data;this.regionStr=_2cb;this.parent=null;this.children=null;};Spry.Data.Region.Token.prototype.addChild=function(_2cd){if(!_2cd){return;}if(!this.children){this.children=new Array;}this.children.push(_2cd);_2cd.parent=this;};Spry.Data.Region.Token.LIST_TOKEN=0;Spry.Data.Region.Token.STRING_TOKEN=1;Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN=2;Spry.Data.Region.Token.VALUE_TOKEN=3;Spry.Data.Region.Token.PIData=function(_2ce,data,_2d0,_2d1){var self=this;this.name=_2ce;this.data=data;this.jsExpr=_2d0;this.regionState=_2d1;};Spry.Utils.addLoadListener(function(){setTimeout(function(){Spry.Data.initRegions();},0);});
