var Spry;if(!Spry){Spry={}}Spry.forwards=1;Spry.backwards=2;Spry.linearTransition=1;Spry.sinusoidalTransition=2;if(!Spry.Effect){Spry.Effect={}}Spry.Effect.Registry=function(){this.elements=new Array();_AnimatedElement=function(a){this.element=a;this.currentEffect=-1;this.effectArray=new Array()};this.AnimatedElement=_AnimatedElement};Spry.Effect.Registry.prototype.getRegisteredEffect=function(d,e){var b=this.getIndexOfElement(d);if(b==-1){this.elements[this.elements.length]=new this.AnimatedElement(d);b=this.elements.length-1}var g=-1;for(var c=0;c<this.elements[b].effectArray.length;c++){if(this.elements[b].effectArray[c]){if(this.effectsAreTheSame(this.elements[b].effectArray[c],e)){g=c;if(this.elements[b].effectArray[c].isRunning==true){this.elements[b].effectArray[c].cancel()}this.elements[b].currentEffect=c;if(this.elements[b].effectArray[c].options&&(this.elements[b].effectArray[c].options.toggle!=null)){if(this.elements[b].effectArray[c].options.toggle==true){this.elements[b].effectArray[c].doToggle()}}else{this.elements[b].effectArray[c]=e}break}}}if(g==-1){var f=this.elements[b].effectArray.length;this.elements[b].effectArray[f]=e;this.elements[b].currentEffect=f}var a=this.elements[b].currentEffect;return this.elements[b].effectArray[a]};Spry.Effect.Registry.prototype.getIndexOfElement=function(b){var c=-1;for(var a=0;a<this.elements.length;a++){if(this.elements[a]){if(this.elements[a].element==b){c=a}}}return c};Spry.Effect.Registry.prototype.effectsAreTheSame=function(b,a){if(b.name!=a.name){return false}if(b.effectsArray){if(!a.effectsArray||b.effectsArray.length!=a.effectsArray.length){return false}for(var c=0;c<b.effectsArray.length;c++){if(!Spry.Effect.Utils.optionsAreIdentical(b.effectsArray[c].effect.options,a.effectsArray[c].effect.options)){return false}}}else{if(a.effectsArray||!Spry.Effect.Utils.optionsAreIdentical(b.options,a.options)){return false}}return true};var SpryRegistry=new Spry.Effect.Registry;if(!Spry.Effect.Utils){Spry.Effect.Utils={}}Spry.Effect.Utils.showError=function(a){alert("Spry.Effect ERR: "+a)};Spry.Effect.Utils.Position=function(){this.x=0;this.y=0;this.units="px"};Spry.Effect.Utils.Rectangle=function(){this.width=0;this.height=0;this.units="px"};Spry.Effect.Utils.PositionedRectangle=function(){this.position=new Spry.Effect.Utils.Position;this.rectangle=new Spry.Effect.Utils.Rectangle};Spry.Effect.Utils.intToHex=function(b){var a=b.toString(16);if(a.length==1){a="0"+a}return a};Spry.Effect.Utils.hexToInt=function(a){return parseInt(a,16)};Spry.Effect.Utils.rgb=function(b,d,c){var e=Spry.Effect.Utils.intToHex(b);var a=Spry.Effect.Utils.intToHex(d);var f=Spry.Effect.Utils.intToHex(c);compositeColorHex=e.concat(a,f);compositeColorHex="#"+compositeColorHex;return compositeColorHex};Spry.Effect.Utils.camelize=function(a){var e=a.split("-");var b=true;var c="";for(var d=0;d<e.length;d++){if(e[d].length>0){if(b){c=e[d];b=false}else{var f=e[d];c+=f.charAt(0).toUpperCase()+f.substring(1)}}}return c};Spry.Effect.Utils.isPercentValue=function(b){var a=false;try{if(b.lastIndexOf("%")>0){a=true}}catch(c){}return a};Spry.Effect.Utils.getPercentValue=function(b){var a=0;try{a=Number(b.substring(0,b.lastIndexOf("%")))}catch(c){Spry.Effect.Utils.showError("Spry.Effect.Utils.getPercentValue: "+c)}return a};Spry.Effect.Utils.getPixelValue=function(b){var a=0;try{a=Number(b.substring(0,b.lastIndexOf("px")))}catch(c){}return a};Spry.Effect.Utils.getFirstChildElement=function(b){if(b){var a=b.firstChild;while(a){if(a.nodeType==1){return a}a=a.nextSibling}}return null};Spry.Effect.Utils.fetchChildImages=function(b,e){if(!b||b.nodeType!=1||!e){return}if(b.hasChildNodes()){var a=b.getElementsByTagName("img");var d=a.length;for(var c=0;c<d;c++){var g=a[c];var f=Spry.Effect.getDimensions(g);e.push([g,f.width,f.height])}}};Spry.Effect.Utils.optionsAreIdentical=function(d,c){if(d==null&&c==null){return true}if(d!=null&&c!=null){var b=0;var g=0;for(var a in d){b++}for(var f in c){g++}if(b!=g){return false}for(var e in d){if(d[e]===undefined){if(c[e]!==undefined){return false}}else{if((c[e]===undefined)||(d[e]!=c[e])){return false}}}return true}return false};Spry.Effect.getElement=function(b){var a=null;if(b&&typeof b=="string"){a=document.getElementById(b)}else{a=b}if(a==null){Spry.Effect.Utils.showError('Element "'+b+'" not found.')}return a};Spry.Effect.getStyleProp=function(b,f){var c;try{c=b.style[Spry.Effect.Utils.camelize(f)];if(!c){if(document.defaultView&&document.defaultView.getComputedStyle){var a=document.defaultView.getComputedStyle(b,null);c=a?a.getPropertyValue(f):null}else{if(b.currentStyle){c=b.currentStyle[Spry.Effect.Utils.camelize(f)]}}}}catch(d){Spry.Effect.Utils.showError("Spry.Effect.getStyleProp: "+d)}return c=="auto"?null:c};Spry.Effect.getStylePropRegardlessOfDisplayState=function(c,g,e){var f=e?e:c;var d=Spry.Effect.getStyleProp(f,"display");var b=Spry.Effect.getStyleProp(f,"visibility");if(d=="none"){Spry.Effect.setStyleProp(f,"visibility","hidden");Spry.Effect.setStyleProp(f,"display","block");if(window.opera){f.focus()}}var a=Spry.Effect.getStyleProp(c,g);if(d=="none"){Spry.Effect.setStyleProp(f,"display","none");Spry.Effect.setStyleProp(f,"visibility",b)}return a};Spry.Effect.setStyleProp=function(a,d,b){try{a.style[Spry.Effect.Utils.camelize(d)]=b}catch(c){Spry.Effect.Utils.showError("Spry.Effect.setStyleProp: "+c)}return null};Spry.Effect.makePositioned=function(a){var b=Spry.Effect.getStyleProp(a,"position");if(!b||b=="static"){a.style.position="relative";if(window.opera){a.style.top=0;a.style.left=0}}};Spry.Effect.isInvisible=function(c){var a=Spry.Effect.getStyleProp(c,"display");if(a&&a.toLowerCase()=="none"){return true}var b=Spry.Effect.getStyleProp(c,"visibility");if(b&&b.toLowerCase()=="hidden"){return true}return false};Spry.Effect.enforceVisible=function(c){var a=Spry.Effect.getStyleProp(c,"display");if(a&&a.toLowerCase()=="none"){Spry.Effect.setStyleProp(c,"display","block")}var b=Spry.Effect.getStyleProp(c,"visibility");if(b&&b.toLowerCase()=="hidden"){Spry.Effect.setStyleProp(c,"visibility","visible")}};Spry.Effect.makeClipping=function(b){var d=Spry.Effect.getStyleProp(b,"overflow");if(d!="hidden"&&d!="scroll"){var a=0;var c=/MSIE 7.0/.test(navigator.userAgent)&&/Windows NT/.test(navigator.userAgent);if(c){a=Spry.Effect.getDimensionsRegardlessOfDisplayState(b).height}Spry.Effect.setStyleProp(b,"overflow","hidden");if(c){Spry.Effect.setStyleProp(b,"height",a+"px")}}};Spry.Effect.cleanWhitespace=function(b){var f=b.childNodes.length;for(var a=f-1;a>=0;a--){var c=b.childNodes[a];if(c.nodeType==3&&!/\S/.test(c.nodeValue)){try{b.removeChild(c)}catch(d){Spry.Effect.Utils.showError("Spry.Effect.cleanWhitespace: "+d)}}}};Spry.Effect.getComputedStyle=function(b){var a=/MSIE/.test(navigator.userAgent)?b.currentStyle:document.defaultView.getComputedStyle(b,null);return a};Spry.Effect.getDimensions=function(b){var d=new Spry.Effect.Utils.Rectangle;var a=null;if(b.style.width&&/px/i.test(b.style.width)){d.width=parseInt(b.style.width)}else{a=Spry.Effect.getComputedStyle(b);var c=a&&a.width&&/px/i.test(a.width);if(c){d.width=parseInt(a.width)}if(!c||d.width==0){d.width=b.offsetWidth}}if(b.style.height&&/px/i.test(b.style.height)){d.height=parseInt(b.style.height)}else{if(!a){a=Spry.Effect.getComputedStyle(b)}var c=a&&a.height&&/px/i.test(a.height);if(c){d.height=parseInt(a.height)}if(!c||d.height==0){d.height=b.offsetHeight}}return d};Spry.Effect.getDimensionsRegardlessOfDisplayState=function(b,e){var f=e?e:b;var d=Spry.Effect.getStyleProp(f,"display");var a=Spry.Effect.getStyleProp(f,"visibility");if(d=="none"){Spry.Effect.setStyleProp(f,"visibility","hidden");Spry.Effect.setStyleProp(f,"display","block");if(window.opera){f.focus()}}var c=Spry.Effect.getDimensions(b);if(d=="none"){Spry.Effect.setStyleProp(f,"display","none");Spry.Effect.setStyleProp(f,"visibility",a)}return c};Spry.Effect.getOpacity=function(a){var b=Spry.Effect.getStyleProp(a,"opacity");if(b==undefined||b==null){b=1}return b};Spry.Effect.getColor=function(a){var b=Spry.Effect.getStyleProp(ele,"background-color");return b};Spry.Effect.getPosition=function(c){var a=new Spry.Effect.Utils.Position;var b=null;if(c.style.left&&/px/i.test(c.style.left)){a.x=parseInt(c.style.left)}else{b=Spry.Effect.getComputedStyle(c);var d=b&&b.left&&/px/i.test(b.left);if(d){a.x=parseInt(b.left)}if(!d||a.x==0){a.x=c.offsetLeft}}if(c.style.top&&/px/i.test(c.style.top)){a.y=parseInt(c.style.top)}else{if(!b){b=Spry.Effect.getComputedStyle(c)}var d=b&&b.top&&/px/i.test(b.top);if(d){a.y=parseInt(b.top)}if(!d||a.y==0){a.y=c.offsetTop}}return a};Spry.Effect.getOffsetPosition=Spry.Effect.getPosition;Spry.Effect.Animator=function(a){this.name="Animator";this.element=null;this.timer=null;this.direction=Spry.forwards;this.startMilliseconds=0;this.repeat="none";this.isRunning=false;this.options={duration:500,toggle:false,transition:Spry.linearTransition,interval:33};this.setOptions(a)};Spry.Effect.Animator.prototype.setOptions=function(a){if(!a){return}for(var b in a){this.options[b]=a[b]}};Spry.Effect.Animator.prototype.start=function(d){if(arguments.length==0){d=false}var a=this;if(this.options.setup){try{this.options.setup(this.element,this)}catch(c){Spry.Effect.Utils.showError("Spry.Effect.Animator.prototype.start: setup callback: "+c)}}this.prepareStart();var b=new Date();this.startMilliseconds=b.getTime();if(d==false){this.timer=setInterval(function(){a.drawEffect()},this.options.interval)}this.isRunning=true};Spry.Effect.Animator.prototype.stop=function(){if(this.timer){clearInterval(this.timer);this.timer=null}this.startMilliseconds=0;if(this.options.finish){try{this.options.finish(this.element,this)}catch(a){Spry.Effect.Utils.showError("Spry.Effect.Animator.prototype.stop: finish callback: "+a)}}this.isRunning=false};Spry.Effect.Animator.prototype.cancel=function(){if(this.timer){clearInterval(this.timer);this.timer=null}this.isRunning=false};Spry.Effect.Animator.prototype.drawEffect=function(){var b=true;var a=this.getElapsedMilliseconds()/this.options.duration;if(this.getElapsedMilliseconds()>this.options.duration){a=1}else{if(this.options.transition==Spry.sinusoidalTransition){a=(-Math.cos(a*Math.PI)/2)+0.5}else{if(this.options.transition==Spry.linearTransition){}else{Spry.Effect.Utils.showError("unknown transition")}}}this.animate(a);if(this.getElapsedMilliseconds()>this.options.duration){this.stop();b=false}return b};Spry.Effect.Animator.prototype.getElapsedMilliseconds=function(){if(this.startMilliseconds>0){var a=new Date();return(a.getTime()-this.startMilliseconds)}else{return 0}};Spry.Effect.Animator.prototype.doToggle=function(){if(this.options.toggle==true){if(this.direction==Spry.forwards){this.direction=Spry.backwards}else{if(this.direction==Spry.backwards){this.direction=Spry.forwards}}}};Spry.Effect.Animator.prototype.prepareStart=function(){};Spry.Effect.Animator.prototype.animate=function(a){};Spry.Effect.Move=function(c,b,d,a){this.dynamicFromPos=false;if(arguments.length==3){a=d;d=b;b=Spry.Effect.getPosition(c);this.dynamicFromPos=true}Spry.Effect.Animator.call(this,a);this.name="Move";this.element=Spry.Effect.getElement(c);if(b.units!=d.units){Spry.Effect.Utils.showError("Spry.Effect.Move: Conflicting units ("+b.units+", "+d.units+")")}this.units=b.units;this.startX=b.x;this.stopX=d.x;this.startY=b.y;this.stopY=d.y;this.rangeMoveX=this.startX-this.stopX;this.rangeMoveY=this.startY-this.stopY};Spry.Effect.Move.prototype=new Spry.Effect.Animator();Spry.Effect.Move.prototype.constructor=Spry.Effect.Move;Spry.Effect.Move.prototype.animate=function(a){var c=0;var b=0;if(this.direction==Spry.forwards){c=this.startX-(this.rangeMoveX*a);b=this.startY-(this.rangeMoveY*a)}else{if(this.direction==Spry.backwards){c=this.rangeMoveX*a+this.stopX;b=this.rangeMoveY*a+this.stopY}}this.element.style.left=c+this.units;this.element.style.top=b+this.units};Spry.Effect.Move.prototype.prepareStart=function(){if(this.dynamicFromPos==true){var a=Spry.Effect.getPosition(this.element);this.startX=a.x;this.startY=a.y;this.rangeMoveX=this.startX-this.stopX;this.rangeMoveY=this.startY-this.stopY}};Spry.Effect.MoveSlide=function(d,c,f,a,b){this.dynamicFromPos=false;if(arguments.length==4){b=a;a=f;f=c;c=Spry.Effect.getPosition(d);this.dynamicFromPos=true}Spry.Effect.Animator.call(this,b);this.name="MoveSlide";this.element=Spry.Effect.getElement(d);this.horizontal=a;this.firstChildElement=Spry.Effect.Utils.getFirstChildElement(d);this.overflow=Spry.Effect.getStyleProp(this.element,"overflow");this.originalChildRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(this.firstChildElement,this.element);if(c.units!=f.units){Spry.Effect.Utils.showError("Spry.Effect.MoveSlide: Conflicting units ("+c.units+", "+f.units+")")}this.units=c.units;var e=Spry.Effect.getDimensionsRegardlessOfDisplayState(d);this.startHeight=e.height;this.startX=Number(c.x);this.stopX=Number(f.x);this.startY=Number(c.y);this.stopY=Number(f.y);this.rangeMoveX=this.startX-this.stopX;this.rangeMoveY=this.startY-this.stopY;this.enforceVisible=Spry.Effect.isInvisible(this.element)};Spry.Effect.MoveSlide.prototype=new Spry.Effect.Animator();Spry.Effect.MoveSlide.prototype.constructor=Spry.Effect.MoveSlide;Spry.Effect.MoveSlide.prototype.animate=function(b){if(this.horizontal){var g=(this.direction==Spry.forwards)?this.startX:this.stopX;var d=(this.direction==Spry.forwards)?this.stopX:this.startX;var a=g+b*(d-g);if(a<0){a=0}if(this.overflow!="scroll"||a>this.originalChildRect.width){this.firstChildElement.style.left=a-this.originalChildRect.width+this.units}this.element.style.width=a+this.units}else{var f=(this.direction==Spry.forwards)?this.startY:this.stopY;var c=(this.direction==Spry.forwards)?this.stopY:this.startY;var e=f+b*(c-f);if(e<0){e=0}if(this.overflow!="scroll"||e>this.originalChildRect.height){this.firstChildElement.style.top=e-this.originalChildRect.height+this.units}this.element.style.height=e+this.units}if(this.enforceVisible){Spry.Effect.enforceVisible(this.element);this.enforceVisible=false}};Spry.Effect.MoveSlide.prototype.prepareStart=function(){if(this.dynamicFromPos==true){var a=Spry.Effect.getPosition(this.element);this.startX=a.x;this.startY=a.y;this.rangeMoveX=this.startX-this.stopX;this.rangeMoveY=this.startY-this.stopY}};Spry.Effect.Size=function(e,a,h,i){this.dynamicFromRect=false;if(arguments.length==3){i=h;h=a;a=Spry.Effect.getDimensionsRegardlessOfDisplayState(e);this.dynamicFromRect=true}Spry.Effect.Animator.call(this,i);this.name="Size";this.element=Spry.Effect.getElement(e);if(a.units!=h.units){Spry.Effect.Utils.showError("Spry.Effect.Size: Conflicting units ("+a.units+", "+h.units+")")}this.units=a.units;var b=Spry.Effect.getDimensionsRegardlessOfDisplayState(e);this.originalWidth=b.width;this.startWidth=a.width;this.startHeight=a.height;this.stopWidth=h.width;this.stopHeight=h.height;this.childImages=new Array();if(this.options.scaleContent){Spry.Effect.Utils.fetchChildImages(e,this.childImages)}this.fontFactor=1;if(this.element.style&&this.element.style.fontSize){if(/em\s*$/.test(this.element.style.fontSize)){this.fontFactor=parseFloat(this.element.style.fontSize)}}if(Spry.Effect.Utils.isPercentValue(this.startWidth)){var c=Spry.Effect.Utils.getPercentValue(this.startWidth);this.startWidth=b.width*(c/100)}if(Spry.Effect.Utils.isPercentValue(this.startHeight)){var f=Spry.Effect.Utils.getPercentValue(this.startHeight);this.startHeight=b.height*(f/100)}if(Spry.Effect.Utils.isPercentValue(this.stopWidth)){var d=Spry.Effect.Utils.getPercentValue(this.stopWidth);var b=Spry.Effect.getDimensionsRegardlessOfDisplayState(e);this.stopWidth=b.width*(d/100)}if(Spry.Effect.Utils.isPercentValue(this.stopHeight)){var g=Spry.Effect.Utils.getPercentValue(this.stopHeight);var b=Spry.Effect.getDimensionsRegardlessOfDisplayState(e);this.stopHeight=b.height*(g/100)}this.widthRange=this.startWidth-this.stopWidth;this.heightRange=this.startHeight-this.stopHeight;this.enforceVisible=Spry.Effect.isInvisible(this.element)};Spry.Effect.Size.prototype=new Spry.Effect.Animator();Spry.Effect.Size.prototype.constructor=Spry.Effect.Size;Spry.Effect.Size.prototype.animate=function(b){var e=0;var a=0;var f=0;if(this.direction==Spry.forwards){e=this.startWidth-(this.widthRange*b);a=this.startHeight-(this.heightRange*b);f=this.fontFactor*(this.startWidth+b*(this.stopWidth-this.startWidth))/this.originalWidth}else{if(this.direction==Spry.backwards){e=this.widthRange*b+this.stopWidth;a=this.heightRange*b+this.stopHeight;f=this.fontFactor*(this.stopWidth+b*(this.startWidth-this.stopWidth))/this.originalWidth}}if(this.options.scaleContent==true){this.element.style.fontSize=f+"em"}this.element.style.width=e+this.units;this.element.style.height=a+this.units;if(this.options.scaleContent){var d=(this.direction==Spry.forwards)?(this.startWidth+b*(this.stopWidth-this.startWidth))/this.originalWidth:(this.stopWidth+b*(this.startWidth-this.stopWidth))/this.originalWidth;for(var c=0;c<this.childImages.length;c++){this.childImages[c][0].style.width=d*this.childImages[c][1]+this.units;this.childImages[c][0].style.height=d*this.childImages[c][2]+this.units}}if(this.enforceVisible){Spry.Effect.enforceVisible(this.element);this.enforceVisible=false}};Spry.Effect.Size.prototype.prepareStart=function(){if(this.dynamicFromRect==true){var a=Spry.Effect.getDimensions(element);this.startWidth=a.width;this.startHeight=a.height;this.widthRange=this.startWidth-this.stopWidth;this.heightRange=this.startHeight-this.stopHeight}};Spry.Effect.Opacity=function(c,b,d,a){this.dynamicStartOpacity=false;if(arguments.length==3){a=d;d=b;b=Spry.Effect.getOpacity(c);this.dynamicStartOpacity=true}Spry.Effect.Animator.call(this,a);this.name="Opacity";this.element=Spry.Effect.getElement(c);if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout)){Spry.Effect.setStyleProp(this.element,"zoom","1")}this.startOpacity=b;this.stopOpacity=d;this.opacityRange=this.startOpacity-this.stopOpacity;this.enforceVisible=Spry.Effect.isInvisible(this.element)};Spry.Effect.Opacity.prototype=new Spry.Effect.Animator();Spry.Effect.Opacity.prototype.constructor=Spry.Effect.Opacity;Spry.Effect.Opacity.prototype.animate=function(a){var b=0;if(this.direction==Spry.forwards){b=this.startOpacity-(this.opacityRange*a)}else{if(this.direction==Spry.backwards){b=this.opacityRange*a+this.stopOpacity}}this.element.style.opacity=b;this.element.style.filter="alpha(opacity="+Math.floor(b*100)+")";if(this.enforceVisible){Spry.Effect.enforceVisible(this.element);this.enforceVisible=false}};Spry.Effect.Size.prototype.prepareStart=function(){if(this.dynamicStartOpacity==true){this.startOpacity=Spry.Effect.getOpacity(element);this.opacityRange=this.startOpacity-this.stopOpacity}};Spry.Effect.Color=function(c,d,a,b){this.dynamicStartColor=false;if(arguments.length==3){b=a;a=d;d=Spry.Effect.getColor(c);this.dynamicStartColor=true}Spry.Effect.Animator.call(this,b);this.name="Color";this.element=Spry.Effect.getElement(c);this.startColor=d;this.stopColor=a;this.startRedColor=Spry.Effect.Utils.hexToInt(d.substr(1,2));this.startGreenColor=Spry.Effect.Utils.hexToInt(d.substr(3,2));this.startBlueColor=Spry.Effect.Utils.hexToInt(d.substr(5,2));this.stopRedColor=Spry.Effect.Utils.hexToInt(a.substr(1,2));this.stopGreenColor=Spry.Effect.Utils.hexToInt(a.substr(3,2));this.stopBlueColor=Spry.Effect.Utils.hexToInt(a.substr(5,2));this.redColorRange=this.startRedColor-this.stopRedColor;this.greenColorRange=this.startGreenColor-this.stopGreenColor;this.blueColorRange=this.startBlueColor-this.stopBlueColor};Spry.Effect.Color.prototype=new Spry.Effect.Animator();Spry.Effect.Color.prototype.constructor=Spry.Effect.Color;Spry.Effect.Color.prototype.animate=function(a){var b=0;var d=0;var c=0;if(this.direction==Spry.forwards){b=parseInt(this.startRedColor-(this.redColorRange*a));d=parseInt(this.startGreenColor-(this.greenColorRange*a));c=parseInt(this.startBlueColor-(this.blueColorRange*a))}else{if(this.direction==Spry.backwards){b=parseInt(this.redColorRange*a)+this.stopRedColor;d=parseInt(this.greenColorRange*a)+this.stopGreenColor;c=parseInt(this.blueColorRange*a)+this.stopBlueColor}}this.element.style.backgroundColor=Spry.Effect.Utils.rgb(b,d,c)};Spry.Effect.Size.prototype.prepareStart=function(){if(this.dynamicStartColor==true){this.startColor=Spry.Effect.getColor(element);this.startRedColor=Spry.Effect.Utils.hexToInt(startColor.substr(1,2));this.startGreenColor=Spry.Effect.Utils.hexToInt(startColor.substr(3,2));this.startBlueColor=Spry.Effect.Utils.hexToInt(startColor.substr(5,2));this.redColorRange=this.startRedColor-this.stopRedColor;this.greenColorRange=this.startGreenColor-this.stopGreenColor;this.blueColorRange=this.startBlueColor-this.stopBlueColor}};Spry.Effect.Cluster=function(a){Spry.Effect.Animator.call(this,a);this.name="Cluster";this.effectsArray=new Array();this.currIdx=-1;_ClusteredEffect=function(c,b){this.effect=c;this.kind=b;this.isRunning=false};this.ClusteredEffect=_ClusteredEffect};Spry.Effect.Cluster.prototype=new Spry.Effect.Animator();Spry.Effect.Cluster.prototype.constructor=Spry.Effect.Cluster;Spry.Effect.Cluster.prototype.drawEffect=function(){var d=true;var c=false;if(this.currIdx==-1){this.initNextEffectsRunning()}var e=false;var a=false;for(var b=0;b<this.effectsArray.length;b++){if(this.effectsArray[b].isRunning==true){e=this.effectsArray[b].effect.drawEffect();if(e==false&&b==this.currIdx){this.effectsArray[b].isRunning=false;a=true}}}if(a==true){c=this.initNextEffectsRunning()}if(c==true){this.stop();d=false;for(var b=0;b<this.effectsArray.length;b++){this.effectsArray[b].isRunning=false}this.currIdx=-1}return d};Spry.Effect.Cluster.prototype.initNextEffectsRunning=function(){var b=false;this.currIdx++;if(this.currIdx>(this.effectsArray.length-1)){b=true}else{for(var a=this.currIdx;a<this.effectsArray.length;a++){if((a>this.currIdx)&&this.effectsArray[a].kind=="queue"){break}this.effectsArray[a].effect.start(true);this.effectsArray[a].isRunning=true;this.currIdx=a}}return b};Spry.Effect.Cluster.prototype.doToggle=function(){if(this.options.toggle==true){if(this.direction==Spry.forwards){this.direction=Spry.backwards}else{if(this.direction==Spry.backwards){this.direction=Spry.forwards}}}for(var a=0;a<this.effectsArray.length;a++){if(this.effectsArray[a].effect.options&&(this.effectsArray[a].effect.options.toggle!=null)){if(this.effectsArray[a].effect.options.toggle==true){this.effectsArray[a].effect.doToggle()}}}};Spry.Effect.Cluster.prototype.cancel=function(){for(var a=0;a<this.effectsArray.length;a++){this.effectsArray[a].effect.cancel()}if(this.timer){clearInterval(this.timer);this.timer=null}this.isRunning=false};Spry.Effect.Cluster.prototype.addNextEffect=function(a){this.effectsArray[this.effectsArray.length]=new this.ClusteredEffect(a,"queue");if(this.effectsArray.length==1){this.element=a.element}};Spry.Effect.Cluster.prototype.addParallelEffect=function(a){this.effectsArray[this.effectsArray.length]=new this.ClusteredEffect(a,"parallel");if(this.effectsArray.length==1){this.element=a.element}};Spry.Effect.AppearFade=function(f,j){var f=Spry.Effect.getElement(f);var a=1000;var h=0;var e=100;var k=false;var b=Spry.sinusoidalTransition;var d=null;var i=null;if(j){if(j.duration!=null){a=j.duration}if(j.from!=null){h=j.from}if(j.to!=null){e=j.to}if(j.toggle!=null){k=j.toggle}if(j.transition!=null){b=j.transition}if(j.setup!=null){d=j.setup}if(j.finish!=null){i=j.finish}}j={duration:a,toggle:k,transition:b,setup:d,finish:i,from:h,to:e};h=h/100;e=e/100;var g=new Spry.Effect.Opacity(f,h,e,j);g.name="AppearFade";var c=SpryRegistry.getRegisteredEffect(f,g);c.start();return c};Spry.Effect.Blind=function(j,o){var j=Spry.Effect.getElement(j);Spry.Effect.makeClipping(j);var b=1000;var p=false;var c=Spry.sinusoidalTransition;var i=false;var g=null;var q=null;var f=Spry.Effect.getDimensionsRegardlessOfDisplayState(j);var h=f.height;var m=0;var l=o?o.from:f.height;var a=o?o.to:0;if(o){if(o.duration!=null){b=o.duration}if(o.from!=null){if(Spry.Effect.Utils.isPercentValue(o.from)){h=Spry.Effect.Utils.getPercentValue(o.from)*f.height/100}else{h=Spry.Effect.Utils.getPixelValue(o.from)}}if(o.to!=null){if(Spry.Effect.Utils.isPercentValue(o.to)){m=Spry.Effect.Utils.getPercentValue(o.to)*f.height/100}else{m=Spry.Effect.Utils.getPixelValue(o.to)}}if(o.toggle!=null){p=o.toggle}if(o.transition!=null){c=o.transition}if(o.setup!=null){g=o.setup}if(o.finish!=null){q=o.finish}}var e=new Spry.Effect.Utils.Rectangle;e.width=f.width;e.height=h;var n=new Spry.Effect.Utils.Rectangle;n.width=f.width;n.height=m;o={duration:b,toggle:p,transition:c,scaleContent:i,setup:g,finish:q,from:l,to:a};var k=new Spry.Effect.Size(j,e,n,o);k.name="Blind";var d=SpryRegistry.getRegisteredEffect(j,k);d.start();return d};function setupHighlight(a,b){Spry.Effect.setStyleProp(a,"background-image","none")}function finishHighlight(a,b){Spry.Effect.setStyleProp(a,"background-image",b.options.restoreBackgroundImage);if(b.direction==Spry.forwards){Spry.Effect.setStyleProp(a,"background-color",b.options.restoreColor)}}Spry.Effect.Highlight=function(h,m){var b=1000;var c="#ffffff";var n=false;var d=Spry.sinusoidalTransition;var f=setupHighlight;var o=finishHighlight;var h=Spry.Effect.getElement(h);var i=Spry.Effect.getStyleProp(h,"background-color");var k=i;if(i=="transparent"){i="#ffff99"}var j=m?m.from:"#ffff00";var a=m?m.to:"#0000ff";if(m){if(m.duration!=null){b=m.duration}if(m.from!=null){i=m.from}if(m.to!=null){c=m.to}if(m.restoreColor){k=m.restoreColor}if(m.toggle!=null){n=m.toggle}if(m.transition!=null){d=m.transition}if(m.setup!=null){f=m.setup}if(m.finish!=null){o=m.finish}}var l=Spry.Effect.getStyleProp(h,"background-image");m={duration:b,toggle:n,transition:d,setup:f,finish:o,restoreColor:k,restoreBackgroundImage:l,from:j,to:a};var g=new Spry.Effect.Color(h,i,c,m);g.name="Highlight";var e=SpryRegistry.getRegisteredEffect(h,g);e.start();return e};Spry.Effect.Slide=function(a,c){var a=Spry.Effect.getElement(a);var l=2000;var q=false;var r=Spry.sinusoidalTransition;var g=false;var s=null;var n=null;var h=Spry.Effect.Utils.getFirstChildElement(a);if(/MSIE 7.0/.test(navigator.userAgent)&&/Windows NT/.test(navigator.userAgent)){Spry.Effect.makePositioned(a)}Spry.Effect.makeClipping(a);if(/MSIE 6.0/.test(navigator.userAgent)&&/Windows NT/.test(navigator.userAgent)){var d=Spry.Effect.getStyleProp(a,"position");if(d&&(d=="static"||d=="fixed")){Spry.Effect.setStyleProp(a,"position","relative");Spry.Effect.setStyleProp(a,"top","");Spry.Effect.setStyleProp(a,"left","")}}if(h){Spry.Effect.makePositioned(h);Spry.Effect.makeClipping(h);var k=Spry.Effect.getDimensionsRegardlessOfDisplayState(h,a);Spry.Effect.setStyleProp(h,"width",k.width+"px")}var j=Spry.Effect.getDimensionsRegardlessOfDisplayState(a);var i=new Spry.Effect.Utils.Position();i.x=parseInt(Spry.Effect.getStyleProp(h,"left"));i.y=parseInt(Spry.Effect.getStyleProp(h,"top"));if(!i.x){i.x=0}if(!i.y){i.y=0}if(c&&c.horizontal!==null&&c.horizontal===true){g=true}var t=g?j.width:j.height;var p=new Spry.Effect.Utils.Position;p.x=i.x;p.y=i.y;var o=new Spry.Effect.Utils.Position;o.x=g?i.x-t:i.x;o.y=g?i.y:i.y-t;var f=c?c.from:j.height;var e=c?c.to:0;if(c){if(c.duration!=null){l=c.duration}if(c.from!=null){if(g){if(Spry.Effect.Utils.isPercentValue(c.from)){p.x=t*Spry.Effect.Utils.getPercentValue(c.from)/100}else{p.x=Spry.Effect.Utils.getPixelValue(c.from)}}else{if(Spry.Effect.Utils.isPercentValue(c.from)){p.y=t*Spry.Effect.Utils.getPercentValue(c.from)/100}else{p.y=Spry.Effect.Utils.getPixelValue(c.from)}}}if(c.to!=null){if(g){if(Spry.Effect.Utils.isPercentValue(c.to)){o.x=t*Spry.Effect.Utils.getPercentValue(c.to)/100}else{o.x=Spry.Effect.Utils.getPixelValue(c.to)}}else{if(Spry.Effect.Utils.isPercentValue(c.to)){o.y=t*Spry.Effect.Utils.getPercentValue(c.to)/100}else{o.y=Spry.Effect.Utils.getPixelValue(c.to)}}}if(c.toggle!=null){q=c.toggle}if(c.transition!=null){r=c.transition}if(c.setup!=null){s=c.setup}if(c.finish!=null){n=c.finish}}c={duration:l,toggle:q,transition:r,setup:s,finish:n,from:f,to:e};var m=new Spry.Effect.MoveSlide(a,p,o,g,c);m.name="Slide";var b=SpryRegistry.getRegisteredEffect(a,m);b.start();return b};Spry.Effect.GrowShrink=function(b,d){var b=Spry.Effect.getElement(b);Spry.Effect.makePositioned(b);Spry.Effect.makeClipping(b);var k=new Spry.Effect.Utils.Position();k.x=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(b,"left"));k.y=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(b,"top"));if(!k.x){k.x=0}if(!k.y){k.y=0}var m=Spry.Effect.getDimensionsRegardlessOfDisplayState(b);var y=m.width;var o=m.height;var w=(y==0)?1:o/y;var n=500;var v=false;var x=Spry.sinusoidalTransition;var u=new Spry.Effect.Utils.Rectangle;u.width=0;u.height=0;var a=new Spry.Effect.Utils.Rectangle;a.width=y;a.height=o;var z=null;var q=null;var r=true;var h=d?d.from:m.width;var i=d?d.to:0;var e=false;var j=true;if(d){if(d.referHeight!=null){e=d.referHeight}if(d.growCenter!=null){j=d.growCenter}if(d.duration!=null){n=d.duration}if(d.from!=null){if(Spry.Effect.Utils.isPercentValue(d.from)){u.width=y*(Spry.Effect.Utils.getPercentValue(d.from)/100);u.height=o*(Spry.Effect.Utils.getPercentValue(d.from)/100)}else{if(e){u.height=Spry.Effect.Utils.getPixelValue(d.from);u.width=Spry.Effect.Utils.getPixelValue(d.from)/w}else{u.width=Spry.Effect.Utils.getPixelValue(d.from);u.height=w*Spry.Effect.Utils.getPixelValue(d.from)}}}if(d.to!=null){if(Spry.Effect.Utils.isPercentValue(d.to)){a.width=y*(Spry.Effect.Utils.getPercentValue(d.to)/100);a.height=o*(Spry.Effect.Utils.getPercentValue(d.to)/100)}else{if(e){a.height=Spry.Effect.Utils.getPixelValue(d.to);a.width=Spry.Effect.Utils.getPixelValue(d.to)/w}else{a.width=Spry.Effect.Utils.getPixelValue(d.to);a.height=w*Spry.Effect.Utils.getPixelValue(d.to)}}}if(d.toggle!=null){v=d.toggle}if(d.transition!=null){x=d.transition}if(d.setup!=null){z=d.setup}if(d.finish!=null){q=d.finish}}d={duration:n,toggle:v,transition:x,scaleContent:r,from:h,to:i};var f=new Spry.Effect.Cluster({toggle:v,setup:z,finish:q});f.name="GrowShrink";var l=new Spry.Effect.Size(b,u,a,d);f.addParallelEffect(l);if(j){d={duration:n,toggle:v,transition:x,from:h,to:i};var t=new Spry.Effect.Utils.Position;t.x=k.x+(y-u.width)/2;t.y=k.y+(o-u.height)/2;var p=new Spry.Effect.Utils.Position;p.x=k.x+(y-a.width)/2;p.y=k.y+(o-a.height)/2;var s={top:t.y,left:t.x};var g=new Spry.Effect.Move(b,t,p,d,s);f.addParallelEffect(g)}var c=SpryRegistry.getRegisteredEffect(b,f);c.start();return c};Spry.Effect.Shake=function(e,i){var e=Spry.Effect.getElement(e);Spry.Effect.makePositioned(e);var c=null;var j=null;if(i){if(i.setup!=null){c=i.setup}if(i.finish!=null){j=i.finish}}var b=new Spry.Effect.Utils.Position();b.x=parseInt(Spry.Effect.getStyleProp(e,"left"));b.y=parseInt(Spry.Effect.getStyleProp(e,"top"));if(!b.x){b.x=0}if(!b.y){b.y=0}var d=new Spry.Effect.Cluster({setup:c,finish:j});d.name="Shake";var g=new Spry.Effect.Utils.Position;g.x=b.x+0;g.y=b.y+0;var f=new Spry.Effect.Utils.Position;f.x=b.x+20;f.y=b.y+0;i={duration:50,toggle:false};var h=new Spry.Effect.Move(e,g,f,i);d.addNextEffect(h);var g=new Spry.Effect.Utils.Position;g.x=b.x+20;g.y=b.y+0;var f=new Spry.Effect.Utils.Position;f.x=b.x+-20;f.y=b.y+0;i={duration:100,toggle:false};var h=new Spry.Effect.Move(e,g,f,i);d.addNextEffect(h);var g=new Spry.Effect.Utils.Position;g.x=b.x+-20;g.y=b.y+0;var f=new Spry.Effect.Utils.Position;f.x=b.x+20;f.y=b.y+0;i={duration:100,toggle:false};var h=new Spry.Effect.Move(e,g,f,i);d.addNextEffect(h);var g=new Spry.Effect.Utils.Position;g.x=b.x+20;g.y=b.y+0;var f=new Spry.Effect.Utils.Position;f.x=b.x+-20;f.y=b.y+0;i={duration:100,toggle:false};var h=new Spry.Effect.Move(e,g,f,i);d.addNextEffect(h);var g=new Spry.Effect.Utils.Position;g.x=b.x+-20;g.y=b.y+0;var f=new Spry.Effect.Utils.Position;f.x=b.x+20;f.y=b.y+0;i={duration:100,toggle:false};var h=new Spry.Effect.Move(e,g,f,i);d.addNextEffect(h);var g=new Spry.Effect.Utils.Position;g.x=b.x+20;g.y=b.y+0;var f=new Spry.Effect.Utils.Position;f.x=b.x+0;f.y=b.y+0;i={duration:50,toggle:false};var h=new Spry.Effect.Move(e,g,f,i);d.addNextEffect(h);var a=SpryRegistry.getRegisteredEffect(e,d);a.start();return a};Spry.Effect.Squish=function(i,n){var i=Spry.Effect.getElement(i);var a=500;var o=true;var e=null;var p=null;if(n){if(n.duration!=null){a=n.duration}if(n.toggle!=null){o=n.toggle}if(n.setup!=null){e=n.setup}if(n.finish!=null){p=n.finish}}Spry.Effect.makePositioned(i);Spry.Effect.makeClipping(i);var d=Spry.Effect.getDimensionsRegardlessOfDisplayState(i);var j=d.width;var l=d.height;var f=0;var h=0;var c=new Spry.Effect.Utils.Rectangle;c.width=j;c.height=l;var m=new Spry.Effect.Utils.Rectangle;m.width=f;m.height=h;var g=true;n={duration:a,toggle:o,scaleContent:g,setup:e,finish:p};var k=new Spry.Effect.Size(i,c,m,n);k.name="Squish";var b=SpryRegistry.getRegisteredEffect(i,k);b.start();return b};Spry.Effect.Pulsate=function(f,l){var f=Spry.Effect.getElement(f);var a=400;var j=100;var e=0;var m=false;var b=Spry.linearTransition;var d=null;var k=null;if(l){if(l.duration!=null){a=l.duration}if(l.from!=null){j=l.from}if(l.to!=null){e=l.to}if(l.toggle!=null){m=l.toggle}if(l.transition!=null){b=l.transition}if(l.setup!=null){d=l.setup}if(l.finish!=null){k=l.finish}}l={duration:a,toggle:m,transition:b,setup:d,finish:k};j=j/100;e=e/100;var i=new Spry.Effect.Cluster();var g=new Spry.Effect.Opacity(f,j,e,l);var h=new Spry.Effect.Opacity(f,e,j,l);i.addNextEffect(g);i.addNextEffect(h);i.addNextEffect(g);i.addNextEffect(h);i.addNextEffect(g);i.addNextEffect(h);i.name="Pulsate";var c=SpryRegistry.getRegisteredEffect(f,i);c.start();return c};Spry.Effect.Puff=function(c,e){var c=Spry.Effect.getElement(c);Spry.Effect.makePositioned(c);var v=null;var p=null;if(e){if(e.setup!=null){v=e.setup}if(e.finish!=null){p=e.finish}}var s=new Spry.Effect.Cluster;var l=500;var k=Spry.Effect.getDimensions(c);var m=k.width;var n=k.height;var t=m*2;var b=n*2;var u=new Spry.Effect.Utils.Rectangle;u.width=m;u.height=n;var a=new Spry.Effect.Utils.Rectangle;a.width=t;a.height=b;var q=false;e={duration:l,toggle:false,scaleContent:q};var j=new Spry.Effect.Size(c,u,a,e);s.addParallelEffect(j);e={duration:l,toggle:false};var g=1;var i=0;var f=new Spry.Effect.Opacity(c,g,i,e);s.addParallelEffect(f);e={duration:l,toggle:false};var r=new Spry.Effect.Utils.Position;r.x=0;r.y=0;var o=new Spry.Effect.Utils.Position;o.x=m/2*-1;o.y=n/2*-1;var h=new Spry.Effect.Move(c,r,o,e);s.addParallelEffect(h);s.setup=v;s.finish=p;s.name="Puff";var d=SpryRegistry.getRegisteredEffect(c,s);d.start();return d};Spry.Effect.DropOut=function(h,m){var h=Spry.Effect.getElement(h);var c=new Spry.Effect.Cluster;var b=500;Spry.Effect.makePositioned(h);var f=null;var n=null;if(m){if(m.setup!=null){f=m.setup}if(m.finish!=null){n=m.finish}}var e=new Spry.Effect.Utils.Position();e.x=parseInt(Spry.Effect.getStyleProp(h,"left"));e.y=parseInt(Spry.Effect.getStyleProp(h,"top"));if(!e.x){e.x=0}if(!e.y){e.y=0}var l=new Spry.Effect.Utils.Position;l.x=e.x+0;l.y=e.y+0;var j=new Spry.Effect.Utils.Position;j.x=e.x+0;j.y=e.y+160;m={from:l,to:j,duration:b,toggle:true};var i=new Spry.Effect.Move(h,m.from,m.to,m);c.addParallelEffect(i);m={duration:b,toggle:true};var k=1;var g=0;var a=new Spry.Effect.Opacity(h,k,g,m);c.addParallelEffect(a);c.setup=f;c.finish=n;c.name="DropOut";var d=SpryRegistry.getRegisteredEffect(h,c);d.start();return d};Spry.Effect.Fold=function(h,n){var h=Spry.Effect.getElement(h);var a=1000;var o=false;var g=true;var k=new Spry.Effect.Cluster();var d=Spry.Effect.getDimensions(h);var i=d.width;var l=d.height;var e=i;var f=l/5;var c=new Spry.Effect.Utils.Rectangle;c.width=i;c.height=l;var m=new Spry.Effect.Utils.Rectangle;m.width=e;m.height=f;n={duration:a,toggle:o,scaleContent:g};var j=new Spry.Effect.Size(h,c,m,n);k.addNextEffect(j);a=500;n={duration:a,toggle:o,scaleContent:g};c.width="100%";c.height="20%";m.width="10%";m.height="20%";var j=new Spry.Effect.Size(h,c,m,n);k.addNextEffect(j);k.name="Fold";var b=SpryRegistry.getRegisteredEffect(h,k);b.start();return b};Spry.Effect.DoFade=function(b,a){return Spry.Effect.AppearFade(b,a)};Spry.Effect.DoBlind=function(b,a){return Spry.Effect.Blind(b,a)};Spry.Effect.DoHighlight=function(b,a){return Spry.Effect.Highlight(b,a)};Spry.Effect.DoSlide=function(b,a){return Spry.Effect.Slide(b,a)};Spry.Effect.DoGrow=function(b,a){return Spry.Effect.GrowShrink(b,a)};Spry.Effect.DoShake=function(b,a){return Spry.Effect.Shake(b,a)};Spry.Effect.DoSquish=function(b,a){return Spry.Effect.Squish(b,a)};Spry.Effect.DoPulsate=function(b,a){return Spry.Effect.Pulsate(b,a)};Spry.Effect.DoPuff=function(b,a){return Spry.Effect.Puff(b,a)};Spry.Effect.DoDropOut=function(b,a){return Spry.Effect.DropOut(b,a)};Spry.Effect.DoFold=function(b,a){return Spry.Effect.Fold(b,a)};function MM_swapImgRestore(){var d,b,c=document.MM_sr;for(d=0;c&&d<c.length&&(b=c[d])&&b.oSrc;d++){b.src=b.oSrc}}function MM_findObj(f,e){var c,b,a;if(!e){e=document}if((c=f.indexOf("?"))>0&&parent.frames.length){e=parent.frames[f.substring(c+1)].document;f=f.substring(0,c)}if(!(a=e[f])&&e.all){a=e.all[f]}for(b=0;!a&&b<e.forms.length;b++){a=e.forms[b][f]}for(b=0;!a&&e.layers&&b<e.layers.length;b++){a=MM_findObj(f,e.layers[b].document)}if(!a&&e.getElementById){a=e.getElementById(f)}return a}function MM_swapImage(){var e,d=0,b,c=MM_swapImage.arguments;document.MM_sr=new Array;for(e=0;e<(c.length-2);e+=3){if((b=MM_findObj(c[e]))!=null){document.MM_sr[d++]=b;if(!b.oSrc){b.oSrc=b.src}b.src=c[e+2]}}}var ie=(document.all)?true:false;function hideID(a){var b=(ie)?document.all(a):document.getElementById(a);b.style.display="none"}function showID(a){var b=(ie)?document.all(a):document.getElementById(a);b.style.display="block"}function xpathParse(n){if(xpathdebug){Log.write("XPath parse "+n)}xpathParseInit();var a=xpathCacheLookup(n);if(a){if(xpathdebug){Log.write(" ... cached")}return a}if(n.match(/^(\$|@)?\w+$/i)){var j=makeSimpleExpr(n);xpathParseCache[n]=j;if(xpathdebug){Log.write(" ... simple")}return j}if(n.match(/^\w+(\/\w+)*$/i)){var j=makeSimpleExpr2(n);xpathParseCache[n]=j;if(xpathdebug){Log.write(" ... simple 2")}return j}var k=n;if(xpathdebug){Timer.start("XPath parse",k)}var m=[];var b=null;var g=null;var c=false;var h=0;var f=0;var p=0;while(!c){h++;n=n.replace(/^\s*/,"");g=b;b=null;var l=null;var e="";for(var d=0;d<xpathTokenRules.length;++d){var o=xpathTokenRules[d].re.exec(n);f++;if(o&&o.length>0&&o[0].length>e.length){l=xpathTokenRules[d];e=o[0];break}}if(l&&(l==TOK_DIV||l==TOK_MOD||l==TOK_AND||l==TOK_OR)&&(!g||g.tag==TOK_AT||g.tag==TOK_DSLASH||g.tag==TOK_SLASH||g.tag==TOK_AXIS||g.tag==TOK_DOLLAR)){l=TOK_QNAME}if(l){n=n.substr(e.length);if(xpathdebug){Log.write("token: "+e+" -- "+l.label)}b={tag:l,match:e,prec:l.prec?l.prec:0,expr:makeTokenExpr(e)}}else{if(xpathdebug){Log.write("DONE")}c=true}while(xpathReduce(m,b)){p++;if(xpathdebug){Log.write("stack: "+stackToString(m))}}}if(xpathdebug){Log.write(stackToString(m))}if(m.length!=1){throw"XPath parse error "+k+":\n"+stackToString(m)}var o=m[0].expr;xpathParseCache[k]=o;if(xpathdebug){Timer.end("XPath parse",k)}if(xpathdebug){Log.write("XPath parse: "+h+" / "+f+" / "+p)}return o}var xpathParseCache={};function xpathCacheLookup(a){return xpathParseCache[a]}function xpathReduce(h,a){var e=null;if(h.length>0){var f=h[h.length-1];var j=xpathRules[f.tag.key];if(j){for(var b=0;b<j.length;++b){var g=j[b];var c=xpathMatchStack(h,g[1]);if(c.length){e={tag:g[0],rule:g,match:c};e.prec=xpathGrammarPrecedence(e);break}}}}var d;if(e&&(!a||e.prec>a.prec||(a.tag.left&&e.prec>=a.prec))){for(var b=0;b<e.match.matchlength;++b){h.pop()}if(xpathdebug){Log.write("reduce "+e.tag.label+" "+e.prec+" ahead "+(a?a.tag.label+" "+a.prec+(a.tag.left?" left":""):" none "))}var k=mapExpr(e.match,function(i){return i.expr});e.expr=e.rule[3].apply(null,k);h.push(e);d=true}else{if(a){if(xpathdebug){Log.write("shift "+a.tag.label+" "+a.prec+(a.tag.left?" left":"")+" over "+(e?e.tag.label+" "+e.prec:" none"))}h.push(a)}d=false}return d}function xpathMatchStack(h,g){var d=h.length;var f=g.length;var b,i;var e=[];e.matchlength=0;var c=0;for(b=f-1,i=d-1;b>=0&&i>=0;--b,i-=c){c=0;var a=[];if(g[b]==Q_MM){b-=1;e.push(a);while(i-c>=0&&h[i-c].tag==g[b]){a.push(h[i-c]);c+=1;e.matchlength+=1}}else{if(g[b]==Q_01){b-=1;e.push(a);while(i-c>=0&&c<2&&h[i-c].tag==g[b]){a.push(h[i-c]);c+=1;e.matchlength+=1}}else{if(g[b]==Q_1M){b-=1;e.push(a);if(h[i].tag==g[b]){while(i-c>=0&&h[i-c].tag==g[b]){a.push(h[i-c]);c+=1;e.matchlength+=1}}else{return[]}}else{if(h[i].tag==g[b]){e.push(h[i]);c+=1;e.matchlength+=1}else{return[]}}}}reverseInplace(a);a.expr=mapExpr(a,function(j){return j.expr})}reverseInplace(e);if(b==-1){return e}else{return[]}}function xpathTokenPrecedence(a){return a.prec||2}function xpathGrammarPrecedence(e){var b=0;if(e.rule){if(e.rule.length>=3&&e.rule[2]>=0){b=e.rule[2]}else{for(var c=0;c<e.rule[1].length;++c){var d=xpathTokenPrecedence(e.rule[1][c]);b=Math.max(b,d)}}}else{if(e.tag){b=xpathTokenPrecedence(e.tag)}else{if(e.length){for(var a=0;a<e.length;++a){var d=xpathGrammarPrecedence(e[a]);b=Math.max(b,d)}}}}return b}function stackToString(a){var b="";for(var c=0;c<a.length;++c){if(b){b+="\n"}b+=a[c].tag.label}return b}function ExprContext(d,a,c,b){this.node=d;this.position=a||0;this.nodelist=c||[d];this.variables={};this.parent=b||null;this.root=b?b.root:d.ownerDocument}ExprContext.prototype.clone=function(c,a,b){return new ExprContext(c||this.node,typeof a!="undefined"?a:this.position,b||this.nodelist,this)};ExprContext.prototype.setVariable=function(a,b){this.variables[a]=b};ExprContext.prototype.getVariable=function(a){if(typeof this.variables[a]!="undefined"){return this.variables[a]}else{if(this.parent){return this.parent.getVariable(a)}else{return null}}};ExprContext.prototype.setNode=function(b,a){this.node=b;this.position=a};function StringValue(a){this.value=a;this.type="string"}StringValue.prototype.stringValue=function(){return this.value};StringValue.prototype.booleanValue=function(){return this.value.length>0};StringValue.prototype.numberValue=function(){return this.value-0};StringValue.prototype.nodeSetValue=function(){throw this+" "+Error().stack};function BooleanValue(a){this.value=a;this.type="boolean"}BooleanValue.prototype.stringValue=function(){return""+this.value};BooleanValue.prototype.booleanValue=function(){return this.value};BooleanValue.prototype.numberValue=function(){return this.value?1:0};BooleanValue.prototype.nodeSetValue=function(){throw this+" "+Error().stack};function NumberValue(a){this.value=a;this.type="number"}NumberValue.prototype.stringValue=function(){return""+this.value};NumberValue.prototype.booleanValue=function(){return !!this.value};NumberValue.prototype.numberValue=function(){return this.value-0};NumberValue.prototype.nodeSetValue=function(){throw this+" "+Error().stack};function NodeSetValue(a){this.value=a;this.type="node-set"}NodeSetValue.prototype.stringValue=function(){if(this.value.length==0){return""}else{return xmlValue(this.value[0])}};NodeSetValue.prototype.booleanValue=function(){return this.value.length>0};NodeSetValue.prototype.numberValue=function(){return this.stringValue()-0};NodeSetValue.prototype.nodeSetValue=function(){return this.value};function TokenExpr(a){this.value=a}TokenExpr.prototype.evaluate=function(){return new StringValue(this.value)};function LocationExpr(){this.absolute=false;this.steps=[]}LocationExpr.prototype.appendStep=function(a){this.steps.push(a)};LocationExpr.prototype.prependStep=function(c){var a=this.steps;this.steps=[c];for(var b=0;b<a.length;++b){this.steps.push(a[b])}};LocationExpr.prototype.evaluate=function(a){var c;if(this.absolute){c=a.root}else{c=a.node}var b=[];xPathStep(b,this.steps,0,c,a);return new NodeSetValue(b)};function xPathStep(a,e,b,f,h){var j=e[b];var d=h.clone(f);var g=j.evaluate(d).nodeSetValue();for(var c=0;c<g.length;++c){if(b==e.length-1){a.push(g[c])}else{xPathStep(a,e,b+1,g[c],h)}}}function StepExpr(b,c,a){this.axis=b;this.nodetest=c;this.predicate=a||[]}StepExpr.prototype.appendPredicate=function(a){this.predicate.push(a)};StepExpr.prototype.evaluate=function(a){var c=a.node;var f=[];if(this.axis==xpathAxis.ANCESTOR_OR_SELF){f.push(c);for(var h=c.parentNode;h;h=c.parentNode){f.push(h)}}else{if(this.axis==xpathAxis.ANCESTOR){for(var h=c.parentNode;h;h=c.parentNode){f.push(h)}}else{if(this.axis==xpathAxis.ATTRIBUTE){copyArray(f,c.attributes)}else{if(this.axis==xpathAxis.CHILD){copyArray(f,c.childNodes)}else{if(this.axis==xpathAxis.DESCENDANT_OR_SELF){f.push(c);xpathCollectDescendants(f,c)}else{if(this.axis==xpathAxis.DESCENDANT){xpathCollectDescendants(f,c)}else{if(this.axis==xpathAxis.FOLLOWING){for(var h=c.parentNode;h;h=h.parentNode){for(var g=h.nextSibling;g;g=g.nextSibling){f.push(g);xpathCollectDescendants(f,g)}}}else{if(this.axis==xpathAxis.FOLLOWING_SIBLING){for(var h=c.nextSibling;h;h=c.nextSibling){f.push(h)}}else{if(this.axis==xpathAxis.NAMESPACE){alert("not implemented: axis namespace")}else{if(this.axis==xpathAxis.PARENT){if(c.parentNode){f.push(c.parentNode)}}else{if(this.axis==xpathAxis.PRECEDING){for(var h=c.parentNode;h;h=h.parentNode){for(var g=h.previousSibling;g;g=g.previousSibling){f.push(g);xpathCollectDescendantsReverse(f,g)}}}else{if(this.axis==xpathAxis.PRECEDING_SIBLING){for(var h=c.previousSibling;h;h=c.previousSibling){f.push(h)}}else{if(this.axis==xpathAxis.SELF){f.push(c)}else{throw"ERROR -- NO SUCH AXIS: "+this.axis}}}}}}}}}}}}}var b=f;f=[];for(var d=0;d<b.length;++d){var h=b[d];if(this.nodetest.evaluate(a.clone(h,d,b)).booleanValue()){f.push(h)}}for(var d=0;d<this.predicate.length;++d){var b=f;f=[];for(var e=0;e<b.length;++e){var h=b[e];if(this.predicate[d].evaluate(a.clone(h,e,b)).booleanValue()){f.push(h)}}}return new NodeSetValue(f)};function NodeTestAny(){this.value=new BooleanValue(true)}NodeTestAny.prototype.evaluate=function(a){return this.value};function NodeTestElement(){}NodeTestElement.prototype.evaluate=function(a){return new BooleanValue(a.node.nodeType==DOM_ELEMENT_NODE)};function NodeTestText(){}NodeTestText.prototype.evaluate=function(a){return new BooleanValue(a.node.nodeType==DOM_TEXT_NODE)};function NodeTestComment(){}NodeTestComment.prototype.evaluate=function(a){return new BooleanValue(a.node.nodeType==DOM_COMMENT_NODE)};function NodeTestPI(a){this.target=a}NodeTestPI.prototype.evaluate=function(a){return new BooleanValue(a.node.nodeType==DOM_PROCESSING_INSTRUCTION_NODE&&(!this.target||a.node.nodeName==this.target))};function NodeTestNC(a){this.regex=new RegExp("^"+a+":");this.nsprefix=a}NodeTestNC.prototype.evaluate=function(a){var b=a.node;return new BooleanValue(this.regex.match(b.nodeName))};function NodeTestName(a){this.name=a}NodeTestName.prototype.evaluate=function(a){var b=a.node;return new BooleanValue(b.nodeName==this.name)};function PredicateExpr(a){this.expr=a}PredicateExpr.prototype.evaluate=function(a){var b=this.expr.evaluate(a);if(b.type=="number"){return new BooleanValue(a.position==b.numberValue()-1)}else{return new BooleanValue(b.booleanValue())}};function FunctionCallExpr(a){this.name=a;this.args=[]}FunctionCallExpr.prototype.appendArg=function(a){this.args.push(a)};FunctionCallExpr.prototype.evaluate=function(a){var b=""+this.name.value;var c=this.xpathfunctions[b];if(c){return c.call(this,a)}else{Log.write("XPath NO SUCH FUNCTION "+b);return new BooleanValue(false)}};FunctionCallExpr.prototype.xpathfunctions={last:function(a){assert(this.args.length==0);return new NumberValue(a.nodelist.length)},position:function(a){assert(this.args.length==0);return new NumberValue(a.position+1)},count:function(a){assert(this.args.length==1);var b=this.args[0].evaluate(a);return new NumberValue(b.nodeSetValue().length)},id:function(l){assert(this.args.length==1);var f=this.args.evaluate(l);var g=[];var a;if(f.type=="node-set"){a=[];for(var c=0;c<f.length;++c){var j=xmlValue(f[c]).split(/\s+/);for(var k=0;k<j.length;++k){a.push(j[k])}}}else{a=f.split(/\s+/)}var h=l.node.ownerDocument;for(var c=0;c<a.length;++c){var b=h.getElementById(a[c]);if(b){g.push(b)}}return new NodeSetValue(g)},"local-name":function(a){alert("not implmented yet: XPath function local-name()")},"namespace-uri":function(a){alert("not implmented yet: XPath function namespace-uri()")},name:function(a){assert(this.args.length==1||this.args.length==0);var b;if(this.args.length==0){b=[a.node]}else{b=this.args[0].evaluate(a).nodeSetValue()}if(b.length==0){return new StringValue("")}else{return new StringValue(b[0].nodeName)}},string:function(a){assert(this.args.length==1||this.args.length==0);if(this.args.length==0){return new StringValue(new NodeSetValue([a.node]).stringValue())}else{return new StringValue(this.args[0].evaluate(a).stringValue())}},concat:function(a){var b="";for(var c=0;c<this.args.length;++c){b+=this.args[c].evaluate(a).stringValue()}return new StringValue(b)},"starts-with":function(a){assert(this.args.length==2);var c=this.args[0].evaluate(a).stringValue();var b=this.args[1].evaluate(a).stringValue();return new BooleanValue(c.indexOf(b)==0)},contains:function(a){assert(this.args.length==2);var c=this.args[0].evaluate(a).stringValue();var b=this.args[1].evaluate(a).stringValue();return new BooleanValue(c.indexOf(b)!=-1)},"substring-before":function(a){assert(this.args.length==2);var e=this.args[0].evaluate(a).stringValue();var d=this.args[1].evaluate(a).stringValue();var c=e.indexOf(d);var b;if(c==-1){b=""}else{b=e.substr(0,c)}return new StringValue(b)},"substring-after":function(a){assert(this.args.length==2);var e=this.args[0].evaluate(a).stringValue();var d=this.args[1].evaluate(a).stringValue();var c=e.indexOf(d);var b;if(c==-1){b=""}else{b=e.substr(c+d.length)}return new StringValue(b)},substring:function(a){assert(this.args.length==2||this.args.length==3);var f=this.args[0].evaluate(a).stringValue();var d=this.args[1].evaluate(a).numberValue();var c;if(this.args.length==2){var g=Math.max(0,Math.round(d)-1);c=f.substr(g)}else{var b=this.args[2].evaluate(a).numberValue();var h=Math.round(d)-1;var g=Math.max(0,h);var e=Math.round(b)-Math.max(0,-h);c=f.substr(g,e)}return new StringValue(c)},"string-length":function(a){var b;if(this.args.length>0){b=this.args[0].evaluate(a).stringValue()}else{b=new NodeSetValue([a.node]).stringValue()}return new NumberValue(b.length)},"normalize-space":function(a){var b;if(this.args.length>0){b=this.args[0].evaluate(a).stringValue()}else{b=new NodeSetValue([a.node]).stringValue()}b=b.replace(/^\s*/,"").replace(/\s*$/,"").replace(/\s+/g," ");return new StringValue(b)},translate:function(a){assert(this.args.length==3);var e=this.args[0].evaluate(a).stringValue();var d=this.args[1].evaluate(a).stringValue();var b=this.args[2].evaluate(a).stringValue();for(var c=0;c<d.length;++c){e=e.replace(new RegExp(d.charAt(c),"g"),b.charAt(c))}return new StringValue(e)},"boolean":function(a){assert(this.args.length==1);return new BooleanValue(this.args[0].evaluate(a).booleanValue())},not:function(a){assert(this.args.length==1);var b=!this.args[0].evaluate(a).booleanValue();return new BooleanValue(b)},"true":function(a){assert(this.args.length==0);return new BooleanValue(true)},"false":function(a){assert(this.args.length==0);return new BooleanValue(false)},lang:function(a){assert(this.args.length==1);var c=this.args[0].evaluate(a).stringValue();var e;var d=a.node;while(d&&d!=d.parentNode){e=d.getAttribute("xml:lang");if(e){break}d=d.parentNode}if(!e){return new BooleanValue(false)}else{var b=new RegExp("^"+c+"$","i");return new BooleanValue(e.match(b)||e.replace(/_.*$/,"").match(b))}},number:function(a){assert(this.args.length==1||this.args.length==0);if(this.args.length==1){return new NumberValue(this.args[0].evaluate(a).numberValue())}else{return new NumberValue(new NodeSetValue([a.node]).numberValue())}},sum:function(a){assert(this.args.length==1);var d=this.args[0].evaluate(a).nodeSetValue();var c=0;for(var b=0;b<d.length;++b){c+=xmlValue(d[b])-0}return new NumberValue(c)},floor:function(a){assert(this.args.length==1);var b=this.args[0].evaluate(a).numberValue();return new NumberValue(Math.floor(b))},ceiling:function(a){assert(this.args.length==1);var b=this.args[0].evaluate(a).numberValue();return new NumberValue(Math.ceil(b))},round:function(a){assert(this.args.length==1);var b=this.args[0].evaluate(a).numberValue();return new NumberValue(Math.round(b))},"ext-join":function(a){assert(this.args.length==2);var b=this.args[0].evaluate(a).nodeSetValue();var e=this.args[1].evaluate(a).stringValue();var c="";for(var d=0;d<b.length;++d){if(c){c+=e}c+=xmlValue(b[d])}return new StringValue(c)},"ext-if":function(a){assert(this.args.length==3);if(this.args[0].evaluate(a).booleanValue()){return this.args[1].evaluate(a)}else{return this.args[2].evaluate(a)}},"ext-sprintf":function(a){assert(this.args.length>=1);var b=[];for(var c=0;c<this.args.length;++c){b.push(this.args[c].evaluate(a).stringValue())}return new StringValue(sprintf.apply(null,b))},"ext-cardinal":function(a){assert(this.args.length>=1);var e=this.args[0].evaluate(a).numberValue();var b=[];for(var d=0;d<e;++d){b.push(a.node)}return new NodeSetValue(b)}};function UnionExpr(b,a){this.expr1=b;this.expr2=a}UnionExpr.prototype.evaluate=function(c){var b=this.expr1.evaluate(c).nodeSetValue();var a=this.expr2.evaluate(c).nodeSetValue();var f=b.length;for(var d=0;d<a.length;++d){for(var e=0;e<f;++e){if(b[e]==a[d]){e=f}}b.push(a[d])}return new NodeSetValue(a)};function PathExpr(b,a){this.filter=b;this.rel=a}PathExpr.prototype.evaluate=function(b){var d=this.filter.evaluate(b).nodeSetValue();var a=[];for(var e=0;e<d.length;++e){var c=this.rel.evaluate(b.clone(d[e],e,d)).nodeSetValue();for(var f=0;f<c.length;++f){a.push(c[f])}}return new NodeSetValue(a)};function FilterExpr(b,a){this.expr=b;this.predicate=a}FilterExpr.prototype.evaluate=function(a){var c=this.expr.evaluate(a).nodeSetValue();for(var e=0;e<this.predicate.length;++e){var b=c;c=[];for(var d=0;d<b.length;++d){var f=b[d];if(this.predicate[e].evaluate(a.clone(f,d,b)).booleanValue()){c.push(f)}}}return new NodeSetValue(c)};function UnaryMinusExpr(a){this.expr=a}UnaryMinusExpr.prototype.evaluate=function(a){return new NumberValue(-this.expr.evaluate(a).numberValue())};function BinaryExpr(b,c,a){this.expr1=b;this.expr2=a;this.op=c}BinaryExpr.prototype.evaluate=function(a){var b;switch(this.op.value){case"or":b=new BooleanValue(this.expr1.evaluate(a).booleanValue()||this.expr2.evaluate(a).booleanValue());break;case"and":b=new BooleanValue(this.expr1.evaluate(a).booleanValue()&&this.expr2.evaluate(a).booleanValue());break;case"+":b=new NumberValue(this.expr1.evaluate(a).numberValue()+this.expr2.evaluate(a).numberValue());break;case"-":b=new NumberValue(this.expr1.evaluate(a).numberValue()-this.expr2.evaluate(a).numberValue());break;case"*":b=new NumberValue(this.expr1.evaluate(a).numberValue()*this.expr2.evaluate(a).numberValue());break;case"mod":b=new NumberValue(this.expr1.evaluate(a).numberValue()%this.expr2.evaluate(a).numberValue());break;case"div":b=new NumberValue(this.expr1.evaluate(a).numberValue()/this.expr2.evaluate(a).numberValue());break;case"=":b=this.compare(a,function(d,c){return d==c});break;case"!=":b=this.compare(a,function(d,c){return d!=c});break;case"<":b=this.compare(a,function(d,c){return d<c});break;case"<=":b=this.compare(a,function(d,c){return d<=c});break;case">":b=this.compare(a,function(d,c){return d>c});break;case">=":b=this.compare(a,function(d,c){return d>=c});break;default:alert("BinaryExpr.evaluate: "+this.op.value)}return b};BinaryExpr.prototype.compare=function(m,h){var k=this.expr1.evaluate(m);var j=this.expr2.evaluate(m);var g;if(k.type=="node-set"&&j.type=="node-set"){var f=k.nodeSetValue();var e=j.nodeSetValue();g=false;for(var c=0;c<f.length;++c){for(var b=0;b<e.length;++b){if(h(xmlValue(f[c]),xmlValue(e[b]))){g=true;b=e.length;c=f.length}}}}else{if(k.type=="node-set"||j.type=="node-set"){if(k.type=="number"){var o=k.numberValue();var a=j.nodeSetValue();g=false;for(var d=0;d<a.length;++d){var l=xmlValue(a[d])-0;if(h(o,l)){g=true;break}}}else{if(j.type=="number"){var a=k.nodeSetValue();var o=j.numberValue();g=false;for(var d=0;d<a.length;++d){var l=xmlValue(a[d])-0;if(h(l,o)){g=true;break}}}else{if(k.type=="string"){var o=k.stringValue();var a=j.nodeSetValue();g=false;for(var d=0;d<a.length;++d){var l=xmlValue(a[d]);if(h(o,l)){g=true;break}}}else{if(j.type=="string"){var a=k.nodeSetValue();var o=j.stringValue();g=false;for(var d=0;d<a.length;++d){var l=xmlValue(a[d]);if(h(l,o)){g=true;break}}}else{g=h(k.booleanValue(),j.booleanValue())}}}}}else{if(k.type=="boolean"||j.type=="boolean"){g=h(k.booleanValue(),j.booleanValue())}else{if(k.type=="number"||j.type=="number"){g=h(k.numberValue(),j.numberValue())}else{g=h(k.stringValue(),j.stringValue())}}}}return new BooleanValue(g)};function LiteralExpr(a){this.value=a}LiteralExpr.prototype.evaluate=function(a){return new StringValue(this.value)};function NumberExpr(a){this.value=a}NumberExpr.prototype.evaluate=function(a){return new NumberValue(this.value)};function VariableExpr(a){this.name=a}VariableExpr.prototype.evaluate=function(a){return a.getVariable(this.name)};function makeTokenExpr(a){return new TokenExpr(a)}function passExpr(a){return a}function makeLocationExpr1(b,a){a.absolute=true;return a}function makeLocationExpr2(b,a){a.absolute=true;a.prependStep(makeAbbrevStep(b.value));return a}function makeLocationExpr3(b){var a=new LocationExpr();a.appendStep(makeAbbrevStep("."));a.absolute=true;return a}function makeLocationExpr4(b){var a=new LocationExpr();a.absolute=true;a.appendStep(makeAbbrevStep(b.value));return a}function makeLocationExpr5(b){var a=new LocationExpr();a.appendStep(b);return a}function makeLocationExpr6(a,b,c){a.appendStep(c);return a}function makeLocationExpr7(a,b,c){a.appendStep(makeAbbrevStep(b.value));return a}function makeStepExpr1(a){return makeAbbrevStep(a.value)}function makeStepExpr2(a){return makeAbbrevStep(a.value)}function makeStepExpr3(a,b,c){return new StepExpr(a.value,c)}function makeStepExpr4(a,b){return new StepExpr("attribute",b)}function makeStepExpr5(a){return new StepExpr("child",a)}function makeStepExpr6(b,a){b.appendPredicate(a);return b}function makeAbbrevStep(a){switch(a){case"//":return new StepExpr("descendant-or-self",new NodeTestAny);case".":return new StepExpr("self",new NodeTestAny);case"..":return new StepExpr("parent",new NodeTestAny)}}function makeNodeTestExpr1(a){return new NodeTestElement}function makeNodeTestExpr2(a,b,c){return new NodeTestNC(a.value)}function makeNodeTestExpr3(a){return new NodeTestName(a.value)}function makeNodeTestExpr4(c,a){var b=c.value.replace(/\s*\($/,"");switch(b){case"node":return new NodeTestAny;case"text":return new NodeTestText;case"comment":return new NodeTestComment;case"processing-instruction":return new NodeTestPI}}function makeNodeTestExpr5(d,c,a){var b=d.replace(/\s*\($/,"");if(b!="processing-instruction"){throw b+" "+Error().stack}return new NodeTestPI(c.value)}function makePredicateExpr(c,b,a){return new PredicateExpr(b)}function makePrimaryExpr(c,b,a){return b}function makeFunctionCallExpr1(b,c,a){return new FunctionCallExpr(b)}function makeFunctionCallExpr2(e,g,d,c,a){var b=new FunctionCallExpr(e);b.appendArg(d);for(var f=0;f<c.length;++f){b.appendArg(c[f])}return b}function makeArgumentExpr(a,b){return b}function makeUnionExpr(c,a,b){return new UnionExpr(c,b)}function makePathExpr1(c,b,a){return new PathExpr(c,a)}function makePathExpr2(c,b,a){a.prependStep(makeAbbrevStep(b.value));return new PathExpr(c,a)}function makeFilterExpr(b,a){if(a.length>0){return new FilterExpr(b,a)}else{return b}}function makeUnaryMinusExpr(a,b){return new UnaryMinusExpr(b)}function makeBinaryExpr(b,c,a){return new BinaryExpr(b,c,a)}function makeLiteralExpr(a){var b=a.value.substring(1,a.value.length-1);return new LiteralExpr(b)}function makeNumberExpr(a){return new NumberExpr(a.value)}function makeVariableReference(a,b){return new VariableExpr(b.value)}function makeSimpleExpr(f){if(f.charAt(0)=="$"){return new VariableExpr(f.substr(1))}else{if(f.charAt(0)=="@"){var e=new NodeTestName(f.substr(1));var d=new StepExpr("attribute",e);var g=new LocationExpr();g.appendStep(d);return g}else{if(f.match(/^[0-9]+$/)){return new NumberExpr(f)}else{var e=new NodeTestName(f);var d=new StepExpr("child",e);var g=new LocationExpr();g.appendStep(d);return g}}}}function makeSimpleExpr2(h){var f=h.split("/");var j=new LocationExpr();for(var g=0;g<f.length;g++){var e=new NodeTestName(f[g]);var d=new StepExpr("child",e);j.appendStep(d)}return j}var xpathAxis={ANCESTOR_OR_SELF:"ancestor-or-self",ANCESTOR:"ancestor",ATTRIBUTE:"attribute",CHILD:"child",DESCENDANT_OR_SELF:"descendant-or-self",DESCENDANT:"descendant",FOLLOWING_SIBLING:"following-sibling",FOLLOWING:"following",NAMESPACE:"namespace",PARENT:"parent",PRECEDING_SIBLING:"preceding-sibling",PRECEDING:"preceding",SELF:"self"};var xpathAxesRe=[xpathAxis.ANCESTOR_OR_SELF,xpathAxis.ANCESTOR,xpathAxis.ATTRIBUTE,xpathAxis.CHILD,xpathAxis.DESCENDANT_OR_SELF,xpathAxis.DESCENDANT,xpathAxis.FOLLOWING_SIBLING,xpathAxis.FOLLOWING,xpathAxis.NAMESPACE,xpathAxis.PARENT,xpathAxis.PRECEDING_SIBLING,xpathAxis.PRECEDING,xpathAxis.SELF].join("|");var TOK_PIPE={label:"|",prec:17,re:new RegExp("^\\|")};var TOK_DSLASH={label:"//",prec:19,re:new RegExp("^//")};var TOK_SLASH={label:"/",prec:30,re:new RegExp("^/")};var TOK_AXIS={label:"::",prec:20,re:new RegExp("^::")};var TOK_COLON={label:":",prec:1000,re:new RegExp("^:")};var TOK_AXISNAME={label:"[axis]",re:new RegExp("^("+xpathAxesRe+")")};var TOK_PARENO={label:"(",prec:34,re:new RegExp("^\\(")};var TOK_PARENC={label:")",re:new RegExp("^\\)")};var TOK_DDOT={label:"..",prec:34,re:new RegExp("^\\.\\.")};var TOK_DOT={label:".",prec:34,re:new RegExp("^\\.")};var TOK_AT={label:"@",prec:34,re:new RegExp("^@")};var TOK_COMMA={label:",",re:new RegExp("^,")};var TOK_OR={label:"or",prec:10,re:new RegExp("^or\\b")};var TOK_AND={label:"and",prec:11,re:new RegExp("^and\\b")};var TOK_EQ={label:"=",prec:12,re:new RegExp("^=")};var TOK_NEQ={label:"!=",prec:12,re:new RegExp("^!=")};var TOK_GE={label:">=",prec:13,re:new RegExp("^>=")};var TOK_GT={label:">",prec:13,re:new RegExp("^>")};var TOK_LE={label:"<=",prec:13,re:new RegExp("^<=")};var TOK_LT={label:"<",prec:13,re:new RegExp("^<")};var TOK_PLUS={label:"+",prec:14,re:new RegExp("^\\+"),left:true};var TOK_MINUS={label:"-",prec:14,re:new RegExp("^\\-"),left:true};var TOK_DIV={label:"div",prec:15,re:new RegExp("^div\\b"),left:true};var TOK_MOD={label:"mod",prec:15,re:new RegExp("^mod\\b"),left:true};var TOK_BRACKO={label:"[",prec:32,re:new RegExp("^\\[")};var TOK_BRACKC={label:"]",re:new RegExp("^\\]")};var TOK_DOLLAR={label:"$",re:new RegExp("^\\$")};var TOK_NCNAME={label:"[ncname]",re:new RegExp("^[a-z][-\\w]*","i")};var TOK_ASTERISK={label:"*",prec:15,re:new RegExp("^\\*"),left:true};var TOK_LITERALQ={label:"[litq]",prec:20,re:new RegExp("^'[^\\']*'")};var TOK_LITERALQQ={label:"[litqq]",prec:20,re:new RegExp('^"[^\\"]*"')};var TOK_NUMBER={label:"[number]",prec:35,re:new RegExp("^\\d+(\\.\\d*)?")};var TOK_QNAME={label:"[qname]",re:new RegExp("^([a-z][-\\w]*:)?[a-z][-\\w]*","i")};var TOK_NODEO={label:"[nodetest-start]",re:new RegExp("^(processing-instruction|comment|text|node)\\(")};var xpathTokenRules=[TOK_DSLASH,TOK_SLASH,TOK_DDOT,TOK_DOT,TOK_AXIS,TOK_COLON,TOK_AXISNAME,TOK_NODEO,TOK_PARENO,TOK_PARENC,TOK_BRACKO,TOK_BRACKC,TOK_AT,TOK_COMMA,TOK_OR,TOK_AND,TOK_NEQ,TOK_EQ,TOK_GE,TOK_GT,TOK_LE,TOK_LT,TOK_PLUS,TOK_MINUS,TOK_ASTERISK,TOK_PIPE,TOK_MOD,TOK_DIV,TOK_LITERALQ,TOK_LITERALQQ,TOK_NUMBER,TOK_QNAME,TOK_NCNAME,TOK_DOLLAR];var XPathLocationPath={label:"LocationPath"};var XPathRelativeLocationPath={label:"RelativeLocationPath"};var XPathAbsoluteLocationPath={label:"AbsoluteLocationPath"};var XPathStep={label:"Step"};var XPathNodeTest={label:"NodeTest"};var XPathPredicate={label:"Predicate"};var XPathLiteral={label:"Literal"};var XPathExpr={label:"Expr"};var XPathPrimaryExpr={label:"PrimaryExpr"};var XPathVariableReference={label:"Variablereference"};var XPathNumber={label:"Number"};var XPathFunctionCall={label:"FunctionCall"};var XPathArgumentRemainder={label:"ArgumentRemainder"};var XPathPathExpr={label:"PathExpr"};var XPathUnionExpr={label:"UnionExpr"};var XPathFilterExpr={label:"FilterExpr"};var XPathDigits={label:"Digits"};var xpathNonTerminals=[XPathLocationPath,XPathRelativeLocationPath,XPathAbsoluteLocationPath,XPathStep,XPathNodeTest,XPathPredicate,XPathLiteral,XPathExpr,XPathPrimaryExpr,XPathVariableReference,XPathNumber,XPathFunctionCall,XPathArgumentRemainder,XPathPathExpr,XPathUnionExpr,XPathFilterExpr,XPathDigits];var Q_01={label:"?"};var Q_MM={label:"*"};var Q_1M={label:"+"};var ASSOC_LEFT=true;var xpathGrammarRules=[[XPathLocationPath,[XPathRelativeLocationPath],18,passExpr],[XPathLocationPath,[XPathAbsoluteLocationPath],18,passExpr],[XPathAbsoluteLocationPath,[TOK_SLASH,XPathRelativeLocationPath],18,makeLocationExpr1],[XPathAbsoluteLocationPath,[TOK_DSLASH,XPathRelativeLocationPath],18,makeLocationExpr2],[XPathAbsoluteLocationPath,[TOK_SLASH],0,makeLocationExpr3],[XPathAbsoluteLocationPath,[TOK_DSLASH],0,makeLocationExpr4],[XPathRelativeLocationPath,[XPathStep],31,makeLocationExpr5],[XPathRelativeLocationPath,[XPathRelativeLocationPath,TOK_SLASH,XPathStep],31,makeLocationExpr6],[XPathRelativeLocationPath,[XPathRelativeLocationPath,TOK_DSLASH,XPathStep],31,makeLocationExpr7],[XPathStep,[TOK_DOT],33,makeStepExpr1],[XPathStep,[TOK_DDOT],33,makeStepExpr2],[XPathStep,[TOK_AXISNAME,TOK_AXIS,XPathNodeTest],33,makeStepExpr3],[XPathStep,[TOK_AT,XPathNodeTest],33,makeStepExpr4],[XPathStep,[XPathNodeTest],33,makeStepExpr5],[XPathStep,[XPathStep,XPathPredicate],33,makeStepExpr6],[XPathNodeTest,[TOK_ASTERISK],33,makeNodeTestExpr1],[XPathNodeTest,[TOK_NCNAME,TOK_COLON,TOK_ASTERISK],33,makeNodeTestExpr2],[XPathNodeTest,[TOK_QNAME],33,makeNodeTestExpr3],[XPathNodeTest,[TOK_NODEO,TOK_PARENC],33,makeNodeTestExpr4],[XPathNodeTest,[TOK_NODEO,XPathLiteral,TOK_PARENC],33,makeNodeTestExpr5],[XPathPredicate,[TOK_BRACKO,XPathExpr,TOK_BRACKC],33,makePredicateExpr],[XPathPrimaryExpr,[XPathVariableReference],33,passExpr],[XPathPrimaryExpr,[TOK_PARENO,XPathExpr,TOK_PARENC],33,makePrimaryExpr],[XPathPrimaryExpr,[XPathLiteral],30,passExpr],[XPathPrimaryExpr,[XPathNumber],30,passExpr],[XPathPrimaryExpr,[XPathFunctionCall],30,passExpr],[XPathFunctionCall,[TOK_QNAME,TOK_PARENO,TOK_PARENC],-1,makeFunctionCallExpr1],[XPathFunctionCall,[TOK_QNAME,TOK_PARENO,XPathExpr,XPathArgumentRemainder,Q_MM,TOK_PARENC],-1,makeFunctionCallExpr2],[XPathArgumentRemainder,[TOK_COMMA,XPathExpr],-1,makeArgumentExpr],[XPathUnionExpr,[XPathPathExpr],20,passExpr],[XPathUnionExpr,[XPathUnionExpr,TOK_PIPE,XPathPathExpr],20,makeUnionExpr],[XPathPathExpr,[XPathLocationPath],20,passExpr],[XPathPathExpr,[XPathFilterExpr],19,passExpr],[XPathPathExpr,[XPathFilterExpr,TOK_SLASH,XPathRelativeLocationPath],20,makePathExpr1],[XPathPathExpr,[XPathFilterExpr,TOK_DSLASH,XPathRelativeLocationPath],20,makePathExpr2],[XPathFilterExpr,[XPathPrimaryExpr,XPathPredicate,Q_MM],20,makeFilterExpr],[XPathExpr,[XPathPrimaryExpr],16,passExpr],[XPathExpr,[XPathUnionExpr],16,passExpr],[XPathExpr,[TOK_MINUS,XPathExpr],-1,makeUnaryMinusExpr],[XPathExpr,[XPathExpr,TOK_OR,XPathExpr],-1,makeBinaryExpr],[XPathExpr,[XPathExpr,TOK_AND,XPathExpr],-1,makeBinaryExpr],[XPathExpr,[XPathExpr,TOK_EQ,XPathExpr],-1,makeBinaryExpr],[XPathExpr,[XPathExpr,TOK_NEQ,XPathExpr],-1,makeBinaryExpr],[XPathExpr,[XPathExpr,TOK_LT,XPathExpr],-1,makeBinaryExpr],[XPathExpr,[XPathExpr,TOK_LE,XPathExpr],-1,makeBinaryExpr],[XPathExpr,[XPathExpr,TOK_GT,XPathExpr],-1,makeBinaryExpr],[XPathExpr,[XPathExpr,TOK_GE,XPathExpr],-1,makeBinaryExpr],[XPathExpr,[XPathExpr,TOK_PLUS,XPathExpr],-1,makeBinaryExpr,ASSOC_LEFT],[XPathExpr,[XPathExpr,TOK_MINUS,XPathExpr],-1,makeBinaryExpr,ASSOC_LEFT],[XPathExpr,[XPathExpr,TOK_ASTERISK,XPathExpr],-1,makeBinaryExpr,ASSOC_LEFT],[XPathExpr,[XPathExpr,TOK_DIV,XPathExpr],-1,makeBinaryExpr,ASSOC_LEFT],[XPathExpr,[XPathExpr,TOK_MOD,XPathExpr],-1,makeBinaryExpr,ASSOC_LEFT],[XPathLiteral,[TOK_LITERALQ],-1,makeLiteralExpr],[XPathLiteral,[TOK_LITERALQQ],-1,makeLiteralExpr],[XPathNumber,[TOK_NUMBER],-1,makeNumberExpr],[XPathVariableReference,[TOK_DOLLAR,TOK_QNAME],200,makeVariableReference]];var xpathRules=[];function xpathParseInit(){if(xpathRules.length){return}xpathGrammarRules.sort(function(i,h){var k=i[1].length;var j=h[1].length;if(k<j){return 1}else{if(k>j){return -1}else{return 0}}});var a=1;for(var c=0;c<xpathNonTerminals.length;++c){xpathNonTerminals[c].key=a++}for(c=0;c<xpathTokenRules.length;++c){xpathTokenRules[c].key=a++}if(xpathdebug){Log.write("XPath parse INIT: "+a+" rules")}function e(j,h,i){if(!j[h]){j[h]=[]}j[h].push(i)}for(c=0;c<xpathGrammarRules.length;++c){var g=xpathGrammarRules[c];var f=g[1];for(var b=f.length-1;b>=0;--b){if(f[b]==Q_1M){e(xpathRules,f[b-1].key,g);break}else{if(f[b]==Q_MM||f[b]==Q_01){e(xpathRules,f[b-1].key,g);--b}else{e(xpathRules,f[b].key,g);break}}}}if(xpathdebug){Log.write("XPath parse INIT: "+xpathRules.length+" rule bins")}var d=0;mapExec(xpathRules,function(h){if(h){d+=h.length}});if(xpathdebug){Log.write("XPath parse INIT: "+(d/xpathRules.length)+" average bin size")}}function xpathCollectDescendants(b,a){for(var c=a.firstChild;c;c=c.nextSibling){b.push(c);arguments.callee(b,c)}}function xpathCollectDescendantsReverse(b,a){for(var c=a.lastChild;c;c=c.previousSibling){b.push(c);arguments.callee(b,c)}}function xpathDomEval(c,b){var d=xpathParse(c);var a=d.evaluate(new ExprContext(b));return a}function xpathSort(h,f){if(f.length==0){return}var n=[];for(var g=0;g<h.nodelist.length;++g){var c=h.nodelist[g];var d={node:c,key:[]};var b=h.clone(c,0,[c]);for(var e=0;e<f.length;++e){var m=f[e];var l=m.expr.evaluate(b);var k;if(m.type=="text"){k=l.stringValue()}else{if(m.type=="number"){k=l.numberValue()}}d.key.push({value:k,order:m.order})}d.key.push({value:g,order:"ascending"});n.push(d)}n.sort(xpathSortByKey);var a=[];for(var g=0;g<n.length;++g){a.push(n[g].node)}h.nodelist=a;h.setNode(a[0],0)}function xpathSortByKey(d,c){for(var a=0;a<d.key.length;++a){var b=d.key[a].order=="descending"?-1:1;if(d.key[a].value>c.key[a].value){return +1*b}else{if(d.key[a].value<c.key[a].value){return -1*b}}}return 0}function el(a){return document.getElementById(a)}function px(a){return a+"px"}function stringSplit(e,g){var d=e.indexOf(g);if(d==-1){return[e]}var f=[];f.push(e.substr(0,d));while(d!=-1){var b=e.indexOf(g,d+1);if(b!=-1){f.push(e.substr(d+1,b-d-1))}else{f.push(e.substr(d+1))}d=b}return f}function xmlValue(c){if(!c){return""}var a="";if(c.nodeType==DOM_TEXT_NODE||c.nodeType==DOM_CDATA_SECTION_NODE||c.nodeType==DOM_ATTRIBUTE_NODE){a+=c.nodeValue}else{if(c.nodeType==DOM_ELEMENT_NODE||c.nodeType==DOM_DOCUMENT_NODE||c.nodeType==DOM_DOCUMENT_FRAGMENT_NODE){for(var b=0;b<c.childNodes.length;++b){a+=arguments.callee(c.childNodes[b])}}}return a}function xmlText(e){var c="";if(e.nodeType==DOM_TEXT_NODE){c+=xmlEscapeText(e.nodeValue)}else{if(e.nodeType==DOM_ELEMENT_NODE){c+="<"+e.nodeName;for(var d=0;d<e.attributes.length;++d){var b=e.attributes[d];if(b&&b.nodeName&&b.nodeValue){c+=" "+b.nodeName;c+='="'+xmlEscapeAttr(b.nodeValue)+'"'}}if(e.childNodes.length==0){c+="/>"}else{c+=">";for(var d=0;d<e.childNodes.length;++d){c+=arguments.callee(e.childNodes[d])}c+="</"+e.nodeName+">"}}else{if(e.nodeType==DOM_DOCUMENT_NODE||e.nodeType==DOM_DOCUMENT_FRAGMENT_NODE){for(var d=0;d<e.childNodes.length;++d){c+=arguments.callee(e.childNodes[d])}}}}return c}function mapExec(c,b){for(var a=0;a<c.length;++a){b(c[a])}}function mapExpr(d,c){var a=[];for(var b=0;b<d.length;++b){a.push(c(d[b]))}return a}function reverseInplace(d){for(var a=0;a<d.length/2;++a){var c=d[a];var b=d.length-a-1;d[a]=d[b];d[b]=c}}function copyArray(c,b){for(var a=0;a<b.length;++a){c.push(b[a])}}function assert(a){if(!a){throw"assertion failed"}}var DOM_ELEMENT_NODE=1;var DOM_ATTRIBUTE_NODE=2;var DOM_TEXT_NODE=3;var DOM_CDATA_SECTION_NODE=4;var DOM_ENTITY_REFERENCE_NODE=5;var DOM_ENTITY_NODE=6;var DOM_PROCESSING_INSTRUCTION_NODE=7;var DOM_COMMENT_NODE=8;var DOM_DOCUMENT_NODE=9;var DOM_DOCUMENT_TYPE_NODE=10;var DOM_DOCUMENT_FRAGMENT_NODE=11;var DOM_NOTATION_NODE=12;var xpathdebug=false;var xsltdebug=false;function xmlEscapeText(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xmlEscapeAttr(a){return xmlEscapeText(a).replace(/\"/g,"&quot;")}function xmlEscapeTags(a){return a.replace(/</g,"&lt;").replace(/>/g,"&gt;")}var logging__=true;function Log(){}Log.lines=[];Log.write=function(a){if(logging__){this.lines.push(xmlEscapeText(a));this.show()}};Log.writeXML=function(b){if(logging__){var d=b.replace(/</g,"\n<");var c=xmlEscapeText(d);var a=c.replace(/\s*\n(\s|\n)*/g,"<br/>");this.lines.push(a);this.show()}};Log.writeRaw=function(a){if(logging__){this.lines.push(a);this.show()}};Log.clear=function(){if(logging__){var a=this.div();a.innerHTML="";this.lines=[]}};Log.show=function(){var a=this.div();a.innerHTML+=this.lines.join("<br/>")+"<br/>";this.lines=[];a.scrollTop=a.scrollHeight};Log.div=function(){var a=document.getElementById("log");if(!a){a=document.createElement("div");a.id="log";a.style.position="absolute";a.style.right="5px";a.style.top="5px";a.style.width="250px";a.style.height="150px";a.style.overflow="auto";a.style.backgroundColor="#f0f0f0";a.style.border="1px solid gray";a.style.fontSize="10px";a.style.padding="5px";document.body.appendChild(a)}return a};function Timer(){}Timer.start=function(){};Timer.end=function(){};var Spry;if(!Spry){Spry={}}if(!Spry.Utils){Spry.Utils={}}Spry.Utils.msProgIDs=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];Spry.Utils.createXMLHttpRequest=function(){var a=null;try{if(window.XMLHttpRequest){a=new XMLHttpRequest()}else{if(window.ActiveXObject){while(!a&&Spry.Utils.msProgIDs.length){try{a=new ActiveXObject(Spry.Utils.msProgIDs[0])}catch(b){a=null}if(!a){Spry.Utils.msProgIDs.splice(0,1)}}}}}catch(b){a=null}if(!a){Spry.Debug.reportError("Failed to create an XMLHttpRequest object!")}return a};Spry.Utils.loadURL=function(i,b,c,h,f){var d=new Spry.Utils.loadURL.Request();d.method=i;d.url=b;d.async=c;d.successCallback=h;Spry.Utils.setOptions(d,f);try{d.xhRequest=Spry.Utils.createXMLHttpRequest();if(!d.xhRequest){return null}if(d.async){d.xhRequest.onreadystatechange=function(){Spry.Utils.loadURL.callback(d)}}d.xhRequest.open(d.method,d.url,d.async,d.username,d.password);if(d.headers){for(var a in d.headers){d.xhRequest.setRequestHeader(a,d.headers[a])}}d.xhRequest.send(d.postData);if(!d.async){Spry.Utils.loadURL.callback(d)}}catch(g){d=null;Spry.Debug.reportError("Exception caught while loading "+b+": "+g)}return d};Spry.Utils.loadURL.callback=function(a){if(!a||a.xhRequest.readyState!=4){return}if(a.successCallback&&(a.xhRequest.status==200||a.xhRequest.status==0)){a.successCallback(a)}else{if(a.errorCallback){a.errorCallback(a)}}};Spry.Utils.loadURL.Request=function(){var b=Spry.Utils.loadURL.Request.props;var c=b.length;for(var a=0;a<c;a++){this[b[a]]=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,c){if(!d){return}var b=Spry.Utils.loadURL.Request.props;var e=b.length;for(var a=0;a<e;a++){var f=b[a];if(d[f]!=undefined){this[f]=d[f];if(c){d[f]=undefined}}}};Spry.Utils.loadURL.Request.prototype.clone=function(){var b=Spry.Utils.loadURL.Request.props;var d=b.length;var c=new Spry.Utils.loadURL.Request;for(var a=0;a<d;a++){c[b[a]]=this[b[a]]}if(this.headers){c.headers={};Spry.Utils.setOptions(c.headers,this.headers)}return c};Spry.Utils.setInnerHTML=function(ele,str,preventScripts){if(!ele){return}ele=$(ele);var scriptExpr="<script[^>]*>(.|s|\n|\r)*?<\/script>";ele.innerHTML=str.replace(new RegExp(scriptExpr,"img"),"");if(preventScripts){return}var matches=str.match(new RegExp(scriptExpr,"img"));if(matches){var numMatches=matches.length;for(var i=0;i<numMatches;i++){var s=matches[i].replace(/<script[^>]*>[\s\r\n]*(<\!--)?|(-->)?[\s\r\n]*<\/script>/img,"");Spry.Utils.eval(s)}}};Spry.Utils.updateContent=function(d,b,a,c){var e=(c&&c.method)?c.method:"GET";Spry.Utils.loadURL(e,b,false,function(f){Spry.Utils.setInnerHTML(d,f.xhRequest.responseText);if(a){a(d,b)}},c)};Spry.Utils.addEventListener=function(c,b,d,a){try{c=$(c);if(c.addEventListener){c.addEventListener(b,d,a)}else{if(c.attachEvent){c.attachEvent("on"+b,d)}}}catch(f){}};Spry.Utils.removeEventListener=function(c,b,d,a){try{c=$(c);if(c.removeEventListener){c.removeEventListener(b,d,a)}else{if(c.detachEvent){c.detachEvent("on"+b,d)}}}catch(f){}};Spry.Utils.addLoadListener=function(a){if(typeof window.addEventListener!="undefined"){window.addEventListener("load",a,false)}else{if(typeof document.addEventListener!="undefined"){document.addEventListener("load",a,false)}else{if(typeof window.attachEvent!="undefined"){window.attachEvent("onload",a)}}}};Spry.Utils.eval=function(str){return eval(str)};Spry.Utils.escapeQuotesAndLineBreaks=function(a){if(a){a=a.replace(/\\/g,"\\\\");a=a.replace(/["']/g,"\\$&");a=a.replace(/\n/g,"\\n");a=a.replace(/\r/g,"\\r")}return a};Spry.Utils.encodeEntities=function(a){if(a&&a.search(/[&<>"]/)!=-1){a=a.replace(/&/g,"&amp;");a=a.replace(/</g,"&lt;");a=a.replace(/>/g,"&gt;");a=a.replace(/"/g,"&quot;")}return a};Spry.Utils.decodeEntities=function(b){var a=Spry.Utils.decodeEntities.div;if(!a){a=document.createElement("div");Spry.Utils.decodeEntities.div=a;if(!a){return b}}a.innerHTML=b;if(a.childNodes.length==1&&a.firstChild.nodeType==3&&a.firstChild.nextSibling==null){b=a.firstChild.data}else{b=b.replace(/&lt;/,"<");b=b.replace(/&gt;/,">");b=b.replace(/&quot;/,'"');b=b.replace(/&amp;/,"&")}return b};Spry.Utils.fixupIETagAttributes=function(h){var b="";var a=h.match(/^<[^\s>]+\s*/)[0];var e=h.match(/\s*\/?>$/)[0];var i=h.replace(/^<[^\s>]+\s*|\s*\/?>/g,"");b+=a;if(i){var g=0;var c=0;while(g<i.length){while(i.charAt(c)!="="&&c<i.length){++c}if(c>=i.length){b+=i.substring(g,c);break}++c;b+=i.substring(g,c);g=c;if(i.charAt(c)=='"'||i.charAt(c)=="'"){var f=c++;while(c<i.length){if(i.charAt(c)==i.charAt(f)){c++;break}else{if(i.charAt(c)=="\\"){c++}}c++}b+=i.substring(g,c);g=c}else{b+='"';var d=i.slice(c).search(/\s/);c=(d!=-1)?(c+d):i.length;b+=i.slice(g,c);b+='"';g=c}}}b+=e;return b};Spry.Utils.fixUpIEInnerHTML=function(f){var e="";var d=new RegExp("<\\!--|<\\!\\[CDATA\\[|<\\w+[^<>]*>|-->|\\]\\](>|&gt;)","g");var a=0;var b=0;while(f.length){var c=d.exec(f);if(!c||!c[0]){e+=f.substr(a,f.length-a);break}if(c.index!=a){e+=f.substr(a,c.index-a)}if(c[0]=="<!--"||c[0]=="<![CDATA["){++b;e+=c[0]}else{if(c[0]=="-->"||c[0]=="]]>"||(b&&c[0]=="]]&gt;")){--b;e+=c[0]}else{if(!b&&c[0].charAt(0)=="<"){e+=Spry.Utils.fixupIETagAttributes(c[0])}else{e+=c[0]}}}a=d.lastIndex}return e};Spry.Utils.stringToXMLDoc=function(f){var b=null;try{var a=new ActiveXObject("Microsoft.XMLDOM");a.async=false;a.loadXML(f);b=a}catch(c){try{var d=new DOMParser;b=d.parseFromString(f,"text/xml")}catch(c){Spry.Debug.reportError("Caught exception in Spry.Utils.stringToXMLDoc(): "+c+"\n");b=null}}return b};Spry.Utils.serializeObject=function(d){var f="";var c=true;if(d==null||d==undefined){return f+d}var e=typeof d;if(e=="number"||e=="boolean"){f+=d}else{if(e=="string"){f+='"'+Spry.Utils.escapeQuotesAndLineBreaks(d)+'"'}else{if(d.constructor==Array){f+="[";for(var a=0;a<d.length;a++){if(!c){f+=", "}f+=Spry.Utils.serializeObject(d[a]);c=false}f+="]"}else{if(e=="object"){f+="{";for(var b in d){if(!c){f+=", "}f+='"'+b+'": '+Spry.Utils.serializeObject(d[b]);c=false}f+="}"}}}}return f};Spry.Utils.getNodesByFunc=function(a,d){var f=new Array;var c=new Array;var b=a;while(b){if(d(b)){c.push(b)}if(b.hasChildNodes()){f.push(b);b=b.firstChild}else{if(b==a){b=null}else{try{b=b.nextSibling}catch(g){b=null}}}while(!b&&f.length>0){b=f.pop();if(b==a){b=null}else{try{b=b.nextSibling}catch(g){b=null}}}}if(f&&f.length>0){Spry.Debug.trace("-- WARNING: Spry.Utils.getNodesByFunc() failed to traverse all nodes!\n")}return c};Spry.Utils.addClassName=function(b,a){b=$(b);if(!b||!a||(b.className&&b.className.search(new RegExp("\\b"+a+"\\b"))!=-1)){return}b.className+=(b.className?" ":"")+a};Spry.Utils.removeClassName=function(b,a){b=$(b);if(!b||!a||(b.className&&b.className.search(new RegExp("\\b"+a+"\\b"))==-1)){return}b.className=b.className.replace(new RegExp("\\s*\\b"+a+"\\b","g"),"")};Spry.Utils.getFirstChildWithNodeName=function(a,c){var b=a.firstChild;while(b){if(b.nodeName==c){return b}b=b.nextSibling}return null};Spry.Utils.nodeContainsElementNode=function(a){if(a){a=a.firstChild;while(a){if(a.nodeType==1){return true}a=a.nextSibling}}return false};Spry.Utils.getNodeText=function(b){var a="";if(!b){return}try{var d=b.firstChild;while(d){try{if(d.nodeType==3){a+=Spry.Utils.encodeEntities(d.data)}else{if(d.nodeType==4){a+=d.data}}}catch(c){Spry.Debug.reportError("Spry.Utils.getNodeText() exception caught: "+c+"\n")}d=d.nextSibling}}catch(c){Spry.Debug.reportError("Spry.Utils.getNodeText() exception caught: "+c+"\n")}return a};Spry.Utils.CreateObjectForNode=function(d){if(!d){return null}var g=null;var c=0;var b=null;try{for(c=0;c<d.attributes.length;c++){b=d.attributes[c];if(b&&b.nodeType==2){if(!g){g=new Object();if(!g){Spry.Debug.reportError("Spry.Utils.CreateObjectForNode(): Object creation failed!");return null}}g["@"+b.name]=b.value}}}catch(f){Spry.Debug.reportError("Spry.Utils.CreateObjectForNode() caught exception while accessing attributes: "+f+"\n")}var j=d.firstChild;if(j&&!j.nextSibling&&j.nodeType!=1){if(!g){g=new Object();if(!g){Spry.Debug.reportError("Spry.Utils.CreateObjectForNode(): Object creation failed!");return null}}g[d.nodeName]=Spry.Utils.getNodeText(d)}while(j){if(j.nodeType==1){if(!Spry.Utils.nodeContainsElementNode(j)){var a=Spry.Utils.getNodeText(j);if(!g){g=new Object();if(!g){Spry.Debug.reportError("Spry.Utils.CreateObjectForNode(): Object creation failed!");return null}}g[j.nodeName]=a;try{var h=j.nodeName+"/@";for(c=0;c<j.attributes.length;c++){b=j.attributes[c];if(b&&b.nodeType==2){g[h+b.name]=b.value}}}catch(f){Spry.Debug.reportError("Spry.Utils.CreateObjectForNode() caught exception while accessing attributes: "+f+"\n")}}}j=j.nextSibling}return g};Spry.Utils.getRecordSetFromXMLDoc=function(m,l){if(!m||!l){return null}var j=new Object();j.xmlDoc=m;j.xmlPath=l;j.dataHash=new Object;j.data=new Array;j.getData=function(){return this.data};var k=new ExprContext(m);var b=xpathParse(l);var g=b.evaluate(k);var c=g.nodeSetValue();var a=true;if(c&&c.length>0){a=c[0].nodeType!=2}var f=0;for(var d=0;d<c.length;d++){var h=null;if(a){h=Spry.Utils.CreateObjectForNode(c[d])}else{h=new Object;h["@"+c[d].name]=c[d].value}if(h){h.ds_RowID=f++;j.dataHash[h.ds_RowID]=h;j.data.push(h)}}return j};Spry.Utils.setOptions=function(d,c,a){if(!c){return}for(var b in c){if(a&&c[b]==undefined){continue}d[b]=c[b]}};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(b,c,e){var d=null;if(!e){this.clearSelection()}else{for(var a=0;a<this.selectedElements.length;a++){d=this.selectedElements[a].element;if(d.element==b){if(d.className!=c){Spry.Utils.removeClassName(b,d.className);Spry.Utils.addClassName(b,c)}return}}}d=new Object;d.element=b;d.className=c;this.selectedElements.push(d);Spry.Utils.addClassName(b,c)};Spry.Utils.SelectionManager.SelectionGroup.prototype.unSelect=function(b){for(var a=0;a<this.selectedElements.length;a++){var c=this.selectedElements[a].element;if(c.element==b){Spry.Utils.removeClassName(c.element,c.className);return}}};Spry.Utils.SelectionManager.SelectionGroup.prototype.clearSelection=function(){var a=null;do{a=this.selectedElements.shift();if(a){Spry.Utils.removeClassName(a.element,a.className)}}while(a)};Spry.Utils.SelectionManager.getSelectionGroup=function(a){if(!a){return null}var b=Spry.Utils.SelectionManager.selectionGroups[a];if(!b){b=new Spry.Utils.SelectionManager.SelectionGroup();Spry.Utils.SelectionManager.selectionGroups[a]=b}return b};Spry.Utils.SelectionManager.select=function(a,b,c,e){var d=Spry.Utils.SelectionManager.getSelectionGroup(a);if(!d){return}d.select(b,c,e)};Spry.Utils.SelectionManager.unSelect=function(a,b){var c=Spry.Utils.SelectionManager.getSelectionGroup(a);if(!c){return}c.unSelect(b,className)};Spry.Utils.SelectionManager.clearSelection=function(a){var b=Spry.Utils.SelectionManager.getSelectionGroup(a);if(!b){return}b.clearSelection()};function $(){var c=new Array();for(var b=0;b<arguments.length;b++){var a=arguments[b];if(typeof a=="string"){a=document.getElementById(a)}if(arguments.length==1){return a}c.push(a)}return c}Spry.Utils.Notifier=function(){this.observers=[];this.suppressNotifications=0};Spry.Utils.Notifier.prototype.addObserver=function(b){if(!b){return}var a=this.observers.length;for(var c=0;c<a;c++){if(this.observers[c]==b){return}}this.observers[a]=b};Spry.Utils.Notifier.prototype.removeObserver=function(a){if(!a){return}for(var b=0;b<this.observers.length;b++){if(this.observers[b]==a){this.observers.splice(b,1);break}}};Spry.Utils.Notifier.prototype.notifyObservers=function(b,d){if(!b){return}if(!this.suppressNotifications){var a=this.observers.length;for(var c=0;c<a;c++){var e=this.observers[c];if(e){if(typeof e=="function"){e(b,this,d)}else{if(e[b]){e[b](this,d)}}}}}};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.createDebugWindow=function(){if(!Spry.Debug.enableTrace||Spry.Debug.debugWindow){return}try{Spry.Debug.debugWindow=document.createElement("div");var b=Spry.Debug.debugWindow;b.style.fontSize="12px";b.style.fontFamily="console";b.style.position="absolute";b.style.width="400px";b.style.height="300px";b.style.overflow="auto";b.style.border="solid 1px black";b.style.backgroundColor="white";b.style.color="black";b.style.bottom="0px";b.style.right="0px";b.setAttribute("id","SpryDebugWindow");document.body.appendChild(Spry.Debug.debugWindow)}catch(a){}};Spry.Debug.debugOut=function(c,a){if(!Spry.Debug.debugWindow){Spry.Debug.createDebugWindow();if(!Spry.Debug.debugWindow){return}}var b=document.createElement("div");if(a){b.style.backgroundColor=a}b.innerHTML=c;Spry.Debug.debugWindow.appendChild(b)};Spry.Debug.trace=function(a){Spry.Debug.debugOut(a)};Spry.Debug.reportError=function(a){Spry.Debug.debugOut(a,"red")};Spry.Data={};Spry.Data.regionsArray={};Spry.Data.initRegions=function(d){if(!d){d=document.body}var m=null;var g=Spry.Utils.getNodesByFunc(d,function(t){try{if(t.nodeType!=1){return false}var r="spry:region";var i=t.attributes.getNamedItem(r);if(!i){r="spry:detailregion";i=t.attributes.getNamedItem(r)}if(i){if(m){var s=t.parentNode;while(s){if(s==m){Spry.Debug.reportError("Found a nested "+r+" in the following markup. Nested regions are currently not supported.<br/><pre>"+Spry.Utils.encodeEntities(s.innerHTML)+"</pre>");return false}s=s.parentNode}}if(i.value){i=t.attributes.getNamedItem("id");if(!i||!i.value){t.setAttribute("id","spryregion"+(++Spry.Data.initRegions.nextUniqueRegionID))}m=t;return true}else{Spry.Debug.reportError(r+" attributes require one or more data set names as values!")}}}catch(u){}return false});var a,n,h;for(h=0;h<g.length;h++){var c=g[h];var j=false;a=c.attributes.getNamedItem("id").value;attr=c.attributes.getNamedItem("spry:region");if(!attr){attr=c.attributes.getNamedItem("spry:detailregion");j=true}if(!attr.value){Spry.Debug.reportError("spry:region and spry:detailregion attributes require one or more data set names as values!");continue}c.attributes.removeNamedItem(attr.nodeName);Spry.Utils.removeClassName(c,Spry.Data.Region.hiddenRegionClassName);n=Spry.Data.Region.strToDataSetsArray(attr.value);if(!n.length){Spry.Debug.reportError("spry:region or spry:detailregion attribute has no data set!");continue}var k=false;var p=false;var f="";var q=null;var b={};var e={};attr=c.attributes.getNamedItem("spry:readystate");if(attr&&attr.value){e.ready=attr.value}attr=c.attributes.getNamedItem("spry:errorstate");if(attr&&attr.value){e.error=attr.value}attr=c.attributes.getNamedItem("spry:loadingstate");if(attr&&attr.value){e.loading=attr.value}var l=Spry.Utils.getNodesByFunc(c,function(F){try{if(F.nodeType==1){var x=F.attributes;var u=Spry.Data.Region.PI.orderedInstructions.length;var s=null;var r=null;for(var H=0;H<u;H++){var G=Spry.Data.Region.PI.orderedInstructions[H];var E=x.getNamedItem(G);if(!E){continue}var D=Spry.Data.Region.PI.instructions[G];var z=(F==c)?true:D.childrenOnly;var C=D.getOpenTag(F,G);var w=D.getCloseTag(F,G);if(z){var A=document.createComment(C);var B=document.createComment(w);if(!s){F.insertBefore(A,F.firstChild)}else{F.insertBefore(A,s.nextSibling)}s=A;if(!r){F.appendChild(B)}else{F.insertBefore(B,r)}r=B}else{var y=F.parentNode;y.insertBefore(document.createComment(C),F);y.insertBefore(document.createComment(w),F.nextSibling)}if(G=="spry:state"){b[E.value]=true}F.removeAttribute(G)}if(Spry.Data.Region.enableBehaviorAttributes){var J=Spry.Data.Region.behaviorAttrs;for(var t in J){var v=x.getNamedItem(t);if(v){k=true;if(J[t].setup){J[t].setup(F,v.value)}}}}}}catch(I){}return false});f=c.innerHTML;if(window.ActiveXObject&&!Spry.Data.Region.disableIEInnerHTMLFixUp&&f.search(/=\{/)!=-1){if(Spry.Data.Region.debug){Spry.Debug.trace("<hr />Performing IE innerHTML fix up of Region: "+a+"<br /><br />"+Spry.Utils.encodeEntities(f))}f=Spry.Utils.fixUpIEInnerHTML(f)}if(Spry.Data.Region.debug){Spry.Debug.trace("<hr />Region template markup for '"+a+"':<br /><br />"+Spry.Utils.encodeEntities(f))}if(!p){c.innerHTML=""}var o=new Spry.Data.Region(c,a,j,f,n,b,e,k);Spry.Data.regionsArray[o.name]=o}Spry.Data.updateAllRegions()};Spry.Data.initRegions.nextUniqueRegionID=0;Spry.Data.updateRegion=function(b){if(!b||!Spry.Data.regionsArray||!Spry.Data.regionsArray[b]){return}try{Spry.Data.regionsArray[b].updateContent()}catch(a){Spry.Debug.reportError("Spry.Data.updateRegion("+b+") caught an exception: "+a+"\n")}};Spry.Data.getRegion=function(a){return Spry.Data.regionsArray[a]};Spry.Data.updateAllRegions=function(){if(!Spry.Data.regionsArray){return}for(var a in Spry.Data.regionsArray){Spry.Data.updateRegion(a)}};Spry.Data.DataSet=function(){Spry.Utils.Notifier.call(this);this.name="";this.internalID=Spry.Data.DataSet.nextDataSetID++;this.curRowID=0;this.data=null;this.unfilteredData=null;this.dataHash=null;this.columnTypes=new Object;this.filterFunc=null;this.filterDataFunc=null;this.distinctOnLoad=false;this.sortOnLoad=null;this.sortOrderOnLoad="ascending";this.keepSorted=false;this.dataWasLoaded=false;this.pendingRequest=null;this.lastSortColumns=[];this.lastSortOrder="";this.loadIntervalID=0};Spry.Data.DataSet.prototype=new Spry.Utils.Notifier();Spry.Data.DataSet.prototype.constructor=Spry.Data.DataSet;Spry.Data.DataSet.prototype.getData=function(a){return(a&&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.loadData=function(){var a=this;this.pendingRequest=new Object;this.dataWasLoaded=false;this.pendingRequest.timer=setTimeout(function(){a.pendingRequest=null;a.dataWasLoaded=true;if(a.filterDataFunc){a.filterData(a.filterDataFunc,true)}if(a.distinctOnLoad){a.distinct()}if(a.keepSorted&&a.getSortColumn()){a.sort(a.lastSortColumns,a.lastSortOrder)}else{if(a.sortOnLoad){a.sort(a.sortOnLoad,a.sortOrderOnLoad)}}if(a.filterFunc){a.filter(a.filterFunc,true)}a.notifyObservers("onDataChanged")},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(a){var b=this.getData(a);return b?b.length:0};Spry.Data.DataSet.prototype.getRowByID=function(a){if(!this.data){return null}return this.dataHash[a]};Spry.Data.DataSet.prototype.getRowByRowNumber=function(a,b){var c=this.getData(b);if(c&&a>=0&&a<c.length){return c[a]}return null};Spry.Data.DataSet.prototype.getCurrentRow=function(){return this.getRowByID(this.curRowID)};Spry.Data.DataSet.prototype.setCurrentRow=function(b){if(this.curRowID==b){return}var a={oldRowID:this.curRowID,newRowID:b};this.curRowID=b;this.notifyObservers("onCurrentRowChanged",a)};Spry.Data.DataSet.prototype.getRowNumber=function(c){if(c&&this.data&&this.data.length){var b=this.data.length;for(var a=0;a<b;a++){if(this.data[a]==c){return a}}}return 0};Spry.Data.DataSet.prototype.getCurrentRowNumber=function(){return this.getRowNumber(this.getCurrentRow())};Spry.Data.DataSet.prototype.setCurrentRowNumber=function(a){if(!this.data||a>=this.data.length){Spry.Debug.trace("Invalid row number: "+a+"\n");return}var b=this.data[a]["ds_RowID"];if(b==undefined||this.curRowID==b){return}this.setCurrentRow(b)};Spry.Data.DataSet.prototype.findRowsWithColumnValues=function(f,a,c){var d=[];var k=this.getData(c);if(k){var g=k.length;for(var e=0;e<g;e++){var j=k[e];var b=true;for(var h in f){if(f[h]!=j[h]){b=false;break}}if(b){if(a){return j}d.push(j)}}}return a?null:d};Spry.Data.DataSet.prototype.setColumnType=function(a,b){if(a){this.columnTypes[a]=b}};Spry.Data.DataSet.prototype.getColumnType=function(a){if(this.columnTypes[a]){return this.columnTypes[a]}return"string"};Spry.Data.DataSet.prototype.distinct=function(){if(this.data){var e=this.data;this.data=[];this.dataHash={};var a={};var b=0;for(var b=0;b<e.length;b++){var d=e[b];var f="";for(var c in d){if(c!="ds_RowID"){if(f){f+=","}f+=c+':"'+d[c]+'"'}}if(!a[f]){this.data.push(d);this.dataHash[d.ds_RowID]=d;a[f]=true}}}};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(f,e){if(!f){return}if(typeof f=="string"){f=[f,"ds_RowID"]}else{if(f.length<2&&f[0]!="ds_RowID"){f.push("ds_RowID")}}if(!e){e="toggle"}if(e=="toggle"){if(this.lastSortColumns.length>0&&this.lastSortColumns[0]==f[0]&&this.lastSortOrder=="ascending"){e="descending"}else{e="ascending"}}if(e!="ascending"&&e!="descending"){Spry.Debug.reportError("Invalid sort order type specified: "+e+"\n");return}var d={oldSortColumns:this.lastSortColumns,oldSortOrder:this.lastSortOrder,newSortColumns:f,newSortOrder:e};this.notifyObservers("onPreSort",d);var b=f[f.length-1];var a=Spry.Data.DataSet.prototype.sort.getSortFunc(b,this.getColumnType(b),e);for(var c=f.length-2;c>=0;c--){b=f[c];a=Spry.Data.DataSet.prototype.sort.buildSecondarySortFunc(Spry.Data.DataSet.prototype.sort.getSortFunc(b,this.getColumnType(b),e),a)}if(this.unfilteredData){this.unfilteredData.sort(a);if(this.filterFunc){this.filter(this.filterFunc,true)}}else{this.data.sort(a)}this.lastSortColumns=f.slice(0);this.lastSortOrder=e;this.notifyObservers("onPostSort",d)};Spry.Data.DataSet.prototype.sort.getSortFunc=function(d,c,a){var b=null;if(c=="number"){if(a=="ascending"){b=function(f,e){return f[d]-e[d]}}else{b=function(f,e){return e[d]-f[d]}}}else{if(c=="date"){if(a=="ascending"){b=function(g,e){var h=g[d];var f=e[d];h=h?(new Date(h)):0;f=f?(new Date(f)):0;return h-f}}else{b=function(g,e){var h=g[d];var f=e[d];h=h?(new Date(h)):0;f=f?(new Date(f)):0;return f-h}}}else{if(a=="ascending"){b=function(l,k){var o=l[d].toString();var m=k[d].toString();var e=o.toLowerCase();var f=m.toLowerCase();var h=o.length>m.length?m.length:o.length;for(var g=0;g<h;g++){var p=e.charAt(g);var n=f.charAt(g);var j=o.charAt(g);var q=m.charAt(g);if(p>n){return 1}else{if(p<n){return -1}else{if(j>q){return 1}else{if(j<q){return -1}}}}}if(o.length==m.length){return 0}else{if(o.length>m.length){return 1}else{return -1}}}}else{b=function(l,k){var o=l[d].toString();var m=k[d].toString();var e=o.toLowerCase();var f=m.toLowerCase();var h=o.length>m.length?m.length:o.length;for(var g=0;g<h;g++){var p=e.charAt(g);var n=f.charAt(g);var j=o.charAt(g);var q=m.charAt(g);if(p>n){return -1}else{if(p<n){return 1}else{if(j>q){return -1}else{if(j<q){return 1}}}}}if(o.length==m.length){return 0}else{if(o.length>m.length){return -1}else{return 1}}}}}}return b};Spry.Data.DataSet.prototype.sort.buildSecondarySortFunc=function(b,a){return function(d,c){var e=b(d,c);if(e==0){e=a(d,c)}return e}};Spry.Data.DataSet.prototype.filterData=function(e,c){var d=false;if(!e){this.filterDataFunc=null;d=true}else{this.filterDataFunc=e;if(this.dataWasLoaded&&((this.unfilteredData&&this.unfilteredData.length)||(this.data&&this.data.length))){if(this.unfilteredData){this.data=this.unfilteredData;this.unfilteredData=null}var f=this.data;this.data=[];this.dataHash={};for(var b=0;b<f.length;b++){var a=e(this,f[b],b);if(a){this.data.push(a);this.dataHash[a.ds_RowID]=a}}d=true}}if(d){if(!c){this.disableNotifications();if(this.filterFunc){this.filter(this.filterFunc,true)}this.enableNotifications()}this.notifyObservers("onDataChanged")}};Spry.Data.DataSet.prototype.filter=function(f,c){var e=false;if(!f){if(this.filterFunc&&this.unfilteredData){this.data=this.unfilteredData;this.unfilteredData=null;this.filterFunc=null;e=true}}else{this.filterFunc=f;if(this.dataWasLoaded&&(this.unfilteredData||(this.data&&this.data.length))){if(!this.unfilteredData){this.unfilteredData=this.data}var d=this.unfilteredData;this.data=[];for(var b=0;b<d.length;b++){var a=f(this,d[b],b);if(a){this.data.push(a)}}e=true}}if(e){this.notifyObservers("onDataChanged")}};Spry.Data.DataSet.prototype.startLoadInterval=function(b){this.stopLoadInterval();if(b>0){var a=this;this.loadInterval=b;this.loadIntervalID=setInterval(function(){a.loadData()},b)}};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.XMLDataSet=function(b,a,c){Spry.Data.DataSet.call(this);this.url=b;this.xpath=a;this.doc=null;this.dataSetsForDataRefStrings=new Array;this.hasDataRefStrings=false;this.useCache=true;this.requestInfo=new Spry.Utils.loadURL.Request();this.requestInfo.extractRequestOptions(c,true);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.Utils.setOptions(this,c,true);this.recalculateDataSetDependencies();if(this.loadInterval>0){this.startLoadInterval(this.loadInterval)}};Spry.Data.XMLDataSet.prototype=new Spry.Data.DataSet();Spry.Data.XMLDataSet.prototype.constructor=Spry.Data.XMLDataSet;Spry.Data.XMLDataSet.prototype.recalculateDataSetDependencies=function(){this.hasDataRefStrings=false;if(!this.url){return}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 regionStrs=[this.url,this.xpath,this.requestInfo.postData];var postData=this.requestInfo.postData;if(postData&&(typeof postData)=="string"){regionStrs.push(postData)}var dsCount=0;for(var n=0;n<regionStrs.length;n++){var tokens=Spry.Data.Region.getTokensFromStr(regionStrs[n]);for(i=0;tokens&&i<tokens.length;i++){if(tokens[i].search(/{[^}:]+::[^}]+}/)!=-1){var dsName=tokens[i].replace(/^\{|::.*\}/g,"");var ds=null;if(!this.dataSetsForDataRefStrings[dsName]){try{ds=eval(dsName)}catch(e){ds=null}if(dsName&&ds){this.dataSetsForDataRefStrings[dsName]=ds;this.dataSetsForDataRefStrings[dsCount++]=ds;this.hasDataRefStrings=true}}}}}for(i=0;i<this.dataSetsForDataRefStrings.length;i++){var ds=this.dataSetsForDataRefStrings[i];ds.addObserver(this)}};Spry.Data.XMLDataSet.prototype.attemptLoadData=function(){for(var a=0;a<this.dataSetsForDataRefStrings.length;a++){var b=this.dataSetsForDataRefStrings[a];if(b.getLoadDataRequestIsPending()||!b.getDataWasLoaded()){return}}this.loadData()};Spry.Data.XMLDataSet.prototype.onCurrentRowChanged=function(b,a){this.attemptLoadData()};Spry.Data.XMLDataSet.prototype.onPostSort=function(b,a){this.attemptLoadData()};Spry.Data.XMLDataSet.prototype.onDataChanged=function(b,a){this.attemptLoadData()};Spry.Data.XMLDataSet.prototype.loadData=function(){if(!this.url||!this.xpath){return}this.cancelLoadData();var c=this.url;var a=this.requestInfo.postData;if(this.hasDataRefStrings){var b=true;for(var d=0;d<this.dataSetsForDataRefStrings.length;d++){var f=this.dataSetsForDataRefStrings[d];if(f.getLoadDataRequestIsPending()){b=false}else{if(!f.getDataWasLoaded()){f.loadData();b=false}}}if(!b){return}c=Spry.Data.Region.processDataRefString(null,this.url,this.dataSetsForDataRefStrings);if(!c){return}if(a&&(typeof a)=="string"){a=Spry.Data.Region.processDataRefString(null,a,this.dataSetsForDataRefStrings)}}this.notifyObservers("onPreLoad");this.data=null;this.dataWasLoaded=false;this.unfilteredData=null;this.dataHash=null;this.curRowID=0;var e=this.requestInfo.clone();e.url=c;e.postData=a;this.pendingRequest=new Object;this.pendingRequest.data=Spry.Data.XMLDataSet.LoadManager.loadData(e,this,this.useCache)};Spry.Data.XMLDataSet.prototype.cancelLoadData=function(){if(this.pendingRequest){Spry.Data.XMLDataSet.LoadManager.cancelLoadData(this.pendingRequest.data,this);this.pendingRequest=null}};Spry.Data.XMLDataSet.prototype.getURL=function(){return this.url};Spry.Data.XMLDataSet.prototype.setURL=function(b,a){if(this.url==b){return}this.url=b;if(a){this.requestInfo.extractRequestOptions(a)}this.cancelLoadData();this.recalculateDataSetDependencies();this.dataWasLoaded=false};Spry.Data.XMLDataSet.prototype.getDocument=function(){return this.doc};Spry.Data.XMLDataSet.prototype.getXPath=function(){return this.xpath};Spry.Data.XMLDataSet.prototype.setXPath=function(a){if(this.xpath!=a){this.xpath=a;if(this.dataWasLoaded&&this.doc){this.setDataFromDoc(this.doc)}}};Spry.Data.XMLDataSet.prototype.setDataFromDoc=function(b){this.pendingRequest=null;var a=null;a=Spry.Utils.getRecordSetFromXMLDoc(b,Spry.Data.Region.processDataRefString(null,this.xpath,this.dataSetsForDataRefStrings));if(!a){Spry.Debug.reportError("Spry.Data.XMLDataSet.setDataFromDoc() failed to create dataSet '"+this.name+"'for '"+this.xpath+"' - "+this.url+"\n");return}this.doc=a.xmlDoc;this.data=a.data;this.dataHash=a.dataHash;this.dataWasLoaded=(this.doc!=null);if(this.filterDataFunc){this.filterData(this.filterDataFunc,true)}if(this.distinctOnLoad){this.distinct()}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}this.notifyObservers("onPostLoad");this.notifyObservers("onDataChanged")};Spry.Data.XMLDataSet.prototype.onRequestResponse=function(a,b){this.setDataFromDoc(a.doc)};Spry.Data.XMLDataSet.prototype.onRequestError=function(a,b){this.notifyObservers("onLoadError",b)};Spry.Data.XMLDataSet.LoadManager={};Spry.Data.XMLDataSet.LoadManager.cache=[];Spry.Data.XMLDataSet.LoadManager.CachedRequest=function(a){Spry.Utils.Notifier.call(this);this.reqInfo=a;this.doc=null;this.timer=null;this.state=Spry.Data.XMLDataSet.LoadManager.CachedRequest.NOT_LOADED};Spry.Data.XMLDataSet.LoadManager.CachedRequest.prototype=new Spry.Utils.Notifier();Spry.Data.XMLDataSet.LoadManager.CachedRequest.prototype.constructor=Spry.Data.XMLDataSet.LoadManager.CachedRequest;Spry.Data.XMLDataSet.LoadManager.CachedRequest.NOT_LOADED=1;Spry.Data.XMLDataSet.LoadManager.CachedRequest.LOAD_REQUESTED=2;Spry.Data.XMLDataSet.LoadManager.CachedRequest.LOAD_FAILED=3;Spry.Data.XMLDataSet.LoadManager.CachedRequest.LOAD_SUCCESSFUL=4;Spry.Data.XMLDataSet.LoadManager.CachedRequest.prototype.loadDataCallback=function(a){if(a.xhRequest.readyState!=4){return}var b=a.xhRequest.responseXML;if(a.xhRequest.status!=200){if(a.xhRequest.status==0){if(a.xhRequest.responseText&&(!b||!b.firstChild)){b=Spry.Utils.stringToXMLDoc(a.xhRequest.responseText)}}}if(!b||!b.firstChild||b.firstChild.nodeName=="parsererror"){this.state=Spry.Data.XMLDataSet.LoadManager.CachedRequest.LOAD_FAILED;this.notifyObservers("onRequestError",a);this.observers.length=0;return}this.doc=b;this.state=Spry.Data.XMLDataSet.LoadManager.CachedRequest.LOAD_SUCCESSFUL;this.notifyObservers("onRequestResponse",a);this.observers.length=0};Spry.Data.XMLDataSet.LoadManager.CachedRequest.prototype.loadData=function(){var a=this;this.cancelLoadData();this.doc=null;this.state=Spry.Data.XMLDataSet.LoadManager.CachedRequest.LOAD_REQUESTED;var b=this.reqInfo.clone();b.successCallback=function(c){a.loadDataCallback(c)};b.errorCallback=b.successCallback;this.timer=setTimeout(function(){a.timer=null;Spry.Utils.loadURL(b.method,b.url,b.async,b.successCallback,b)},0)};Spry.Data.XMLDataSet.LoadManager.CachedRequest.prototype.cancelLoadData=function(){if(this.state==Spry.Data.XMLDataSet.LoadManager.CachedRequest.LOAD_REQUESTED){if(this.timer){this.timer.clearTimeout();this.timer=null}this.doc=null;this.state=Spry.Data.XMLDataSet.LoadManager.CachedRequest.NOT_LOADED}};Spry.Data.XMLDataSet.LoadManager.getCacheKey=function(a){return a.method+"::"+a.url+"::"+a.postData+"::"+a.username};Spry.Data.XMLDataSet.LoadManager.loadData=function(c,d,b){if(!c){return null}var a=null;var e=null;if(b){e=Spry.Data.XMLDataSet.LoadManager.getCacheKey(c);a=Spry.Data.XMLDataSet.LoadManager.cache[e]}if(a){if(a.state==Spry.Data.XMLDataSet.LoadManager.CachedRequest.LOAD_REQUESTED){if(d){a.addObserver(d)}return a}else{if(a.state==Spry.Data.XMLDataSet.LoadManager.CachedRequest.LOAD_SUCCESSFUL){if(d){setTimeout(function(){d.setDataFromDoc(a.doc)},0)}return a}}}if(!a){a=new Spry.Data.XMLDataSet.LoadManager.CachedRequest(c);if(b){Spry.Data.XMLDataSet.LoadManager.cache[e]=a;a.addObserver({onRequestError:function(){Spry.Data.XMLDataSet.LoadManager.cache[e]=undefined}})}}if(d){a.addObserver(d)}a.loadData();return a};Spry.Data.XMLDataSet.LoadManager.cancelLoadData=function(a,b){if(a){if(b){a.removeObserver(b)}else{a.cancelLoadData()}}};Spry.Data.Region=function(d,a,j,h,m,b,f,l){this.regionNode=d;this.name=a;this.isDetailRegion=j;this.data=h;this.dataSets=m;this.hasBehaviorAttributes=l;this.tokens=null;this.currentState=null;this.states={ready:true};this.stateMap={};Spry.Utils.setOptions(this.states,b);Spry.Utils.setOptions(this.stateMap,f);for(var g=0;g<this.dataSets.length;g++){var c=this.dataSets[g];try{if(c){c.addObserver(this)}}catch(k){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(b,a){var c=Spry.Data.Region.notifiers[b];if(!c){c=new Spry.Utils.Notifier();Spry.Data.Region.notifiers[b]=c}c.addObserver(a)};Spry.Data.Region.removeObserver=function(b,a){var c=Spry.Data.Region.notifiers[b];if(c){c.removeObserver(a)}};Spry.Data.Region.notifyObservers=function(b,d,c){var e=Spry.Data.Region.notifiers[d.name];if(e){var a={};if(c&&typeof c=="object"){a=c}else{a.data=c}a.region=d;a.regionID=d.name;a.regionNode=d.regionNode;e.notifyObservers(b,a)}};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(b,a){this.stateMap[b]=a};Spry.Data.Region.prototype.getMappedState=function(b){var a=this.stateMap[b];return a?a:b};Spry.Data.Region.prototype.setState=function(b,c){var a={state:b,mappedState:this.getMappedState(b)};if(!c){Spry.Data.Region.notifyObservers("onPreStateChange",this,a)}this.currentState=a.mappedState?a.mappedState:b;if(this.states[b]){if(!c){Spry.Data.Region.notifyObservers("onPreUpdate",this,{state:this.currentState})}var d=this.transform();if(Spry.Data.Region.debug){Spry.Debug.trace("<hr />Generated region markup for '"+this.name+"':<br /><br />"+Spry.Utils.encodeEntities(d))}Spry.Utils.setInnerHTML(this.regionNode,d,!Spry.Data.Region.evalScripts);if(this.hasBehaviorAttributes){this.attachBehaviors()}if(!c){Spry.Data.Region.notifyObservers("onPostUpdate",this,{state:this.currentState})}}if(!c){Spry.Data.Region.notifyObservers("onPostStateChange",this,a)}};Spry.Data.Region.prototype.getDataSets=function(){return this.dataSets};Spry.Data.Region.prototype.addDataSet=function(b){if(!b){return}if(!this.dataSets){this.dataSets=new Array}for(var a=0;a<this.dataSets.length;a++){if(this.dataSets[a]==b){return}}this.dataSets.push(b);b.addObserver(this)};Spry.Data.Region.prototype.removeDataSet=function(b){if(!b||this.dataSets){return}for(var a=0;a<this.dataSets.length;a++){if(this.dataSets[a]==b){this.dataSets.splice(a,1);b.removeObserver(this);return}}};Spry.Data.Region.prototype.onPreLoad=function(a){if(this.currentState!="loading"){this.setState("loading")}};Spry.Data.Region.prototype.onLoadError=function(a){if(this.currentState!="error"){this.setState("error")}Spry.Data.Region.notifyObservers("onError",this)};Spry.Data.Region.prototype.onCurrentRowChanged=function(a,b){if(this.isDetailRegion){this.updateContent()}};Spry.Data.Region.prototype.onPostSort=function(a,b){this.updateContent()};Spry.Data.Region.prototype.onDataChanged=function(a,b){this.updateContent()};Spry.Data.Region.enableBehaviorAttributes=true;Spry.Data.Region.behaviorAttrs={};Spry.Data.Region.behaviorAttrs["spry:select"]={attach:function(a,c,d){var b=null;try{b=c.attributes.getNamedItem("spry:selectgroup").value}catch(f){}if(!b){b="default"}Spry.Utils.addEventListener(c,"click",function(e){Spry.Utils.SelectionManager.select(b,c,d)},false);if(c.attributes.getNamedItem("spry:selected")){Spry.Utils.SelectionManager.select(b,c,d)}}};Spry.Data.Region.behaviorAttrs["spry:hover"]={attach:function(a,b,c){Spry.Utils.addEventListener(b,"mouseover",function(d){Spry.Utils.addClassName(b,c)},false);Spry.Utils.addEventListener(b,"mouseout",function(d){Spry.Utils.removeClassName(b,c)},false)}};Spry.Data.Region.setUpRowNumberForEvenOddAttr=function(d,a,e,b){if(!e){Spry.Debug.showError("The "+a+" attribute requires a CSS class name as its value!");d.attributes.removeNamedItem(a);return}var f="";var c=e.split(/\s/);if(c.length>1){f=c[0];d.setAttribute(a,c[1])}d.setAttribute(b,"{"+(f?(f+"::"):"")+"ds_RowNumber}")};Spry.Data.Region.behaviorAttrs["spry:even"]={setup:function(a,b){Spry.Data.Region.setUpRowNumberForEvenOddAttr(a,"spry:even",b,"spryevenrownumber")},attach:function(a,b,c){if(c){rowNumAttr=b.attributes.getNamedItem("spryevenrownumber");if(rowNumAttr&&rowNumAttr.value){var d=parseInt(rowNumAttr.value);if(d%2){Spry.Utils.addClassName(b,c)}}}b.removeAttribute("spry:even");b.removeAttribute("spryevenrownumber")}};Spry.Data.Region.behaviorAttrs["spry:odd"]={setup:function(a,b){Spry.Data.Region.setUpRowNumberForEvenOddAttr(a,"spry:odd",b,"spryoddrownumber")},attach:function(a,b,c){if(c){rowNumAttr=b.attributes.getNamedItem("spryoddrownumber");if(rowNumAttr&&rowNumAttr.value){var d=parseInt(rowNumAttr.value);if(d%2==0){Spry.Utils.addClassName(b,c)}}}b.removeAttribute("spry:odd");b.removeAttribute("spryoddrownumber")}};Spry.Data.Region.setRowAttrClickHandler=function(node,dsName,rowAttr,funcName){if(dsName){var ds=null;try{ds=Spry.Utils.eval(dsName)}catch(e){ds=null}if(ds){rowIDAttr=node.attributes.getNamedItem(rowAttr);if(rowIDAttr){var rowAttrVal=rowIDAttr.value;if(rowAttrVal){Spry.Utils.addEventListener(node,"click",function(event){ds[funcName](rowAttrVal)},false)}}}}};Spry.Data.Region.behaviorAttrs["spry:setrow"]={setup:function(a,b){if(!b){Spry.Debug.reportError("The spry:setrow attribute requires a data set name as its value!");a.removeAttribute("spry:setrow");return}a.setAttribute("spryrowid","{"+b+"::ds_RowID}")},attach:function(a,b,c){Spry.Data.Region.setRowAttrClickHandler(b,c,"spryrowid","setCurrentRow");b.removeAttribute("spry:setrow");b.removeAttribute("spryrowid")}};Spry.Data.Region.behaviorAttrs["spry:setrownumber"]={setup:function(a,b){if(!b){Spry.Debug.reportError("The spry:setrownumber attribute requires a data set name as its value!");a.removeAttribute("spry:setrownumber");return}a.setAttribute("spryrownumber","{"+b+"::ds_RowID}")},attach:function(a,b,c){Spry.Data.Region.setRowAttrClickHandler(b,c,"spryrownumber","setCurrentRowNumber");b.removeAttribute("spry:setrownumber");b.removeAttribute("spryrownumber")}};Spry.Data.Region.behaviorAttrs["spry:sort"]={attach:function(rgn,node,value){if(!value){return}var ds=rgn.getDataSets()[0];var sortOrder="toggle";var colArray=value.split(/\s/);if(colArray.length>1){try{var specifiedDS=eval(colArray[0]);if(specifiedDS&&(typeof specifiedDS)=="object"){ds=specifiedDS;colArray.shift()}}catch(e){}if(colArray.length>1){var str=colArray[colArray.length-1];if(str=="ascending"||str=="descending"||str=="toggle"){sortOrder=str;colArray.pop()}}}if(ds&&colArray.length>0){Spry.Utils.addEventListener(node,"click",function(event){ds.sort(colArray,sortOrder)},false)}node.removeAttribute("spry:sort")}};Spry.Data.Region.prototype.attachBehaviors=function(){var a=this;Spry.Utils.getNodesByFunc(this.regionNode,function(g){if(!g||g.nodeType!=1){return false}try{var c=Spry.Data.Region.behaviorAttrs;for(var d in c){var b=g.attributes.getNamedItem(d);if(b){var f=c[d];if(f&&f.attach){f.attach(a,g,b.value)}}}}catch(h){}return false})};Spry.Data.Region.prototype.updateContent=function(){var a=true;var d=this.getDataSets();if(!d||d.length<1){Spry.Debug.reportError("updateContent(): Region '"+this.name+"' has no data set!\n");return}for(var b=0;b<d.length;b++){var c=d[b];if(c){if(c.getLoadDataRequestIsPending()){a=false}else{if(!c.getDataWasLoaded()){c.loadData();a=false}}}}if(!a){Spry.Data.Region.notifyObservers("onLoadingData",this);return}this.setState("ready")};Spry.Data.Region.prototype.clearContent=function(){this.regionNode.innerHTML=""};Spry.Data.Region.processContentPI=function(g){var f="";var d=/<!--\s*<\/?spry:content\s*[^>]*>\s*-->/mg;var a=0;var c=0;while(g.length){var b=d.exec(g);if(!b||!b[0]){f+=g.substr(a,g.length-a);break}if(!c&&b.index!=a){f+=g.substr(a,b.index-a)}if(b[0].search(/<\//)!=-1){--c;if(c){Spry.Debug.reportError("Nested spry:content regions are not allowed!\n")}}else{++c;var e=b[0].replace(/.*\bdataref="/,"");f+=e.replace(/".*$/,"")}a=d.lastIndex}return f};Spry.Data.Region.prototype.tokenizeData=function(dataStr){if(!dataStr){return null}var rootToken=new Spry.Data.Region.Token(Spry.Data.Region.Token.LIST_TOKEN,null,null,null);var tokenStack=new Array;var parseStr=Spry.Data.Region.processContentPI(dataStr);tokenStack.push(rootToken);var regexp=/((<!--\s*){0,1}<\/{0,1}spry:[^>]+>(\s*-->){0,1})|((\{|%7[bB])[^\}\s%]+(\}|%7[dD]))/mg;var searchStartIndex=0;while(parseStr.length){var results=regexp.exec(parseStr);var token=null;if(!results||!results[0]){var str=parseStr.substr(searchStartIndex,parseStr.length-searchStartIndex);token=new Spry.Data.Region.Token(Spry.Data.Region.Token.STRING_TOKEN,null,str,str);tokenStack[tokenStack.length-1].addChild(token);break}if(results.index!=searchStartIndex){var str=parseStr.substr(searchStartIndex,results.index-searchStartIndex);token=new Spry.Data.Region.Token(Spry.Data.Region.Token.STRING_TOKEN,null,str,str);tokenStack[tokenStack.length-1].addChild(token)}if(results[0].search(/^({|%7[bB])/)!=-1){var valueName=results[0];var regionStr=results[0];valueName=valueName.replace(/^({|%7[bB])/,"");valueName=valueName.replace(/(}|%7[dD])$/,"");var dataSetName=null;var splitArray=valueName.split(/::/);if(splitArray.length>1){dataSetName=splitArray[0];valueName=splitArray[1]}regionStr=regionStr.replace(/^%7[bB]/,"{");regionStr=regionStr.replace(/%7[dD]$/,"}");token=new Spry.Data.Region.Token(Spry.Data.Region.Token.VALUE_TOKEN,dataSetName,valueName,new String(regionStr));tokenStack[tokenStack.length-1].addChild(token)}else{if(results[0].charAt(0)=="<"){var piName=results[0].replace(/^(<!--\s*){0,1}<\/?/,"");piName=piName.replace(/>(\s*-->){0,1}|\s.*$/,"");if(results[0].search(/<\//)!=-1){if(tokenStack[tokenStack.length-1].tokenType!=Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN){Spry.Debug.reportError("Invalid processing instruction close tag: "+piName+" -- "+results[0]+"\n");return null}tokenStack.pop()}else{var piDesc=Spry.Data.Region.PI.instructions[piName];if(piDesc){var dataSet=null;var selectedDataSetName="";if(results[0].search(/^.*\bselect=\"/)!=-1){selectedDataSetName=results[0].replace(/^.*\bselect=\"/,"");selectedDataSetName=selectedDataSetName.replace(/".*$/,"");if(selectedDataSetName){try{dataSet=eval(selectedDataSetName)}catch(e){Spry.Debug.reportError("Caught exception in tokenizeData() while trying to retrieve data set ("+selectedDataSetName+"): "+e+"\n");dataSet=null;selectedDataSetName=""}}}var jsExpr=null;if(results[0].search(/^.*\btest=\"/)!=-1){jsExpr=results[0].replace(/^.*\btest=\"/,"");jsExpr=jsExpr.replace(/".*$/,"");jsExpr=Spry.Utils.decodeEntities(jsExpr)}var regionState=null;if(results[0].search(/^.*\bname=\"/)!=-1){regionState=results[0].replace(/^.*\bname=\"/,"");regionState=regionState.replace(/".*$/,"");regionState=Spry.Utils.decodeEntities(regionState)}var piData=new Spry.Data.Region.Token.PIData(piName,selectedDataSetName,jsExpr,regionState);token=new Spry.Data.Region.Token(Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN,dataSet,piData,new String(results[0]));tokenStack[tokenStack.length-1].addChild(token);tokenStack.push(token)}else{Spry.Debug.reportError("Unsupported region processing instruction: "+results[0]+"\n");return null}}}else{Spry.Debug.reportError("Invalid region token: "+results[0]+"\n");return null}}searchStartIndex=regexp.lastIndex}return rootToken};Spry.Data.Region.prototype.processTokenChildren=function(e,b){var f=[""];var a=e.children.length;var d=e.children;for(var c=0;c<a;c++){f.push(this.processTokens(d[c],b))}return f.join("")};Spry.Data.Region.prototype.processTokens=function(token,processContext){if(!processContext){processContext=new Spry.Data.Region.ProcessingContext(this);if(!processContext){return""}}var outputStr="";var i=0;switch(token.tokenType){case Spry.Data.Region.Token.LIST_TOKEN:outputStr+=this.processTokenChildren(token,processContext);break;case Spry.Data.Region.Token.STRING_TOKEN:outputStr+=token.data;break;case Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN:if(token.data.name=="spry:repeat"){var dataSet=null;if(token.dataSet){dataSet=token.dataSet}else{dataSet=this.dataSets[0]}if(dataSet){var dsContext=processContext.getDataSetContext(dataSet);if(!dsContext){Spry.Debug.reportError("processTokens() failed to get a data set context!\n");break}var numRows=dsContext.getNumRows();var dataSetRows=dataSet.getData();dsContext.pushState();for(i=0;i<numRows;i++){dsContext.setRowIndex(i);var testVal=true;if(token.data.jsExpr){var jsExpr=Spry.Data.Region.processDataRefString(processContext,token.data.jsExpr,null,true);try{testVal=Spry.Utils.eval(jsExpr)}catch(e){Spry.Debug.trace("Caught exception in Spry.Data.Region.prototype.processTokens while evaluating: "+jsExpr+"\n    Exception:"+e+"\n");testVal=true}}if(testVal){outputStr+=this.processTokenChildren(token,processContext)}}dsContext.popState()}}else{if(token.data.name=="spry:if"){var testVal=true;if(token.data.jsExpr){var jsExpr=Spry.Data.Region.processDataRefString(processContext,token.data.jsExpr,null,true);try{testVal=Spry.Utils.eval(jsExpr)}catch(e){Spry.Debug.trace("Caught exception in Spry.Data.Region.prototype.processTokens while evaluating: "+jsExpr+"\n    Exception:"+e+"\n");testVal=true}}if(testVal){outputStr+=this.processTokenChildren(token,processContext)}}else{if(token.data.name=="spry:choose"){var defaultChild=null;var childToProcess=null;var testVal=false;var j=0;for(j=0;j<token.children.length;j++){var child=token.children[j];if(child.tokenType==Spry.Data.Region.Token.PROCESSING_INSTRUCTION_TOKEN){if(child.data.name=="spry:when"){if(child.data.jsExpr){var jsExpr=Spry.Data.Region.processDataRefString(processContext,child.data.jsExpr,null,true);try{testVal=Spry.Utils.eval(jsExpr)}catch(e){Spry.Debug.trace("Caught exception in Spry.Data.Region.prototype.processTokens while evaluating: "+jsExpr+"\n    Exception:"+e+"\n");testVal=false}if(testVal){childToProcess=child;break}}}else{if(child.data.name=="spry:default"){defaultChild=child}}}}if(!childToProcess&&defaultChild){childToProcess=defaultChild}if(childToProcess){outputStr+=this.processTokenChildren(childToProcess,processContext)}}else{if(token.data.name=="spry:state"){var testVal=true;if(!token.data.regionState||token.data.regionState==this.currentState){outputStr+=this.processTokenChildren(token,processContext)}}else{Spry.Debug.reportError("processTokens(): Unknown processing instruction: "+token.data.name+"\n");return""}}}}break;case Spry.Data.Region.Token.VALUE_TOKEN:var dataSet=token.dataSet;if(!dataSet&&this.dataSets&&this.dataSets.length>0&&this.dataSets[0]){dataSet=this.dataSets[0]}if(!dataSet){Spry.Debug.reportError("processTokens(): Value reference has no data set specified: "+token.regionStr+"\n");return""}var dsContext=processContext.getDataSetContext(dataSet);if(!dsContext){Spry.Debug.reportError("processTokens: Failed to get a data set context!\n");return""}var ds=dsContext.getDataSet();if(token.data=="ds_RowNumber"){outputStr+=dsContext.getRowIndex()}else{if(token.data=="ds_RowNumberPlus1"){outputStr+=(dsContext.getRowIndex()+1)}else{if(token.data=="ds_RowCount"){outputStr+=dsContext.getNumRows()}else{if(token.data=="ds_UnfilteredRowCount"){outputStr+=dsContext.getNumRows(true)}else{if(token.data=="ds_CurrentRowNumber"){outputStr+=ds.getRowNumber(ds.getCurrentRow())}else{if(token.data=="ds_CurrentRowID"){outputStr+=ds.curRowID}else{if(token.data=="ds_EvenOddRow"){outputStr+=(dsContext.getRowIndex()%2)?Spry.Data.Region.evenRowClassName:Spry.Data.Region.oddRowClassName}else{if(token.data=="ds_SortOrder"){outputStr+=ds.getSortOrder()}else{if(token.data=="ds_SortColumn"){outputStr+=ds.getSortColumn()}else{var curDataSetRow=dsContext.getCurrentRow();if(curDataSetRow){outputStr+=curDataSetRow[token.data]}}}}}}}}}}break;default:Spry.Debug.reportError("processTokens(): Invalid token type: "+token.regionStr+"\n");break}return outputStr};Spry.Data.Region.prototype.transform=function(){if(this.data&&!this.tokens){this.tokens=this.tokenizeData(this.data)}if(!this.tokens){return""}return this.processTokens(this.tokens,null)};Spry.Data.Region.PI={};Spry.Data.Region.PI.instructions={};Spry.Data.Region.PI.buildOpenTagForValueAttr=function(c,a,b){if(!c||!a){return""}var g="";try{var f=c.attributes.getNamedItem(a);if(f&&f.value){g=Spry.Utils.encodeEntities(f.value)}}catch(d){g=""}if(!g){Spry.Debug.reportError(a+" attribute requires a JavaScript expression that returns true or false!\n");return""}return"<"+Spry.Data.Region.PI.instructions[a].tagName+" "+b+'="'+g+'">'};Spry.Data.Region.PI.buildOpenTagForTest=function(b,a){return Spry.Data.Region.PI.buildOpenTagForValueAttr(b,a,"test")};Spry.Data.Region.PI.buildOpenTagForState=function(b,a){return Spry.Data.Region.PI.buildOpenTagForValueAttr(b,a,"name")};Spry.Data.Region.PI.buildOpenTagForRepeat=function(d,b){if(!d||!b){return""}var a="";try{var h=d.attributes.getNamedItem(b);if(h&&h.value){a=h.value;a=a.replace(/\s/g,"")}}catch(g){a=""}if(!a){Spry.Debug.reportError(b+" attribute requires a data set name!\n");return""}var c="";try{var f=d.attributes.getNamedItem("spry:test");if(f){if(f.value){c=' test="'+Spry.Utils.encodeEntities(f.value)+'"'}d.attributes.removeNamedItem(f.nodeName)}}catch(g){c=""}return"<"+Spry.Data.Region.PI.instructions[b].tagName+' select="'+a+'"'+c+">"};Spry.Data.Region.PI.buildOpenTagForContent=function(c,a){if(!c||!a){return""}var f="";try{var b=c.attributes.getNamedItem(a);if(b&&b.value){f=Spry.Utils.encodeEntities(b.value)}}catch(d){f=""}if(!f){Spry.Debug.reportError(a+" attribute requires a data reference!\n");return""}return"<"+Spry.Data.Region.PI.instructions[a].tagName+' dataref="'+f+'">'};Spry.Data.Region.PI.buildOpenTag=function(b,a){return"<"+Spry.Data.Region.PI.instructions[a].tagName+">"};Spry.Data.Region.PI.buildCloseTag=function(b,a){return"</"+Spry.Data.Region.PI.instructions[a].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(a){if(!a){return null}return a.match(/{[^}]+}/g)};Spry.Data.Region.processDataRefString=function(j,k,f,a){if(!k){return""}if(!j&&!f){return k}var h="";var m=new RegExp("\\{([^\\}:]+::)?[^\\}]+\\}","g");var i=0;while(i<k.length){var e=m.exec(k);if(!e||!e[0]){h+=k.substr(i,k.length-i);return h}if(e.index!=i){h+=k.substr(i,e.index-i)}var b="";if(e[0].search(/^\{[^}:]+::/)!=-1){b=e[0].replace(/^\{|::.*/g,"")}var l=e[0].replace(/^\{|.*::|\}/g,"");var n=null;if(j){var g=j.getDataSetContext(b);if(l=="ds_RowNumber"){h+=g.getRowIndex();n=null}else{if(l=="ds_RowNumberPlus1"){h+=(g.getRowIndex()+1);n=null}else{if(l=="ds_RowCount"){h+=g.getNumRows();n=null}else{if(l=="ds_UnfilteredRowCount"){h+=g.getNumRows(true);n=null}else{if(l=="ds_CurrentRowNumber"){var d=g.getDataSet();h+=d.getRowNumber(d.getCurrentRow());n=null}else{if(l=="ds_CurrentRowID"){var d=g.getDataSet();h+=""+d.curRowID;n=null}else{if(l=="ds_EvenOddRow"){h+=(g.getRowIndex()%2)?Spry.Data.Region.evenRowClassName:Spry.Data.Region.oddRowClassName;n=null}else{if(l=="ds_SortOrder"){h+=g.getDataSet().getSortOrder();n=null}else{if(l=="ds_SortColumn"){h+=g.getDataSet().getSortColumn();n=null}else{n=j.getCurrentRowForDataSet(b)}}}}}}}}}}else{var d=b?f[b]:f[0];if(d){n=d.getCurrentRow()}}if(n){h+=a?Spry.Utils.escapeQuotesAndLineBreaks(""+n[l]):n[l]}if(i==m.lastIndex){var c=e.index+e[0].length;if(c<k.length){h+=k.substr(c)}break}i=m.lastIndex}return h};Spry.Data.Region.strToDataSetsArray=function(str,returnRegionNames){var dataSetsArr=new Array;var foundHash={};if(!str){return dataSetsArr}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 dataSet=eval(arr[i]);if(!foundHash[arr[i]]){if(returnRegionNames){dataSetsArr.push(arr[i])}else{dataSetsArr.push(dataSet)}foundHash[arr[i]]=true}}catch(e){}}}return dataSetsArr};Spry.Data.Region.DSContext=function(b){var a=this;var c=b;var d=[-1];function e(){return d[d.length-1]}this.resetAll=function(){d=[c.getCurrentRow()]};this.getDataSet=function(){return c};this.getNumRows=function(f){return c.getRowCount(f)};this.getCurrentRow=function(){if(d.length<2||e()<0){return c.getCurrentRow()}var g=c.getData();var f=e();if(f<0||f>g.length){Spry.Debug.reportError("Invalid index used in Spry.Data.Region.DSContext.getCurrentRow()!\n");return null}return g[f]};this.getRowIndex=function(){var f=e();if(f>=0){return f}return c.getRowNumber(c.getCurrentRow())};this.setRowIndex=function(f){d[d.length-1]=f};this.pushState=function(){d.push(e())};this.popState=function(){if(d.length<2){Spry.Debug.reportError("Stack underflow in Spry.Data.Region.DSContext.popState()!\n");return}d.pop()}};Spry.Data.Region.ProcessingContext=function(region){var m_self=this;var m_region=region;var m_dataSetContexts=[];if(region&&region.dataSets){for(var i=0;i<region.dataSets.length;i++){m_dataSetContexts.push(new Spry.Data.Region.DSContext(region.dataSets[i]))}}this.getDataSetContext=function(dataSet){if(!dataSet){if(m_dataSetContexts.length>0){return m_dataSetContexts[0]}return null}if(typeof dataSet=="string"){try{dataSet=eval(dataSet)}catch(e){dataSet=null}if(!dataSet){return null}}for(var i=0;i<m_dataSetContexts.length;i++){var dsc=m_dataSetContexts[i];if(dsc.getDataSet()==dataSet){return dsc}}return null};this.getCurrentRowForDataSet=function(dataSet){var dsc=m_self.getDataSetContext(dataSet);if(dsc){return dsc.getCurrentRow()}return null}};Spry.Data.Region.Token=function(e,b,d,c){var a=this;this.tokenType=e;this.dataSet=b;this.data=d;this.regionStr=c;this.parent=null;this.children=null};Spry.Data.Region.Token.prototype.addChild=function(a){if(!a){return}if(!this.children){this.children=new Array}this.children.push(a);a.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(b,c,d,e){var a=this;this.name=b;this.data=c;this.jsExpr=d;this.regionState=e};Spry.Utils.addLoadListener(function(){setTimeout(function(){Spry.Data.initRegions()},0)});var ig_sp=new Spry.Data.XMLDataSet("sp.xml","imageset/image");var ig_ss09=new Spry.Data.XMLDataSet("ss09.xml","imageset/image");var ig_sf08=new Spry.Data.XMLDataSet("sf08.xml","imageset/image");var ig_pre=new Spry.Data.XMLDataSet("pre.xml","imageset/image");var ig_bag=new Spry.Data.XMLDataSet("bags.xml","imageset/image");var ig_art=new Spry.Data.XMLDataSet("artstuffs.xml","imageset/image");var ig_met=new Spry.Data.XMLDataSet("metallics.xml","imageset/image");var ig_han=new Spry.Data.XMLDataSet("haneul.xml","imageset/image");var ig_cot=new Spry.Data.XMLDataSet("cottons.xml","imageset/image");var ig_ray=new Spry.Data.XMLDataSet("rayons.xml","imageset/image");var ig_woo=new Spry.Data.XMLDataSet("wools.xml","imageset/image");var ig_box=new Spry.Data.XMLDataSet("boxes.xml","imageset/image");var ig_pil=new Spry.Data.XMLDataSet("pillows.xml","imageset/image");var ig_emd=new Spry.Data.XMLDataSet("emdesign.xml","imageset/image");var ig_jci=new Spry.Data.XMLDataSet("jci.xml","imageset/image");var ig_saj=new Spry.Data.XMLDataSet("sajaid.xml","imageset/image");var ig_sof=new Spry.Data.XMLDataSet("softid.xml","imageset/image");var ig_wal=new Spry.Data.XMLDataSet("wallets.xml","imageset/image");var ig_app=new Spry.Data.XMLDataSet("apps.xml","imageset/image");var ig_mai=new Spry.Data.XMLDataSet("mains.xml","imageset/image");var ig_swe=new Spry.Data.XMLDataSet("sweets.xml","imageset/image");var ig_alb=new Spry.Data.XMLDataSet("self.xml","imageset/image");var ig_sca=new Spry.Data.XMLDataSet("scarves.xml","imageset/image");var ig_now=new Spry.Data.XMLDataSet("nowvation.xml","imageset/image");function toggleMenu(b){if(!document.getElementById){return}var a=document.getElementById(b).style;a.display=(a.display=="block")?"none":"block"}function MM_effectSlide(b,c,e,d,a){Spry.Effect.DoSlide(b,{duration:c,from:e,to:d,toggle:a})};function MM_preloadImages() {var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}