var Spry;
if(!Spry){
Spry={};
}
if(!Spry.Widget){
Spry.Widget={};
}

if(!Spry.Utils){
Spry.Utils={};
}
Spry.Utils.msProgIDs=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0"];
Spry.Utils.createXMLHttpRequest=function(){
var req=null;
try{
if(window.ActiveXObject){
while(!req&&Spry.Utils.msProgIDs.length){
try{
req=new ActiveXObject(Spry.Utils.msProgIDs[0]);
}
catch(e){
req=null;
}
if(!req){
Spry.Utils.msProgIDs.splice(0,1);
}
}
}
if(!req&&window.XMLHttpRequest){
req=new XMLHttpRequest();
}
}
catch(e){
req=null;
}
if(!req){
Spry.Debug.reportError("Failed to create an XMLHttpRequest object!");
}
return req;
};
Spry.Utils.loadURL=function(_3af,url,_3b1,_3b2,opts){
var req=new Spry.Utils.loadURL.Request();
req.method=_3af;
req.url=url;
req.async=_3b1;
req.successCallback=_3b2;
Spry.Utils.setOptions(req,opts);
try{
req.xhRequest=Spry.Utils.createXMLHttpRequest();
if(!req.xhRequest){
return null;
}
if(req.async){
req.xhRequest.onreadystatechange=function(){
Spry.Utils.loadURL.callback(req);
};
}
req.xhRequest.open(req.method,req.url,req.async,req.username,req.password);
if(req.headers){
for(var name in req.headers){
req.xhRequest.setRequestHeader(name,req.headers[name]);
}
}
req.xhRequest.send(req.postData);
if(!req.async){
Spry.Utils.loadURL.callback(req);
}
}
catch(e){
if(req.errorCallback){
req.errorCallback(req);
}else{
Spry.Debug.reportError("Exception caught while loading "+url+": "+e);
}
req=null;
}
return req;
};
Spry.Utils.loadURL.callback=function(req){
if(!req||req.xhRequest.readyState!=4){
return;
}
if(req.successCallback&&(req.xhRequest.status==200||req.xhRequest.status==0)){
req.successCallback(req);
}else{
if(req.errorCallback){
req.errorCallback(req);
}
}
};
Spry.Utils.loadURL.Request=function(){
var _3b7=Spry.Utils.loadURL.Request.props;
var _3b8=_3b7.length;
for(var i=0;i<_3b8;i++){
this[_3b7[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(opts,_3bb){
if(!opts){
return;
}
var _3bc=Spry.Utils.loadURL.Request.props;
var _3bd=_3bc.length;
for(var i=0;i<_3bd;i++){
var prop=_3bc[i];
if(opts[prop]!=undefined){
this[prop]=opts[prop];
if(_3bb){
opts[prop]=undefined;
}
}
}
};
Spry.Utils.loadURL.Request.prototype.clone=function(){
var _3c0=Spry.Utils.loadURL.Request.props;
var _3c1=_3c0.length;
var req=new Spry.Utils.loadURL.Request;
for(var i=0;i<_3c1;i++){
req[_3c0[i]]=this[_3c0[i]];
}
if(this.headers){
req.headers={};
Spry.Utils.setOptions(req.headers,this.headers);
}
return req;
};
Spry.Utils.setInnerHTML=function(ele,str,_3c6){
if(!ele){
return;
}
ele=Spry.$(ele);
var _3c7="<script[^>]*>(.|s|\n|\r)*?</script>";
ele.innerHTML=str.replace(new RegExp(_3c7,"img"),"");
if(_3c6){
return;
}
var _3c8=str.match(new RegExp(_3c7,"img"));
if(_3c8){
var _3c9=_3c8.length;
for(var i=0;i<_3c9;i++){
var s=_3c8[i].replace(/<script[^>]*>[\s\r\n]*(<\!--)?|(-->)?[\s\r\n]*<\/script>/img,"");
Spry.Utils.eval(s);
}
}
};
Spry.Utils.updateContent=function(ele,url,_3ce,opts){
Spry.Utils.loadURL("GET",url,true,function(req){
Spry.Utils.setInnerHTML(ele,req.xhRequest.responseText);
if(_3ce){
_3ce(ele,url);
}
},opts);
};
if(!Spry.$$){
Spry.Utils.addEventListener=function(_3d1,_3d2,_3d3,_3d4){
try{
_3d1=Spry.$(_3d1);
if(_3d1.addEventListener){
_3d1.addEventListener(_3d2,_3d3,_3d4);
}else{
if(_3d1.attachEvent){
_3d1.attachEvent("on"+_3d2,_3d3);
}
}
}
catch(e){
}
};
Spry.Utils.removeEventListener=function(_3d5,_3d6,_3d7,_3d8){
try{
_3d5=Spry.$(_3d5);
if(_3d5.removeEventListener){
_3d5.removeEventListener(_3d6,_3d7,_3d8);
}else{
if(_3d5.detachEvent){
_3d5.detachEvent("on"+_3d6,_3d7);
}
}
}
catch(e){
}
};
Spry.Utils.addLoadListener=function(_3d9){
if(typeof window.addEventListener!="undefined"){
window.addEventListener("load",_3d9,false);
}else{
if(typeof document.addEventListener!="undefined"){
document.addEventListener("load",_3d9,false);
}else{
if(typeof window.attachEvent!="undefined"){
window.attachEvent("onload",_3d9);
}
}
}
};
Spry.Utils.getAttribute=function(ele,name){
ele=Spry.$(ele);
if(!ele||!name){
return null;
}
try{
var _3dc=ele.getAttribute(name);
}
catch(e){
_3dc==undefined;
}
if(_3dc==undefined&&name.search(/:/)!=-1){
try{
var _3dc=ele.getAttribute(name.replace(/:/,""));
}
catch(e){
_3dc==undefined;
}
}
return _3dc;
};
Spry.Utils.setAttribute=function(ele,name,_3df){
ele=Spry.$(ele);
if(!ele||!name){
return;
}
if(name=="class"){
ele.className=_3df;
}else{
try{
ele.setAttribute(name,_3df);
}
catch(e){
}
if(name.search(/:/)!=-1&&ele.getAttribute(name)==undefined){
ele.setAttribute(name.replace(/:/,""),_3df);
}
}
};
Spry.Utils.removeAttribute=function(ele,name){
ele=Spry.$(ele);
if(!ele||!name){
return;
}
try{
ele.removeAttribute(name);
}
catch(e){
}
if(name.search(/:/)!=-1){
ele.removeAttribute(name.replace(/:/,""));
}
if(name=="class"){
ele.removeAttribute("className");
}
};
Spry.Utils.addClassName=function(ele,_3e3){
ele=Spry.$(ele);
if(!ele||!_3e3||(ele.className&&ele.className.search(new RegExp("\\b"+_3e3+"\\b"))!=-1)){
return;
}
ele.className+=(ele.className?" ":"")+_3e3;
};
Spry.Utils.removeClassName=function(ele,_3e5){
ele=Spry.$(ele);
if(!ele||!_3e5||(ele.className&&ele.className.search(new RegExp("\\b"+_3e5+"\\b"))==-1)){
return;
}
ele.className=ele.className.replace(new RegExp("\\s*\\b"+_3e5+"\\b","g"),"");
};
Spry.$=function(_3e6){
if(arguments.length>1){
for(var i=0,elements=[],length=arguments.length;i<length;i++){
elements.push(Spry.$(arguments[i]));
}
return elements;
}
if(typeof _3e6=="string"){
_3e6=document.getElementById(_3e6);
}
return _3e6;
};
}
Spry.Utils.getObjectByName=function(name){
var _3e9=null;
if(name){
var lu=window;
var _3eb=name.split(".");
for(var i=0;lu&&i<_3eb.length;i++){
_3e9=lu[_3eb[i]];
lu=_3e9;
}
}
return _3e9;
};
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(_3f2){
var _3f3="";
var _3f4=_3f2.match(/^<[^\s>]+\s*/)[0];
var _3f5=_3f2.match(/\s*\/?>$/)[0];
var _3f6=_3f2.replace(/^<[^\s>]+\s*|\s*\/?>/g,"");
_3f3+=_3f4;
if(_3f6){
var _3f7=0;
var _3f8=0;
while(_3f7<_3f6.length){
while(_3f6.charAt(_3f8)!="="&&_3f8<_3f6.length){
++_3f8;
}
if(_3f8>=_3f6.length){
_3f3+=_3f6.substring(_3f7,_3f8);
break;
}
++_3f8;
_3f3+=_3f6.substring(_3f7,_3f8);
_3f7=_3f8;
if(_3f6.charAt(_3f8)=="\""||_3f6.charAt(_3f8)=="'"){
var _3f9=_3f8++;
while(_3f8<_3f6.length){
if(_3f6.charAt(_3f8)==_3f6.charAt(_3f9)){
_3f8++;
break;
}else{
if(_3f6.charAt(_3f8)=="\\"){
_3f8++;
}
}
_3f8++;
}
_3f3+=_3f6.substring(_3f7,_3f8);
_3f7=_3f8;
}else{
_3f3+="\"";
var _3fa=_3f6.slice(_3f8).search(/\s/);
_3f8=(_3fa!=-1)?(_3f8+_3fa):_3f6.length;
_3f3+=_3f6.slice(_3f7,_3f8);
_3f3+="\"";
_3f7=_3f8;
}
}
}
_3f3+=_3f5;
return _3f3;
};
Spry.Utils.fixUpIEInnerHTML=function(_3fb){
var _3fc="";
var _3fd=new RegExp("<\\!--|<\\!\\[CDATA\\[|<\\w+[^<>]*>|-->|\\]\\](>|&gt;)","g");
var _3fe=0;
var _3ff=0;
while(_3fb.length){
var _400=_3fd.exec(_3fb);
if(!_400||!_400[0]){
_3fc+=_3fb.substr(_3fe,_3fb.length-_3fe);
break;
}
if(_400.index!=_3fe){
_3fc+=_3fb.substr(_3fe,_400.index-_3fe);
}
if(_400[0]=="<!--"||_400[0]=="<![CDATA["){
++_3ff;
_3fc+=_400[0];
}else{
if(_400[0]=="-->"||_400[0]=="]]>"||(_3ff&&_400[0]=="]]&gt;")){
--_3ff;
_3fc+=_400[0];
}else{
if(!_3ff&&_400[0].charAt(0)=="<"){
_3fc+=Spry.Utils.fixupIETagAttributes(_400[0]);
}else{
_3fc+=_400[0];
}
}
}
_3fe=_3fd.lastIndex;
}
return _3fc;
};
Spry.Utils.stringToXMLDoc=function(str){
var _402=null;
try{
var _403=new ActiveXObject("Microsoft.XMLDOM");
_403.async=false;
_403.loadXML(str);
_402=_403;
}
catch(e){
try{
var _404=new DOMParser;
_402=_404.parseFromString(str,"text/xml");
}
catch(e){
Spry.Debug.reportError("Caught exception in Spry.Utils.stringToXMLDoc(): "+e+"\n");
_402=null;
}
}
return _402;
};
Spry.Utils.serializeObject=function(obj){
var str="";
var _407=true;
if(obj==null||obj==undefined){
return str+obj;
}
var _408=typeof obj;
if(_408=="number"||_408=="boolean"){
str+=obj;
}else{
if(_408=="string"){
str+="\""+Spry.Utils.escapeQuotesAndLineBreaks(obj)+"\"";
}else{
if(obj.constructor==Array){
str+="[";
for(var i=0;i<obj.length;i++){
if(!_407){
str+=", ";
}
str+=Spry.Utils.serializeObject(obj[i]);
_407=false;
}
str+="]";
}else{
if(_408=="object"){
str+="{";
for(var p in obj){
if(!_407){
str+=", ";
}
str+="\""+p+"\": "+Spry.Utils.serializeObject(obj[p]);
_407=false;
}
str+="}";
}
}
}
}
return str;
};
Spry.Utils.getNodesByFunc=function(root,func){
var _40d=new Array;
var _40e=new Array;
var node=root;
while(node){
if(func(node)){
_40e.push(node);
}
if(node.hasChildNodes()){
_40d.push(node);
node=node.firstChild;
}else{
if(node==root){
node=null;
}else{
try{
node=node.nextSibling;
}
catch(e){
node=null;
}
}
}
while(!node&&_40d.length>0){
node=_40d.pop();
if(node==root){
node=null;
}else{
try{
node=node.nextSibling;
}
catch(e){
node=null;
}
}
}
}
if(_40d&&_40d.length>0){
Spry.Debug.trace("-- WARNING: Spry.Utils.getNodesByFunc() failed to traverse all nodes!\n");
}
return _40e;
};
Spry.Utils.getFirstChildWithNodeName=function(node,_411){
var _412=node.firstChild;
while(_412){
if(_412.nodeName==_411){
return _412;
}
_412=_412.nextSibling;
}
return null;
};
Spry.Utils.setOptions=function(obj,_414,_415){
if(!_414){
return;
}
for(var _416 in _414){
if(_415&&_414[_416]==undefined){
continue;
}
obj[_416]=_414[_416];
}
};
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(_417,_418,_419){
var _41a=null;
if(!_419){
this.clearSelection();
}else{
for(var i=0;i<this.selectedElements.length;i++){
_41a=this.selectedElements[i].element;
if(_41a.element==_417){
if(_41a.className!=_418){
Spry.Utils.removeClassName(_417,_41a.className);
Spry.Utils.addClassName(_417,_418);
}
return;
}
}
}
_41a=new Object;
_41a.element=_417;
_41a.className=_418;
this.selectedElements.push(_41a);
Spry.Utils.addClassName(_417,_418);
};
Spry.Utils.SelectionManager.SelectionGroup.prototype.unSelect=function(_41c){
for(var i=0;i<this.selectedElements.length;i++){
var _41e=this.selectedElements[i].element;
if(_41e.element==_41c){
Spry.Utils.removeClassName(_41e.element,_41e.className);
return;
}
}
};
Spry.Utils.SelectionManager.SelectionGroup.prototype.clearSelection=function(){
var _41f=null;
do{
_41f=this.selectedElements.shift();
if(_41f){
Spry.Utils.removeClassName(_41f.element,_41f.className);
}
}while(_41f);
};
Spry.Utils.SelectionManager.getSelectionGroup=function(_420){
if(!_420){
return null;
}
var _421=Spry.Utils.SelectionManager.selectionGroups[_420];
if(!_421){
_421=new Spry.Utils.SelectionManager.SelectionGroup();
Spry.Utils.SelectionManager.selectionGroups[_420]=_421;
}
return _421;
};
Spry.Utils.SelectionManager.select=function(_422,_423,_424,_425){
var _426=Spry.Utils.SelectionManager.getSelectionGroup(_422);
if(!_426){
return;
}
_426.select(_423,_424,_425);
};
Spry.Utils.SelectionManager.unSelect=function(_427,_428){
var _429=Spry.Utils.SelectionManager.getSelectionGroup(_427);
if(!_429){
return;
}
_429.unSelect(_428,className);
};
Spry.Utils.SelectionManager.clearSelection=function(_42a){
var _42b=Spry.Utils.SelectionManager.getSelectionGroup(_42a);
if(!_42b){
return;
}
_42b.clearSelection();
};
Spry.Utils.Notifier=function(){
this.observers=[];
this.suppressNotifications=0;
};
Spry.Utils.Notifier.prototype.addObserver=function(_42c){
if(!_42c){
return;
}
var len=this.observers.length;
for(var i=0;i<len;i++){
if(this.observers[i]==_42c){
return;
}
}
this.observers[len]=_42c;
};
Spry.Utils.Notifier.prototype.removeObserver=function(_42f){
if(!_42f){
return;
}
for(var i=0;i<this.observers.length;i++){
if(this.observers[i]==_42f){
this.observers.splice(i,1);
break;
}
}
};
Spry.Utils.Notifier.prototype.notifyObservers=function(_431,data){
if(!_431){
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(_431,this,data);
}else{
if(obs[_431]){
obs[_431](this,data);
}
}
}
}
}
};
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 msgs=Spry.Debug.flushQueuedMessages.msgs;
for(var i=0;i<msgs.length;i++){
Spry.Debug.debugOut(msgs[i].msg,msgs[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,_43a){
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:_43a});
return;
}
}
var d=document.createElement("div");
if(_43a){
d.style.backgroundColor=_43a;
}
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.initRegionsOnLoad=true;
Spry.Data.initRegions=function(_43e){
_43e=_43e?Spry.$(_43e):document.body;
var _43f=null;
var _440=Spry.Utils.getNodesByFunc(_43e,function(node){
try{
if(node.nodeType!=1){
return false;
}
var _442="spry:region";
var _443=Spry.Utils.getAttribute(node,_442);
if(_443==undefined){
_442="spry:detailregion";
_443=Spry.Utils.getAttribute(node,_442);
}
if(_443){
if(_43f){
var _444=node.parentNode;
while(_444){
if(_444==_43f){
Spry.Debug.reportError("Found a nested "+_442+" in the following markup. Nested regions are currently not supported.<br/><pre>"+Spry.Utils.encodeEntities(_444.innerHTML)+"</pre>");
return false;
}
_444=_444.parentNode;
}
}
_443=node.getAttribute("id");
if(!_443){
node.setAttribute("id","spryregion"+(++Spry.Data.initRegions.nextUniqueRegionID));
}
_43f=node;
return true;
}else{
if(_443==""){
Spry.Debug.reportError(_442+" attributes require one or more data set names as values!");
}
}
}
catch(e){
}
return false;
});
var name,dataSets,i;
var _446=[];
for(i=0;i<_440.length;i++){
var rgn=_440[i];
var _448=false;
name=rgn.getAttribute("id");
var _449="spry:region";
var _44a=Spry.Utils.getAttribute(rgn,_449);
if(_44a==undefined){
_449="spry:detailregion";
_44a=Spry.Utils.getAttribute(rgn,_449);
_448=true;
}
if(!_44a){
Spry.Debug.reportError("spry:region and spry:detailregion attributes require one or more data set names as values!");
continue;
}
Spry.Utils.removeAttribute(rgn,_449);
Spry.Utils.removeClassName(rgn,Spry.Data.Region.hiddenRegionClassName);
dataSets=Spry.Data.Region.strToDataSetsArray(_44a);
if(!dataSets.length){
Spry.Debug.reportError("spry:region or spry:detailregion attribute has no data set!");
continue;
}
var _44b=false;
var _44c=false;
var _44d="";
var _44e=null;
var _44f={};
var _450={};
_44a=Spry.Utils.getAttribute(rgn,"spry:readystate");
if(_44a){
_450["ready"]=_44a;
}
_44a=Spry.Utils.getAttribute(rgn,"spry:errorstate");
if(_44a){
_450["error"]=_44a;
}
_44a=Spry.Utils.getAttribute(rgn,"spry:loadingstate");
if(_44a){
_450["loading"]=_44a;
}
_44a=Spry.Utils.getAttribute(rgn,"spry:expiredstate");
if(_44a){
_450["expired"]=_44a;
}
var _451=Spry.Utils.getNodesByFunc(rgn,function(node){
try{
if(node.nodeType==1){
var _453=node.attributes;
var _454=Spry.Data.Region.PI.orderedInstructions.length;
var _455=null;
var _456=null;
for(var i=0;i<_454;i++){
var _458=Spry.Data.Region.PI.orderedInstructions[i];
var _459=Spry.Utils.getAttribute(node,_458);
if(_459==undefined){
continue;
}
var _45a=Spry.Data.Region.PI.instructions[_458];
var _45b=(node==rgn)?true:_45a.childrenOnly;
var _45c=_45a.getOpenTag(node,_458);
var _45d=_45a.getCloseTag(node,_458);
if(_45b){
var _45e=document.createComment(_45c);
var _45f=document.createComment(_45d);
if(!_455){
node.insertBefore(_45e,node.firstChild);
}else{
node.insertBefore(_45e,_455.nextSibling);
}
_455=_45e;
if(!_456){
node.appendChild(_45f);
}else{
node.insertBefore(_45f,_456);
}
_456=_45f;
}else{
var _460=node.parentNode;
_460.insertBefore(document.createComment(_45c),node);
_460.insertBefore(document.createComment(_45d),node.nextSibling);
}
if(_458=="spry:state"||_458=="sprystate"){
_44f[_459]=true;
}
Spry.Utils.removeAttribute(node,_458);
}
if(Spry.Data.Region.enableBehaviorAttributes){
var _461=Spry.Data.Region.behaviorAttrs;
for(var _462 in _461){
var _463=Spry.Utils.getAttribute(node,_462);
if(_463!=undefined){
_44b=true;
if(_461[_462].setup){
_461[_462].setup(node,_463);
}
}
}
}
}
}
catch(e){
}
return false;
});
_44d=rgn.innerHTML;
if(window.ActiveXObject&&!Spry.Data.Region.disableIEInnerHTMLFixUp&&_44d.search(/=\{/)!=-1){
if(Spry.Data.Region.debug){
Spry.Debug.trace("<hr />Performing IE innerHTML fix up of Region: "+name+"<br /><br />"+Spry.Utils.encodeEntities(_44d));
}
_44d=Spry.Utils.fixUpIEInnerHTML(_44d);
}
if(Spry.Data.Region.debug){
Spry.Debug.trace("<hr />Region template markup for '"+name+"':<br /><br />"+Spry.Utils.encodeEntities(_44d));
}
if(!_44c){
rgn.innerHTML="";
}
var _464=new Spry.Data.Region(rgn,name,_448,_44d,dataSets,_44f,_450,_44b);
Spry.Data.regionsArray[_464.name]=_464;
_446.push(_464);
}
for(var i=0;i<_446.length;i++){
_446[i].updateContent();
}
};
Spry.Data.initRegions.nextUniqueRegionID=0;
Spry.Data.updateRegion=function(_466){
if(!_466||!Spry.Data.regionsArray||!Spry.Data.regionsArray[_466]){
return;
}
try{
Spry.Data.regionsArray[_466].updateContent();
}
catch(e){
Spry.Debug.reportError("Spry.Data.updateRegion("+_466+") caught an exception: "+e+"\n");
}
};
Spry.Data.getRegion=function(_467){
return Spry.Data.regionsArray[_467];
};
Spry.Data.updateAllRegions=function(){
if(!Spry.Data.regionsArray){
return;
}
for(var _468 in Spry.Data.regionsArray){
Spry.Data.updateRegion(_468);
}
};
Spry.Data.getDataSetByName=function(_469){
var ds=Spry.Utils.getObjectByName(_469);
if(typeof ds!="object"||!ds.getData||!ds.filter){
return null;
}
return ds;
};
Spry.Data.DataSet=function(_46b){
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,_46b);
};
Spry.Data.DataSet.prototype=new Spry.Utils.Notifier();
Spry.Data.DataSet.prototype.constructor=Spry.Data.DataSet;
Spry.Data.DataSet.prototype.getData=function(_46c){
return (_46c&&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.getValue=function(_46d,_46e){
var _46f=undefined;
if(!_46e){
_46e=this.getCurrentRow();
}
switch(_46d){
case "ds_RowNumber":
_46f=this.getRowNumber(_46e);
break;
case "ds_RowNumberPlus1":
_46f=this.getRowNumber(_46e)+1;
break;
case "ds_RowCount":
_46f=this.getRowCount();
break;
case "ds_UnfilteredRowCount":
_46f=this.getRowCount(true);
break;
case "ds_CurrentRowNumber":
_46f=this.getCurrentRowNumber();
break;
case "ds_CurrentRowID":
_46f=this.getCurrentRowID();
break;
case "ds_EvenOddRow":
_46f=(this.getRowNumber(_46e)%2)?Spry.Data.Region.evenRowClassName:Spry.Data.Region.oddRowClassName;
break;
case "ds_SortOrder":
_46f=this.getSortOrder();
break;
case "ds_SortColumn":
_46f=this.getSortColumn();
break;
default:
if(_46e){
_46f=_46e[_46d];
}
break;
}
return _46f;
};
Spry.Data.DataSet.prototype.setDataFromArray=function(arr,_471){
this.notifyObservers("onPreLoad");
this.unfilteredData=null;
this.filteredData=null;
this.data=[];
this.dataHash={};
var _472=arr.length;
for(var i=0;i<_472;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(_471);
};
Spry.Data.DataSet.prototype.loadData=function(_475){
var self=this;
this.pendingRequest=new Object;
this.dataWasLoaded=false;
var _477=function(){
self.pendingRequest=null;
self.dataWasLoaded=true;
self.applyColumnTypes();
self.disableNotifications();
self.filterAndSortData();
self.enableNotifications();
self.notifyObservers("onPostLoad");
self.notifyObservers("onDataChanged");
};
if(_475){
_477();
}else{
this.pendingRequest.timer=setTimeout(_477,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(_478){
var rows=this.getData(_478);
return rows?rows.length:0;
};
Spry.Data.DataSet.prototype.getRowByID=function(_47a){
if(!this.data){
return null;
}
return this.dataHash[_47a];
};
Spry.Data.DataSet.prototype.getRowByRowNumber=function(_47b,_47c){
var rows=this.getData(_47c);
if(rows&&_47b>=0&&_47b<rows.length){
return rows[_47b];
}
return null;
};
Spry.Data.DataSet.prototype.getCurrentRow=function(){
return this.getRowByID(this.curRowID);
};
Spry.Data.DataSet.prototype.setCurrentRow=function(_47e){
if(this.curRowID==_47e){
return;
}
var _47f={oldRowID:this.curRowID,newRowID:_47e};
this.curRowID=_47e;
this.notifyObservers("onCurrentRowChanged",_47f);
};
Spry.Data.DataSet.prototype.getRowNumber=function(row,_481){
if(row){
var rows=this.getData(_481);
if(rows&&rows.length){
var _483=rows.length;
for(var i=0;i<_483;i++){
if(rows[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(_485){
if(!this.data||_485>=this.data.length){
Spry.Debug.trace("Invalid row number: "+_485+"\n");
return;
}
var _486=this.data[_485]["ds_RowID"];
if(_486==undefined||this.curRowID==_486){
return;
}
this.setCurrentRow(_486);
};
Spry.Data.DataSet.prototype.findRowsWithColumnValues=function(_487,_488,_489){
var _48a=[];
var rows=this.getData(_489);
if(rows){
var _48c=rows.length;
for(var i=0;i<_48c;i++){
var row=rows[i];
var _48f=true;
for(var _490 in _487){
if(_487[_490]!=row[_490]){
_48f=false;
break;
}
}
if(_48f){
if(_488){
return row;
}
_48a.push(row);
}
}
}
return _488?null:_48a;
};
Spry.Data.DataSet.prototype.setColumnType=function(_491,_492){
if(_491){
if(typeof _491=="string"){
_491=[_491];
}
for(var i=0;i<_491.length;i++){
this.columnTypes[_491[i]]=_492;
}
}
};
Spry.Data.DataSet.prototype.getColumnType=function(_494){
if(this.columnTypes[_494]){
return this.columnTypes[_494];
}
return "string";
};
Spry.Data.DataSet.prototype.applyColumnTypes=function(){
var rows=this.getData(true);
var _496=rows.length;
var _497=[];
if(_496<1){
return;
}
for(var _498 in this.columnTypes){
var _499=this.columnTypes[_498];
if(_499!="string"){
for(var i=0;i<_496;i++){
var row=rows[i];
var val=row[_498];
if(val!=undefined){
if(_499=="number"){
row[_498]=new Number(val);
}else{
if(_499=="html"){
row[_498]=Spry.Utils.decodeEntities(val);
}
}
}
}
}
}
};
Spry.Data.DataSet.prototype.distinct=function(_49d){
if(this.data){
var _49e=this.data;
this.data=[];
this.dataHash={};
var _49f=false;
var _4a0={};
var i=0;
var keys=[];
if(typeof _49d=="string"){
keys=[_49d];
}else{
if(_49d){
keys=_49d;
}else{
for(var _4a3 in _49e[0]){
keys[i++]=_4a3;
}
}
}
for(var i=0;i<_49e.length;i++){
var rec=_49e[i];
var _4a5="";
for(var j=0;j<keys.length;j++){
_4a3=keys[j];
if(_4a3!="ds_RowID"){
if(_4a5){
_4a5+=",";
}
_4a5+=_4a3+":"+"\""+rec[_4a3]+"\"";
}
}
if(!_4a0[_4a5]){
this.data.push(rec);
this.dataHash[rec["ds_RowID"]]=rec;
_4a0[_4a5]=true;
}else{
_49f=true;
}
}
if(_49f){
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(_4a7,_4a8){
if(!_4a7){
return;
}
if(typeof _4a7=="string"){
_4a7=[_4a7,"ds_RowID"];
}else{
if(_4a7.length<2&&_4a7[0]!="ds_RowID"){
_4a7.push("ds_RowID");
}
}
if(!_4a8){
_4a8="toggle";
}
if(_4a8=="toggle"){
if(this.lastSortColumns.length>0&&this.lastSortColumns[0]==_4a7[0]&&this.lastSortOrder=="ascending"){
_4a8="descending";
}else{
_4a8="ascending";
}
}
if(_4a8!="ascending"&&_4a8!="descending"){
Spry.Debug.reportError("Invalid sort order type specified: "+_4a8+"\n");
return;
}
var _4a9={oldSortColumns:this.lastSortColumns,oldSortOrder:this.lastSortOrder,newSortColumns:_4a7,newSortOrder:_4a8};
this.notifyObservers("onPreSort",_4a9);
var _4aa=_4a7[_4a7.length-1];
var _4ab=Spry.Data.DataSet.prototype.sort.getSortFunc(_4aa,this.getColumnType(_4aa),_4a8);
for(var i=_4a7.length-2;i>=0;i--){
_4aa=_4a7[i];
_4ab=Spry.Data.DataSet.prototype.sort.buildSecondarySortFunc(Spry.Data.DataSet.prototype.sort.getSortFunc(_4aa,this.getColumnType(_4aa),_4a8),_4ab);
}
if(this.unfilteredData){
this.unfilteredData.sort(_4ab);
if(this.filterFunc){
this.filter(this.filterFunc,true);
}
}else{
this.data.sort(_4ab);
}
this.lastSortColumns=_4a7.slice(0);
this.lastSortOrder=_4a8;
this.notifyObservers("onPostSort",_4a9);
};
Spry.Data.DataSet.prototype.sort.getSortFunc=function(prop,type,_4af){
var _4b0=null;
if(type=="number"){
if(_4af=="ascending"){
_4b0=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{
_4b0=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(_4af=="ascending"){
_4b0=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{
_4b0=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(_4af=="ascending"){
_4b0=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 _4c3=tA.length>tB.length?tB.length:tA.length;
for(var i=0;i<_4c3;i++){
var _4c5=tA_l.charAt(i);
var _4c6=tB_l.charAt(i);
var a_c=tA.charAt(i);
var b_c=tB.charAt(i);
if(_4c5>_4c6){
return 1;
}else{
if(_4c5<_4c6){
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{
_4b0=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 _4cf=tA.length>tB.length?tB.length:tA.length;
for(var i=0;i<_4cf;i++){
var _4d1=tA_l.charAt(i);
var _4d2=tB_l.charAt(i);
var a_c=tA.charAt(i);
var b_c=tB.charAt(i);
if(_4d1>_4d2){
return -1;
}else{
if(_4d1<_4d2){
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 _4b0;
};
Spry.Data.DataSet.prototype.sort.buildSecondarySortFunc=function(_4d5,_4d6){
return function(a,b){
var ret=_4d5(a,b);
if(ret==0){
ret=_4d6(a,b);
}
return ret;
};
};
Spry.Data.DataSet.prototype.filterData=function(_4da,_4db){
var _4dc=false;
if(!_4da){
this.filterDataFunc=null;
_4dc=true;
}else{
this.filterDataFunc=_4da;
if(this.dataWasLoaded&&((this.unfilteredData&&this.unfilteredData.length)||(this.data&&this.data.length))){
if(this.unfilteredData){
this.data=this.unfilteredData;
this.unfilteredData=null;
}
var _4dd=this.data;
this.data=[];
this.dataHash={};
for(var i=0;i<_4dd.length;i++){
var _4df=_4da(this,_4dd[i],i);
if(_4df){
this.data.push(_4df);
this.dataHash[_4df["ds_RowID"]]=_4df;
}
}
_4dc=true;
}
}
if(_4dc){
if(!_4db){
this.disableNotifications();
if(this.filterFunc){
this.filter(this.filterFunc,true);
}
this.enableNotifications();
}
this.notifyObservers("onDataChanged");
}
};
Spry.Data.DataSet.prototype.filter=function(_4e0,_4e1){
var _4e2=false;
if(!_4e0){
if(this.filterFunc&&this.unfilteredData){
this.data=this.unfilteredData;
this.unfilteredData=null;
this.filterFunc=null;
_4e2=true;
}
}else{
this.filterFunc=_4e0;
if(this.dataWasLoaded&&(this.unfilteredData||(this.data&&this.data.length))){
if(!this.unfilteredData){
this.unfilteredData=this.data;
}
var _4e3=this.unfilteredData;
this.data=[];
for(var i=0;i<_4e3.length;i++){
var _4e5=_4e0(this,_4e3[i],i);
if(_4e5){
this.data.push(_4e5);
}
}
_4e2=true;
}
}
if(_4e2){
this.notifyObservers("onDataChanged");
}
};
Spry.Data.DataSet.prototype.startLoadInterval=function(_4e6){
this.stopLoadInterval();
if(_4e6>0){
var self=this;
this.loadInterval=_4e6;
this.loadIntervalID=setInterval(function(){
self.loadData();
},_4e6);
}
};
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(_4e8,_4e9){
Spry.Data.DataSet.call(this);
this.url=_4e8;
this.dataSetsForDataRefStrings=new Array;
this.hasDataRefStrings=false;
this.useCache=true;
this.setRequestInfo(_4e9,true);
Spry.Utils.setOptions(this,_4e9,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(_4ea,_4eb){
this.requestInfo=new Spry.Utils.loadURL.Request();
this.requestInfo.extractRequestOptions(_4ea,_4eb);
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 _4ee=this.getDataRefStrings();
var _4ef=0;
for(var n=0;n<_4ee.length;n++){
var _4f1=Spry.Data.Region.getTokensFromStr(_4ee[n]);
for(i=0;_4f1&&i<_4f1.length;i++){
if(_4f1[i].search(/{[^}:]+::[^}]+}/)!=-1){
var _4f2=_4f1[i].replace(/^\{|::.*\}/g,"");
var ds=null;
if(!this.dataSetsForDataRefStrings[_4f2]){
ds=Spry.Data.getDataSetByName(_4f2);
if(_4f2&&ds){
this.dataSetsForDataRefStrings[_4f2]=ds;
this.dataSetsForDataRefStrings[_4ef++]=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 _4f3=[];
if(this.url){
_4f3.push(this.url);
}
if(this.requestInfo&&this.requestInfo.postData){
_4f3.push(this.requestInfo.postData);
}
return _4f3;
};
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 _4fd=this.requestInfo.postData;
if(this.hasDataRefStrings){
var _4fe=true;
for(var i=0;i<this.dataSetsForDataRefStrings.length;i++){
var ds=this.dataSetsForDataRefStrings[i];
if(ds.getLoadDataRequestIsPending()){
_4fe=false;
}else{
if(!ds.getDataWasLoaded()){
ds.loadData();
_4fe=false;
}
}
}
if(!_4fe){
return;
}
url=Spry.Data.Region.processDataRefString(null,this.url,this.dataSetsForDataRefStrings);
if(!url){
return;
}
if(_4fd&&(typeof _4fd)=="string"){
_4fd=Spry.Data.Region.processDataRefString(null,_4fd,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=_4fd;
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,_503){
if(this.url==url){
if(!_503||(this.requestInfo.method==_503.method&&(_503.method!="POST"||this.requestInfo.postData==_503.postData))){
return;
}
}
this.url=url;
this.setRequestInfo(_503);
this.cancelLoadData();
this.recalculateDataSetDependencies();
this.dataWasLoaded=false;
};
Spry.Data.HTTPSourceDataSet.prototype.setDataFromDoc=function(_504){
this.pendingRequest=null;
this.loadDataIntoDataSet(_504);
this.applyColumnTypes();
this.disableNotifications();
this.filterAndSortData();
this.enableNotifications();
this.notifyObservers("onPostLoad");
this.notifyObservers("onDataChanged");
};
Spry.Data.HTTPSourceDataSet.prototype.loadDataIntoDataSet=function(_505){
this.dataHash=new Object;
this.data=new Array;
this.dataWasLoaded=true;
};
Spry.Data.HTTPSourceDataSet.prototype.xhRequestProcessor=function(_506){
var resp=_506.responseText;
if(_506.status==200||_506.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(_509){
this.sessionExpiredChecker=_509;
};
Spry.Data.HTTPSourceDataSet.prototype.onRequestResponse=function(_50a,req){
this.setDataFromDoc(_50a.rawData);
};
Spry.Data.HTTPSourceDataSet.prototype.onRequestError=function(_50c,req){
this.notifyObservers("onLoadError",req);
};
Spry.Data.HTTPSourceDataSet.prototype.onRequestSessionExpired=function(_50e,req){
this.notifyObservers("onSessionExpired",req);
};
Spry.Data.HTTPSourceDataSet.LoadManager={};
Spry.Data.HTTPSourceDataSet.LoadManager.cache=[];
Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest=function(_510,_511,_512){
Spry.Utils.Notifier.call(this);
this.reqInfo=_510;
this.rawData=null;
this.timer=null;
this.state=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.NOT_LOADED;
this.xhRequestProcessor=_511;
this.sessionExpiredChecker=_512;
};
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 _514=null;
if(this.xhRequestProcessor){
_514=this.xhRequestProcessor(req.xhRequest);
}
if(this.sessionExpiredChecker){
Spry.Utils.setOptions(req,{"rawData":_514},false);
if(this.sessionExpiredChecker(req)){
this.state=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_FAILED;
this.notifyObservers("onRequestSessionExpired",req);
this.observers.length=0;
return;
}
}
if(!_514){
this.state=Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_FAILED;
this.notifyObservers("onRequestError",req);
this.observers.length=0;
return;
}
this.rawData=_514;
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 _516=this.reqInfo.clone();
_516.successCallback=function(req){
self.loadDataCallback(req);
};
_516.errorCallback=_516.successCallback;
this.timer=setTimeout(function(){
self.timer=null;
Spry.Utils.loadURL(_516.method,_516.url,_516.async,_516.successCallback,_516);
},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(_518){
return _518.method+"::"+_518.url+"::"+_518.postData+"::"+_518.username;
};
Spry.Data.HTTPSourceDataSet.LoadManager.loadData=function(_519,ds,_51b){
if(!_519){
return null;
}
var _51c=null;
var _51d=null;
if(_51b){
_51d=Spry.Data.HTTPSourceDataSet.LoadManager.getCacheKey(_519);
_51c=Spry.Data.HTTPSourceDataSet.LoadManager.cache[_51d];
}
if(_51c){
if(_51c.state==Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_REQUESTED){
if(ds){
_51c.addObserver(ds);
}
return _51c;
}else{
if(_51c.state==Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest.LOAD_SUCCESSFUL){
if(ds){
setTimeout(function(){
ds.setDataFromDoc(_51c.rawData);
},0);
}
return _51c;
}
}
}
if(!_51c){
_51c=new Spry.Data.HTTPSourceDataSet.LoadManager.CachedRequest(_519,(ds?ds.xhRequestProcessor:null),(ds?ds.sessionExpiredChecker:null));
if(_51b){
Spry.Data.HTTPSourceDataSet.LoadManager.cache[_51d]=_51c;
_51c.addObserver({onRequestError:function(){
Spry.Data.HTTPSourceDataSet.LoadManager.cache[_51d]=undefined;
}});
}
}
if(ds){
_51c.addObserver(ds);
}
_51c.loadData();
return _51c;
};
Spry.Data.HTTPSourceDataSet.LoadManager.cancelLoadData=function(_51e,ds){
if(_51e){
if(ds){
_51e.removeObserver(ds);
}else{
_51e.cancelLoadData();
}
}
};
Spry.Data.XMLDataSet=function(_520,_521,_522){
this.xpath=_521;
this.doc=null;
this.subPaths=[];
this.entityEncodeStrings=true;
Spry.Data.HTTPSourceDataSet.call(this,_520,_522);
var _523=typeof this.subPaths;
if(_523=="string"||(_523=="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 _524=[];
if(this.url){
_524.push(this.url);
}
if(this.xpath){
_524.push(this.xpath);
}
if(this.requestInfo&&this.requestInfo.postData){
_524.push(this.requestInfo.postData);
}
return _524;
};
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.nodeContainsElementNode=function(node){
if(node){
node=node.firstChild;
while(node){
if(node.nodeType==1){
return true;
}
node=node.nextSibling;
}
}
return false;
};
Spry.Data.XMLDataSet.getNodeText=function(node,_528,_529){
var txt="";
if(!node){
return;
}
try{
var _52b=node.firstChild;
while(_52b){
try{
if(_52b.nodeType==3){
txt+=_528?Spry.Utils.encodeEntities(_52b.data):_52b.data;
}else{
if(_52b.nodeType==4){
txt+=_529?Spry.Utils.encodeEntities(_52b.data):_52b.data;
}
}
}
catch(e){
Spry.Debug.reportError("Spry.Data.XMLDataSet.getNodeText() exception caught: "+e+"\n");
}
_52b=_52b.nextSibling;
}
}
catch(e){
Spry.Debug.reportError("Spry.Data.XMLDataSet.getNodeText() exception caught: "+e+"\n");
}
return txt;
};
Spry.Data.XMLDataSet.createObjectForNode=function(node,_52d,_52e){
if(!node){
return null;
}
var obj=new Object();
var i=0;
var attr=null;
try{
for(i=0;i<node.attributes.length;i++){
attr=node.attributes[i];
if(attr&&attr.nodeType==2){
obj["@"+attr.name]=attr.value;
}
}
}
catch(e){
Spry.Debug.reportError("Spry.Data.XMLDataSet.createObjectForNode() caught exception while accessing attributes: "+e+"\n");
}
var _532=node.firstChild;
if(_532&&!_532.nextSibling&&_532.nodeType!=1){
obj[node.nodeName]=Spry.Data.XMLDataSet.getNodeText(node,_52d,_52e);
}
while(_532){
if(_532.nodeType==1){
if(!Spry.Data.XMLDataSet.nodeContainsElementNode(_532)){
obj[_532.nodeName]=Spry.Data.XMLDataSet.getNodeText(_532,_52d,_52e);
try{
var _533=_532.nodeName+"/@";
for(i=0;i<_532.attributes.length;i++){
attr=_532.attributes[i];
if(attr&&attr.nodeType==2){
obj[_533+attr.name]=attr.value;
}
}
}
catch(e){
Spry.Debug.reportError("Spry.Data.XMLDataSet.createObjectForNode() caught exception while accessing attributes: "+e+"\n");
}
}
}
_532=_532.nextSibling;
}
return obj;
};
Spry.Data.XMLDataSet.getRecordSetFromXMLDoc=function(_534,path,_536,_537){
if(!_534||!path){
return null;
}
var _538=new Object();
_538.xmlDoc=_534;
_538.xmlPath=path;
_538.dataHash=new Object;
_538.data=new Array;
_538.getData=function(){
return this.data;
};
var ctx=new ExprContext(_534);
var _53a=xpathParse(path);
var e=_53a.evaluate(ctx);
var _53c=e.nodeSetValue();
var _53d=true;
if(_53c&&_53c.length>0){
_53d=_53c[0].nodeType!=2;
}
var _53e=0;
var _53f=true;
var _540=false;
if(typeof _537=="boolean"){
_53f=_540=_537;
}
for(var i=0;i<_53c.length;i++){
var _542=null;
if(_536){
_542=new Object;
}else{
if(_53d){
_542=Spry.Data.XMLDataSet.createObjectForNode(_53c[i],_53f,_540);
}else{
_542=new Object;
_542["@"+_53c[i].name]=_53c[i].value;
}
}
if(_542){
_542["ds_RowID"]=_53e++;
_542["ds_XMLNode"]=_53c[i];
_538.dataHash[_542["ds_RowID"]]=_542;
_538.data.push(_542);
}
}
return _538;
};
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 _547=this.subPaths.length;
for(var i=0;i<_547;i++){
var _549=this.subPaths[i];
if(path==_549.path){
return _549;
}
}
return null;
};
Spry.Data.XMLDataSet.PathNode.prototype.consolidate=function(){
var _54a=this.subPaths.length;
if(!this.xpath&&_54a==1){
var _54b=this.subPaths[0];
this.path+=((_54b[0]!="/")?"/":"")+_54b.path;
this.xpath=_54b.xpath;
this.subPaths=_54b.subPaths;
this.consolidate();
return;
}
for(var i=0;i<_54a;i++){
this.subPaths[i].consolidate();
}
};
Spry.Data.XMLDataSet.prototype.convertXPathsToPathTree=function(_54d){
var _54e=_54d.length;
var root=new Spry.Data.XMLDataSet.PathNode("");
for(var i=0;i<_54e;i++){
var _551=_54d[i];
var _552=_551.replace(/\/\//g,"/__SPRYDS__");
_552=_552.replace(/^\//,"");
var _553=_552.split(/\//);
var _554=_553.length;
var node=root;
for(var j=0;j<_554;j++){
var path=_553[j].replace(/__SPRYDS__/,"//");
node=node.addSubPath(path);
}
node.xpath=_551;
}
root.consolidate();
return root;
};
Spry.Data.XMLDataSet.prototype.flattenSubPaths=function(rs,_559){
if(!rs||!_559){
return;
}
var _55a=_559.length;
if(_55a<1){
return;
}
var data=rs.data;
var _55c={};
var _55d=[];
var _55e=[];
for(var i=0;i<_55a;i++){
var _560=_559[i];
if(typeof _560=="object"){
_560=_560.path;
}
if(!_560){
_560="";
}
_55d[i]=Spry.Data.Region.processDataRefString(null,_560,this.dataSetsForDataRefStrings);
_55e[i]=_55d[i].replace(/\[.*\]/g,"");
}
var row;
var _562=data.length;
var _563=[];
for(var i=0;i<_562;i++){
row=data[i];
var _564=[row];
for(var j=0;j<_55a;j++){
var _566=Spry.Data.XMLDataSet.getRecordSetFromXMLDoc(row.ds_XMLNode,_55d[j],(_559[j].xpath?false:true),this.entityEncodeStrings);
if(_566&&_566.data&&_566.data.length){
if(typeof _559[j]=="object"&&_559[j].subPaths){
var sp=_559[j].subPaths;
spType=typeof sp;
if(spType=="string"){
sp=[sp];
}else{
if(spType=="object"&&spType.constructor==Object){
sp=[sp];
}
}
this.flattenSubPaths(_566,sp);
}
var _568=_566.data;
var _569=_568.length;
var _56a=_55e[j]+"/";
var _56b=_564.length;
var _56c=[];
for(var k=0;k<_56b;k++){
var _56e=_564[k];
for(var l=0;l<_569;l++){
var _570=new Object;
var _571=_568[l];
for(prop in _56e){
_570[prop]=_56e[prop];
}
for(var prop in _571){
var _573=_56a+prop;
if(_56a==(prop+"/")||_56a.search(new RegExp("\\/"+prop+"\\/$"))!=-1){
_573=_55e[j];
}
_570[_573]=_571[prop];
}
_56c.push(_570);
}
}
_564=_56c;
}
}
_563=_563.concat(_564);
}
data=_563;
_562=data.length;
for(i=0;i<_562;i++){
row=data[i];
row.ds_RowID=i;
_55c[row.ds_RowID]=row;
}
rs.data=data;
rs.dataHash=_55c;
};
Spry.Data.XMLDataSet.prototype.loadDataIntoDataSet=function(_574){
var rs=null;
var _576=Spry.Data.Region.processDataRefString(null,this.xpath,this.dataSetsForDataRefStrings);
var _577=this.subPaths;
var _578=false;
if(this.subPaths&&this.subPaths.length>0){
var _579=[];
var _57a=_577.length;
for(var i=0;i<_57a;i++){
var _57c=Spry.Data.Region.processDataRefString(null,_577[i],this.dataSetsForDataRefStrings);
if(_57c.charAt(0)!="/"){
_57c=_576+"/"+_57c;
}
_579.push(_57c);
}
_579.unshift(_576);
var _57d=this.convertXPathsToPathTree(_579);
_576=_57d.path;
_577=_57d.subPaths;
_578=_57d.xpath?false:true;
}
rs=Spry.Data.XMLDataSet.getRecordSetFromXMLDoc(_574,_576,_578,this.entityEncodeStrings);
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,_577);
this.doc=rs.xmlDoc;
this.data=rs.data;
this.dataHash=rs.dataHash;
this.dataWasLoaded=(this.doc!=null);
};
Spry.Data.XMLDataSet.prototype.xhRequestProcessor=function(_57e){
var resp=_57e.responseXML;
var _580=false;
if(_57e.status!=200){
if(_57e.status==0){
if(_57e.responseText&&(!resp||!resp.firstChild)){
_580=true;
}
}
}else{
if(!resp){
_580=true;
}
}
if(_580){
resp=Spry.Utils.stringToXMLDoc(_57e.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 _582=req.rawData.documentElement.firstChild;
if(_582&&_582.nodeValue=="session expired"){
return true;
}
}
}
return false;
};
Spry.Data.Region=function(_583,name,_585,data,_587,_588,_589,_58a){
this.regionNode=_583;
this.name=name;
this.isDetailRegion=_585;
this.data=data;
this.dataSets=_587;
this.hasBehaviorAttributes=_58a;
this.tokens=null;
this.currentState=null;
this.states={ready:true};
this.stateMap={};
Spry.Utils.setOptions(this.states,_588);
Spry.Utils.setOptions(this.stateMap,_589);
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(_58d,_58e){
var n=Spry.Data.Region.notifiers[_58d];
if(!n){
n=new Spry.Utils.Notifier();
Spry.Data.Region.notifiers[_58d]=n;
}
n.addObserver(_58e);
};
Spry.Data.Region.removeObserver=function(_590,_591){
var n=Spry.Data.Region.notifiers[_590];
if(n){
n.removeObserver(_591);
}
};
Spry.Data.Region.notifyObservers=function(_593,_594,data){
var n=Spry.Data.Region.notifiers[_594.name];
if(n){
var _597={};
if(data&&typeof data=="object"){
_597=data;
}else{
_597.data=data;
}
_597.region=_594;
_597.regionID=_594.name;
_597.regionNode=_594.regionNode;
n.notifyObservers(_593,_597);
}
};
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(_598,_599){
this.stateMap[_598]=_599;
};
Spry.Data.Region.prototype.getMappedState=function(_59a){
var _59b=this.stateMap[_59a];
return _59b?_59b:_59a;
};
Spry.Data.Region.prototype.setState=function(_59c,_59d){
var _59e={state:_59c,mappedState:this.getMappedState(_59c)};
if(!_59d){
Spry.Data.Region.notifyObservers("onPreStateChange",this,_59e);
}
this.currentState=_59e.mappedState?_59e.mappedState:_59c;
if(this.states[this.currentState]){
var _59f={state:this.currentState};
if(!_59d){
Spry.Data.Region.notifyObservers("onPreUpdate",this,_59f);
}
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(!_59d){
Spry.Data.Region.notifyObservers("onPostUpdate",this,_59f);
}
}
if(!_59d){
Spry.Data.Region.notifyObservers("onPostStateChange",this,_59e);
}
};
Spry.Data.Region.prototype.getDataSets=function(){
return this.dataSets;
};
Spry.Data.Region.prototype.addDataSet=function(_5a1){
if(!_5a1){
return;
}
if(!this.dataSets){
this.dataSets=new Array;
}
for(var i=0;i<this.dataSets.length;i++){
if(this.dataSets[i]==_5a1){
return;
}
}
this.dataSets.push(_5a1);
_5a1.addObserver(this);
};
Spry.Data.Region.prototype.removeDataSet=function(_5a3){
if(!_5a3||this.dataSets){
return;
}
for(var i=0;i<this.dataSets.length;i++){
if(this.dataSets[i]==_5a3){
this.dataSets.splice(i,1);
_5a3.removeObserver(this);
return;
}
}
};
Spry.Data.Region.prototype.onPreLoad=function(_5a5){
if(this.currentState!="loading"){
this.setState("loading");
}
};
Spry.Data.Region.prototype.onLoadError=function(_5a6){
if(this.currentState!="error"){
this.setState("error");
}
Spry.Data.Region.notifyObservers("onError",this);
};
Spry.Data.Region.prototype.onSessionExpired=function(_5a7){
if(this.currentState!="expired"){
this.setState("expired");
}
Spry.Data.Region.notifyObservers("onExpired",this);
};
Spry.Data.Region.prototype.onCurrentRowChanged=function(_5a8,data){
if(this.isDetailRegion){
this.updateContent();
}
};
Spry.Data.Region.prototype.onPostSort=function(_5aa,data){
this.updateContent();
};
Spry.Data.Region.prototype.onDataChanged=function(_5ac,data){
this.updateContent();
};
Spry.Data.Region.enableBehaviorAttributes=true;
Spry.Data.Region.behaviorAttrs={};
Spry.Data.Region.behaviorAttrs["spry:select"]={attach:function(rgn,node,_5b0){
var _5b1=null;
var _5b2=Spry.Utils.getAttribute(node,"spry:selectgroup");
if(_5b2!=undefined){
_5b1=_5b2;
Spry.Utils.removeAttribute(node,"spry:selectgroup");
}
if(!_5b1){
_5b1="default";
}
Spry.Utils.addEventListener(node,"click",function(_5b3){
Spry.Utils.SelectionManager.select(_5b1,node,_5b0);
},false);
if(Spry.Utils.getAttribute(node,"spry:selected")!=undefined){
Spry.Utils.removeAttribute(node,"spry:selected");
Spry.Utils.SelectionManager.select(_5b1,node,_5b0);
}
Spry.Utils.removeAttribute(node,"spry:select");
}};
Spry.Data.Region.behaviorAttrs["spry:hover"]={attach:function(rgn,node,_5b6){
Spry.Utils.addEventListener(node,"mouseover",function(_5b7){
Spry.Utils.addClassName(node,_5b6);
},false);
Spry.Utils.addEventListener(node,"mouseout",function(_5b8){
Spry.Utils.removeClassName(node,_5b6);
},false);
Spry.Utils.removeAttribute(node,"spry:hover");
}};
Spry.Data.Region.setUpRowNumberForEvenOddAttr=function(node,attr,_5bb,_5bc){
if(!_5bb){
Spry.Debug.showError("The "+attr+" attribute requires a CSS class name as its value!");
node.attributes.removeNamedItem(attr);
return;
}
var _5bd="";
var _5be=_5bb.split(/\s/);
if(_5be.length>1){
_5bd=_5be[0];
node.setAttribute(attr,_5be[1]);
}
node.setAttribute(_5bc,"{"+(_5bd?(_5bd+"::"):"")+"ds_RowNumber}");
};
Spry.Data.Region.behaviorAttrs["spry:even"]={setup:function(node,_5c0){
Spry.Data.Region.setUpRowNumberForEvenOddAttr(node,"spry:even",_5c0,"spryevenrownumber");
},attach:function(rgn,node,_5c3){
if(_5c3){
rowNumAttr=node.attributes.getNamedItem("spryevenrownumber");
if(rowNumAttr&&rowNumAttr.value){
var _5c4=parseInt(rowNumAttr.value);
if(_5c4%2){
Spry.Utils.addClassName(node,_5c3);
}
}
}
Spry.Utils.removeAttribute(node,"spry:even");
node.removeAttribute("spryevenrownumber");
}};
Spry.Data.Region.behaviorAttrs["spry:odd"]={setup:function(node,_5c6){
Spry.Data.Region.setUpRowNumberForEvenOddAttr(node,"spry:odd",_5c6,"spryoddrownumber");
},attach:function(rgn,node,_5c9){
if(_5c9){
rowNumAttr=node.attributes.getNamedItem("spryoddrownumber");
if(rowNumAttr&&rowNumAttr.value){
var _5ca=parseInt(rowNumAttr.value);
if(_5ca%2==0){
Spry.Utils.addClassName(node,_5c9);
}
}
}
Spry.Utils.removeAttribute(node,"spry:odd");
node.removeAttribute("spryoddrownumber");
}};
Spry.Data.Region.setRowAttrClickHandler=function(node,_5cc,_5cd,_5ce){
if(_5cc){
var ds=Spry.Data.getDataSetByName(_5cc);
if(ds){
rowIDAttr=node.attributes.getNamedItem(_5cd);
if(rowIDAttr){
var _5d0=rowIDAttr.value;
if(_5d0){
Spry.Utils.addEventListener(node,"click",function(_5d1){
ds[_5ce](_5d0);
},false);
}
}
}
}
};
Spry.Data.Region.behaviorAttrs["spry:setrow"]={setup:function(node,_5d3){
if(!_5d3){
Spry.Debug.reportError("The spry:setrow attribute requires a data set name as its value!");
Spry.Utils.removeAttribute(node,"spry:setrow");
return;
}
node.setAttribute("spryrowid","{"+_5d3+"::ds_RowID}");
},attach:function(rgn,node,_5d6){
Spry.Data.Region.setRowAttrClickHandler(node,_5d6,"spryrowid","setCurrentRow");
Spry.Utils.removeAttribute(node,"spry:setrow");
node.removeAttribute("spryrowid");
}};
Spry.Data.Region.behaviorAttrs["spry:setrownumber"]={setup:function(node,_5d8){
if(!_5d8){
Spry.Debug.reportError("The spry:setrownumber attribute requires a data set name as its value!");
Spry.Utils.removeAttribute(node,"spry:setrownumber");
return;
}
node.setAttribute("spryrownumber","{"+_5d8+"::ds_RowID}");
},attach:function(rgn,node,_5db){
Spry.Data.Region.setRowAttrClickHandler(node,_5db,"spryrownumber","setCurrentRowNumber");
Spry.Utils.removeAttribute(node,"spry:setrownumber");
node.removeAttribute("spryrownumber");
}};
Spry.Data.Region.behaviorAttrs["spry:sort"]={attach:function(rgn,node,_5de){
if(!_5de){
return;
}
var ds=rgn.getDataSets()[0];
var _5e0="toggle";
var _5e1=_5de.split(/\s/);
if(_5e1.length>1){
var _5e2=Spry.Data.getDataSetByName(_5e1[0]);
if(_5e2){
ds=_5e2;
_5e1.shift();
}
if(_5e1.length>1){
var str=_5e1[_5e1.length-1];
if(str=="ascending"||str=="descending"||str=="toggle"){
_5e0=str;
_5e1.pop();
}
}
}
if(ds&&_5e1.length>0){
Spry.Utils.addEventListener(node,"click",function(_5e4){
ds.sort(_5e1,_5e0);
},false);
}
Spry.Utils.removeAttribute(node,"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 _5e7=Spry.Data.Region.behaviorAttrs;
for(var _5e8 in _5e7){
var _5e9=Spry.Utils.getAttribute(node,_5e8);
if(_5e9!=undefined){
var _5ea=_5e7[_5e8];
if(_5ea&&_5ea.attach){
_5ea.attach(rgn,node,_5e9);
}
}
}
}
catch(e){
}
return false;
});
};
Spry.Data.Region.prototype.updateContent=function(){
var _5eb=true;
var _5ec=this.getDataSets();
if(!_5ec||_5ec.length<1){
Spry.Debug.reportError("updateContent(): Region '"+this.name+"' has no data set!\n");
return;
}
for(var i=0;i<_5ec.length;i++){
var ds=_5ec[i];
if(ds){
if(ds.getLoadDataRequestIsPending()){
_5eb=false;
}else{
if(!ds.getDataWasLoaded()){
ds.loadData();
_5eb=false;
}
}
}
}
if(!_5eb){
Spry.Data.Region.notifyObservers("onLoadingData",this);
return;
}
this.setState("ready");
};
Spry.Data.Region.prototype.clearContent=function(){
this.regionNode.innerHTML="";
};
Spry.Data.Region.processContentPI=function(_5ef){
var _5f0="";
var _5f1=/<!--\s*<\/?spry:content\s*[^>]*>\s*-->/mg;
var _5f2=0;
var _5f3=0;
while(_5ef.length){
var _5f4=_5f1.exec(_5ef);
if(!_5f4||!_5f4[0]){
_5f0+=_5ef.substr(_5f2,_5ef.length-_5f2);
break;
}
if(!_5f3&&_5f4.index!=_5f2){
_5f0+=_5ef.substr(_5f2,_5f4.index-_5f2);
}
if(_5f4[0].search(/<\//)!=-1){
--_5f3;
if(_5f3){
Spry.Debug.reportError("Nested spry:content regions are not allowed!\n");
}
}else{
++_5f3;
var _5f5=_5f4[0].replace(/.*\bdataref="/,"");
_5f0+=_5f5.replace(/".*$/,"");
}
_5f2=_5f1.lastIndex;
}
return _5f0;
};
Spry.Data.Region.prototype.tokenizeData=function(_5f6){
if(!_5f6){
return null;
}
var _5f7=new Spry.Data.Region.Token(Spry.Data.Region.Token.LIST_TOKEN,null,null,null);
var _5f8=new Array;
var _5f9=Spry.Data.Region.processContentPI(_5f6);
_5f8.push(_5f7);
var _5fa=/((<!--\s*){0,1}<\/{0,1}spry:[^>]+>(\s*-->){0,1})|((\{|%7[bB])[^\}\s%]+(\}|%7[dD]))/mg;
var _5fb=0;
while(_5f9.length){
var _5fc=_5fa.exec(_5f9);
var _5fd=null;
if(!_5fc||!_5fc[0]){
var str=_5f9.substr(_5fb,_5f9.length-_5fb);
_5fd=new Spry.Data.Region.Token(Spry.Data.Region.Token.STRING_TOKEN,null,str,str);
_5f8[_5f8.length-1].addChild(_5fd);
break;
}
if(_5fc.index!=_5fb){
var str=_5f9.substr(_5fb,_5fc.index-_5fb);
_5fd=new Spry.Data.Region.Token(Spry.Data.Region.Token.STRING_TOKEN,null,str,str);
_5f8[_5f8.length-1].addChild(_5fd);
}
if(_5fc[0].search(/^({|%7[bB])/)!=-1){
var _5ff=_5fc[0];
var _600=_5fc[0];
_5ff=_5ff.replace(/^({|%7[bB])/,"");
_5ff=_5ff.replace(/(}|%7[dD])$/,"");
var _601=null;
var _602=_5ff.split(/::/);
if(_602.length>1){
_601=_602[0];
_5ff=_602[1];
}
_600=_600.replace(/^%7[bB]/,"{");
_600=_600.replace(/%7[dD]$/,"}");
_5fd=new Spry.Data.Region.Token(Spry.Data.Region.Token.VALUE_TOKEN,_601,_5ff,new String(_600));
_5f8[_5f8.length-1].addChild(_5fd);
}else{
if(_5fc[0].charAt(0)=="<"){
var _603=_5fc[0].replace(/^(<!--\s*){0,1}<\/?/,"");
_603=_603.replace(/>(\s*-->){0,1}|\s.*$/,"");
if(_5fc[0].search(/<\//)!=-1){
if(_5f8[_5f8.length-1].tokenType!=Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN){
Spry.Debug.reportError("Invalid processing instruction close tag: "+_603+" -- "+_5fc[0]+"\n");
return null;
}
_5f8.pop();
}else{
var _604=Spry.Data.Region.PI.instructions[_603];
if(_604){
var _605=null;
var _606="";
if(_5fc[0].search(/^.*\bselect=\"/)!=-1){
_606=_5fc[0].replace(/^.*\bselect=\"/,"");
_606=_606.replace(/".*$/,"");
if(_606){
_605=Spry.Data.getDataSetByName(_606);
if(!_605){
Spry.Debug.reportError("Failed to retrieve data set ("+_606+") for "+_603+"\n");
_606="";
}
}
}
var _607=null;
if(_5fc[0].search(/^.*\btest=\"/)!=-1){
_607=_5fc[0].replace(/^.*\btest=\"/,"");
_607=_607.replace(/".*$/,"");
_607=Spry.Utils.decodeEntities(_607);
}
var _608=null;
if(_5fc[0].search(/^.*\bname=\"/)!=-1){
_608=_5fc[0].replace(/^.*\bname=\"/,"");
_608=_608.replace(/".*$/,"");
_608=Spry.Utils.decodeEntities(_608);
}
var _609=new Spry.Data.Region.Token.PIData(_603,_606,_607,_608);
_5fd=new Spry.Data.Region.Token(Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN,_605,_609,new String(_5fc[0]));
_5f8[_5f8.length-1].addChild(_5fd);
_5f8.push(_5fd);
}else{
Spry.Debug.reportError("Unsupported region processing instruction: "+_5fc[0]+"\n");
return null;
}
}
}else{
Spry.Debug.reportError("Invalid region token: "+_5fc[0]+"\n");
return null;
}
}
_5fb=_5fa.lastIndex;
}
return _5f7;
};
Spry.Data.Region.prototype.callScriptFunction=function(_60a,_60b){
var _60c=undefined;
_60a=_60a.replace(/^\s*\{?\s*function::\s*|\s*\}?\s*$/g,"");
var func=Spry.Utils.getObjectByName(_60a);
if(func){
_60c=func(this.name,function(){
return _60b.getValueFromDataSet.apply(_60b,arguments);
});
}
return _60c;
};
Spry.Data.Region.prototype.evaluateExpression=function(_60e,_60f){
var _610=undefined;
try{
if(_60e.search(/^\s*function::/)!=-1){
_610=this.callScriptFunction(_60e,_60f);
}else{
_610=Spry.Utils.eval(Spry.Data.Region.processDataRefString(_60f,_60e,null,true));
}
}
catch(e){
Spry.Debug.trace("Caught exception in Spry.Data.Region.prototype.evaluateExpression() while evaluating: "+Spry.Utils.encodeEntities(_60e)+"\n    Exception:"+e+"\n");
}
return _610;
};
Spry.Data.Region.prototype.processTokenChildren=function(_611,_612,_613){
var _614=_612.children;
var len=_614.length;
for(var i=0;i<len;i++){
this.processTokens(_611,_614[i],_613);
}
};
Spry.Data.Region.prototype.processTokens=function(_617,_618,_619){
var i=0;
switch(_618.tokenType){
case Spry.Data.Region.Token.LIST_TOKEN:
this.processTokenChildren(_617,_618,_619);
break;
case Spry.Data.Region.Token.STRING_TOKEN:
_617.push(_618.data);
break;
case Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN:
if(_618.data.name=="spry:repeat"){
var _61b=null;
if(_618.dataSet){
_61b=_618.dataSet;
}else{
_61b=this.dataSets[0];
}
if(_61b){
var _61c=_619.getDataSetContext(_61b);
if(!_61c){
Spry.Debug.reportError("processTokens() failed to get a data set context!\n");
break;
}
_61c.pushState();
var _61d=_61c.getData();
var _61e=_61d.length;
for(i=0;i<_61e;i++){
_61c.setRowIndex(i);
var _61f=true;
if(_618.data.jsExpr){
_61f=this.evaluateExpression(_618.data.jsExpr,_619);
}
if(_61f){
this.processTokenChildren(_617,_618,_619);
}
}
_61c.popState();
}
}else{
if(_618.data.name=="spry:if"){
var _61f=true;
if(_618.data.jsExpr){
_61f=this.evaluateExpression(_618.data.jsExpr,_619);
}
if(_61f){
this.processTokenChildren(_617,_618,_619);
}
}else{
if(_618.data.name=="spry:choose"){
var _620=null;
var _621=null;
var _61f=false;
var j=0;
for(j=0;j<_618.children.length;j++){
var _623=_618.children[j];
if(_623.tokenType==Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN){
if(_623.data.name=="spry:when"){
if(_623.data.jsExpr){
_61f=this.evaluateExpression(_623.data.jsExpr,_619);
if(_61f){
_621=_623;
break;
}
}
}else{
if(_623.data.name=="spry:default"){
_620=_623;
}
}
}
}
if(!_621&&_620){
_621=_620;
}
if(_621){
this.processTokenChildren(_617,_621,_619);
}
}else{
if(_618.data.name=="spry:state"){
var _61f=true;
if(!_618.data.regionState||_618.data.regionState==this.currentState){
this.processTokenChildren(_617,_618,_619);
}
}else{
Spry.Debug.reportError("processTokens(): Unknown processing instruction: "+_618.data.name+"\n");
return "";
}
}
}
}
break;
case Spry.Data.Region.Token.VALUE_TOKEN:
var _61b=_618.dataSet;
var val=undefined;
if(_61b&&_61b=="function"){
val=this.callScriptFunction(_618.data,_619);
}else{
if(!_61b&&this.dataSets&&this.dataSets.length>0&&this.dataSets[0]){
_61b=this.dataSets[0];
}
if(!_61b){
Spry.Debug.reportError("processTokens(): Value reference has no data set specified: "+_618.regionStr+"\n");
return "";
}
val=_619.getValueFromDataSet(_61b,_618.data);
}
if(typeof val!="undefined"){
_617.push(val+"");
}
break;
default:
Spry.Debug.reportError("processTokens(): Invalid token type: "+_618.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 _625=[""];
this.processTokens(_625,this.tokens,processContext);
return _625.join("");
};
Spry.Data.Region.PI={};
Spry.Data.Region.PI.instructions={};
Spry.Data.Region.PI.buildOpenTagForValueAttr=function(ele,_627,_628){
if(!ele||!_627){
return "";
}
var _629="";
try{
var _62a=Spry.Utils.getAttribute(ele,_627);
if(_62a){
_629=Spry.Utils.encodeEntities(_62a);
}
}
catch(e){
_629="";
}
if(!_629){
Spry.Debug.reportError(_627+" attribute requires a JavaScript expression that returns true or false!\n");
return "";
}
return "<"+Spry.Data.Region.PI.instructions[_627].tagName+" "+_628+"=\""+_629+"\">";
};
Spry.Data.Region.PI.buildOpenTagForTest=function(ele,_62c){
return Spry.Data.Region.PI.buildOpenTagForValueAttr(ele,_62c,"test");
};
Spry.Data.Region.PI.buildOpenTagForState=function(ele,_62e){
return Spry.Data.Region.PI.buildOpenTagForValueAttr(ele,_62e,"name");
};
Spry.Data.Region.PI.buildOpenTagForRepeat=function(ele,_630){
if(!ele||!_630){
return "";
}
var _631=Spry.Utils.getAttribute(ele,_630);
if(_631){
_631=_631.replace(/\s/g,"");
}else{
Spry.Debug.reportError(_630+" attribute requires a data set name!\n");
return "";
}
var _632="";
var _633=Spry.Utils.getAttribute(ele,"spry:test");
if(_633!=undefined){
if(_633){
_632=" test=\""+Spry.Utils.encodeEntities(_633)+"\"";
}
Spry.Utils.removeAttribute(ele,"spry:test");
}
return "<"+Spry.Data.Region.PI.instructions[_630].tagName+" select=\""+_631+"\""+_632+">";
};
Spry.Data.Region.PI.buildOpenTagForContent=function(ele,_635){
if(!ele||!_635){
return "";
}
var _636="";
try{
var _637=Spry.Utils.getAttribute(ele,_635);
if(_637){
_636=Spry.Utils.encodeEntities(_637);
}
}
catch(e){
_636="";
}
if(!_636){
Spry.Debug.reportError(_635+" attribute requires a data reference!\n");
return "";
}
return "<"+Spry.Data.Region.PI.instructions[_635].tagName+" dataref=\""+_636+"\">";
};
Spry.Data.Region.PI.buildOpenTag=function(ele,_639){
return "<"+Spry.Data.Region.PI.instructions[_639].tagName+">";
};
Spry.Data.Region.PI.buildCloseTag=function(ele,_63b){
return "</"+Spry.Data.Region.PI.instructions[_63b].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(_63d,_63e,_63f,_640){
if(!_63e){
return "";
}
if(!_63d&&!_63f){
return _63e;
}
var _641="";
var re=new RegExp("\\{([^\\}:]+::)?[^\\}]+\\}","g");
var _643=0;
while(_643<_63e.length){
var _644=re.exec(_63e);
if(!_644||!_644[0]){
_641+=_63e.substr(_643,_63e.length-_643);
return _641;
}
if(_644.index!=_643){
_641+=_63e.substr(_643,_644.index-_643);
}
var _645="";
if(_644[0].search(/^\{[^}:]+::/)!=-1){
_645=_644[0].replace(/^\{|::.*/g,"");
}
var _646=_644[0].replace(/^\{|.*::|\}/g,"");
var row=null;
var val="";
if(_63d){
val=_63d.getValueFromDataSet(_645,_646);
}else{
var ds=_645?_63f[_645]:_63f[0];
if(ds){
val=ds.getValue(_646);
}
}
if(typeof val!="undefined"){
val+="";
_641+=_640?Spry.Utils.escapeQuotesAndLineBreaks(val):val;
}
if(_643==re.lastIndex){
var _64a=_644.index+_644[0].length;
if(_64a<_63e.length){
_641+=_63e.substr(_64a);
}
break;
}
_643=re.lastIndex;
}
return _641;
};
Spry.Data.Region.strToDataSetsArray=function(str,_64c){
var _64d=new Array;
var _64e={};
if(!str){
return _64d;
}
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 _651=Spry.Data.getDataSetByName(arr[i]);
if(!_64e[arr[i]]){
if(_64c){
_64d.push(arr[i]);
}else{
_64d.push(_651);
}
_64e[arr[i]]=true;
}
}
catch(e){
}
}
}
return _64d;
};
Spry.Data.Region.DSContext=function(_652,_653){
var _654=_652;
var _655=_653;
var _656=[{rowIndex:-1}];
var _657=null;
var _658=[];
var _659=function(){
return _656[_656.length-1].rowIndex;
};
this.resetAll=function(){
_656=[{rowIndex:_654.getCurrentRow()}];
};
this.getDataSet=function(){
return _654;
};
this.getNumRows=function(_65a){
var data=this.getCurrentState().data;
return data?data.length:_654.getRowCount(_65a);
};
this.getData=function(){
var data=this.getCurrentState().data;
return data?data:_654.getData();
};
this.setData=function(data){
this.getCurrentState().data=data;
};
this.getValue=function(_65e,_65f){
var _660="";
var _661=this.getCurrentState();
var ds=_661.nestedDS?_661.nestedDS:this.getDataSet();
if(ds){
_660=ds.getValue(_65e,_65f);
}
return _660;
};
this.getCurrentRow=function(){
if(_656.length<2||_659()<0){
return _654.getCurrentRow();
}
var data=this.getData();
var _664=_659();
if(_664<0||_664>data.length){
Spry.Debug.reportError("Invalid index used in Spry.Data.Region.DSContext.getCurrentRow()!\n");
return null;
}
return data[_664];
};
this.getRowIndex=function(){
var _665=_659();
if(_665>=0){
return _665;
}
return _654.getRowNumber(_654.getCurrentRow());
};
this.setRowIndex=function(_666){
this.getCurrentState().rowIndex=_666;
var data=this.getData();
var _668=_658.length;
for(var i=0;i<_668;i++){
_658[i].syncDataWithParentRow(this,_666,data);
}
};
this.syncDataWithParentRow=function(_66a,_66b,_66c){
var row=_66c[_66b];
if(row){
nestedDS=_654.getNestedDataSetForParentRow(row);
if(nestedDS){
var _66e=this.getCurrentState();
_66e.nestedDS=nestedDS;
_66e.data=nestedDS.getData();
_66e.rowIndex=nestedDS.getCurrentRowNumber();
_66e.rowIndex=_66e.rowIndex<0?0:_66e.rowIndex;
var _66f=_658.length;
for(var i=0;i<_66f;i++){
_658[i].syncDataWithParentRow(this,_66e.rowIndex,_66e.data);
}
}
}
};
this.pushState=function(){
var _671=this.getCurrentState();
var _672=new Object;
_672.rowIndex=_671.rowIndex;
_672.data=_671.data;
_672.nestedDS=_671.nestedDS;
_656.push(_672);
var _673=_658.length;
for(var i=0;i<_673;i++){
_658[i].pushState();
}
};
this.popState=function(){
if(_656.length<2){
Spry.Debug.reportError("Stack underflow in Spry.Data.Region.DSContext.popState()!\n");
return;
}
var _675=_658.length;
for(var i=0;i<_675;i++){
_658[i].popState();
}
_656.pop();
};
this.getCurrentState=function(){
return _656[_656.length-1];
};
this.addChild=function(_677){
var _678=_658.length;
for(var i=0;i<_678;i++){
if(_658[i]==_677){
return;
}
}
_658.push(_677);
};
};
Spry.Data.Region.ProcessingContext=function(_67a){
this.region=_67a;
this.dataSetContexts=[];
if(_67a&&_67a.dataSets){
var _67b=_67a.dataSets.slice(0);
var _67c=_67b.length;
for(var i=0;i<_67c;i++){
var ds=_67a.dataSets[i];
while(ds&&ds.getParentDataSet){
var _67f=false;
ds=ds.getParentDataSet();
if(ds&&this.indexOf(_67b,ds)==-1){
_67b.push(ds);
}
}
}
for(i=0;i<_67b.length;i++){
this.dataSetContexts.push(new Spry.Data.Region.DSContext(_67b[i],this));
}
var _680=this.dataSetContexts;
var _681=_680.length;
for(i=0;i<_681;i++){
var dsc=_680[i];
var ds=dsc.getDataSet();
if(ds.getParentDataSet){
var _683=ds.getParentDataSet();
if(_683){
var pdsc=this.getDataSetContext(_683);
if(pdsc){
pdsc.addChild(dsc);
}
}
}
}
}
};
Spry.Data.Region.ProcessingContext.prototype.indexOf=function(arr,item){
if(arr){
var _687=arr.length;
for(var i=0;i<_687;i++){
if(arr[i]==item){
return i;
}
}
}
return -1;
};
Spry.Data.Region.ProcessingContext.prototype.getDataSetContext=function(_689){
if(!_689){
if(this.dataSetContexts.length>0){
return this.dataSetContexts[0];
}
return null;
}
if(typeof _689=="string"){
_689=Spry.Data.getDataSetByName(_689);
if(!_689){
return null;
}
}
for(var i=0;i<this.dataSetContexts.length;i++){
var dsc=this.dataSetContexts[i];
if(dsc.getDataSet()==_689){
return dsc;
}
}
return null;
};
Spry.Data.Region.ProcessingContext.prototype.getValueFromDataSet=function(){
var _68c="";
var _68d="";
if(arguments.length>1){
_68c=arguments[0];
_68d=arguments[1];
}else{
var _68e=arguments[0].replace(/\s*{\s*|\s*}\s*/g,"");
if(_68e.search("::")!=-1){
_68c=_68e.replace(/::.*/,"");
_68d=_68e.replace(/.*::/,"");
}else{
_68d=_68e;
}
}
var _68f="";
var _690=this.getDataSetContext(_68c);
if(_690){
_68f=_690.getValue(_68d,_690.getCurrentRow());
}else{
Spry.Debug.reportError("getValueFromDataSet: Failed to get "+_68c+" context for the "+this.region.regionNode.id+" region.\n");
}
return _68f;
};
Spry.Data.Region.ProcessingContext.prototype.$v=Spry.Data.Region.ProcessingContext.prototype.getValueFromDataSet;
Spry.Data.Region.ProcessingContext.prototype.getCurrentRowForDataSet=function(_691){
var dsc=this.getDataSetContext(_691);
if(dsc){
return dsc.getCurrentRow();
}
return null;
};
Spry.Data.Region.Token=function(_693,_694,data,_696){
var self=this;
this.tokenType=_693;
this.dataSet=_694;
this.data=data;
this.regionStr=_696;
this.parent=null;
this.children=null;
};
Spry.Data.Region.Token.prototype.addChild=function(_698){
if(!_698){
return;
}
if(!this.children){
this.children=new Array;
}
this.children.push(_698);
_698.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(_699,data,_69b,_69c){
var self=this;
this.name=_699;
this.data=data;
this.jsExpr=_69b;
this.regionState=_69c;
};
Spry.Utils.addLoadListener(function(){
setTimeout(function(){
if(Spry.Data.initRegionsOnLoad){
Spry.Data.initRegions();
}
},0);
});

