// Developed by Robert Nyman, code/licensing: http://code.google.com/p/domassistant/, documentation: http://www.robertnyman.com/domassistant var DOMAssistant=function(){var A=function(){};var B=document.all&&!/Opera/i.test(navigator.userAgent);return{allMethods:[],publicMethods:["elmsByClass","elmsByAttribute","elmsByTag"],initCore:function(){this.applyMethod.call(window,"$",this.$);this.applyMethod.call(window,"$$",this.$$);window.DOMAssistant=this;if(B){A=Array;}A.prototype=[];A.prototype.each=function(E){for(var D=0,C=this.length;D|\+|~)?/;for(var X=0,O=M.length;X0){G=false;for(var P=0,R=X;P":U+="/child::";break;case"+":U+="/following-sibling::*[1]/self::";break;case"~":U+="/following-sibling::";break;}}else{U+=(V>0&&/(>|\+|~)/.test(d[V-1]))?J.tag:("/descendant::"+J.tag);}if(J.id){U+="[@id = '"+J.id.replace(/^#/,"")+"']";}if(J.allClasses){U+=J.allClasses.replace(/\.([\w\-_]+)/g,"[contains(concat(' ', @class, ' '), ' $1 ')]");}if(J.allAttr){U+=J.allAttr.replace(/(\w+)(\^|\$|\*)?=?([\w\-_]+)?/g,function(e,j,i,h,g){var f=e;switch(i){case"^":f="starts-with(@"+j+", '"+h+"')";break;case"$":f="substring(@"+j+", (string-length(@"+j+") - "+(h.length-1)+"), 6) = '"+h+"'";break;case"*":f="contains(concat(' ', @"+j+", ' '), '"+h+"')";break;default:f="@"+j+((h)?"='"+h+"'":"");}return f;});}if(J.pseudoClass){var H=J.pseudoValue;switch(J.pseudoClass.replace(/^:/,"")){case"first-child":U+="[count(preceding-sibling::*) = 0]";break;case"first-of-type":U+="[count(preceding-sibling::"+J.tag+") = 0]";break;case"last-child":U+="[count(following-sibling::*) = 0]";break;case"last-of-type":U+="[count(following-sibling::"+J.tag+") = 0]";break;case"only-child":U+="[count(preceding-sibling::*) = 0 and count(following-sibling::*) = 0]";break;case"only-of-type":U+="[count(preceding-sibling::"+J.tag+") = 0 and count(following-sibling::"+J.tag+") = 0]";break;case"nth-of-type":U+="["+H+"]";break;case"empty":U+="[count(child::*) = 0 and string-length(text()) = 0]";break;case"contains":U+="[contains(., '"+H+"')]";break;case"enabled":U+="[not(@disabled)]";break;case"disabled":U+="[@disabled]";break;case"checked":U+="[@checked='checked']";break;case"nth-child":var D="[";if(/^\d+$/.test(H)){D+="position() = "+H;}else{if(/^n$/.test(H)){D="";}else{if(/^odd$/.test(H)){H="2n+1";}else{if(/^even$/.test(H)){H="2n+0";}}var c=/^(\d+)n((\+|\-)(\d+))?$/.exec(H);var L=parseInt(c[1],10);var b=0;if(c[3]&&c[4]){b=parseInt((c[3]+c[4]),10);if(b<0){b=L+b;}}D+="(count(./preceding-sibling::*) + 1)";if(L "+b;}else{if(b===L){D+=" mod "+L+" = 0";}else{D+=" mod "+L+" = "+b;}}}}if(!/^n$/.test(H)){D+="]";}U+=D;break;case"not":H=H.replace(/^\[#([\w\-\_]+)\]$/,"[id=$1]");var F=H.replace(/^(\w+)/,"self::$1");F=F.replace(/\.([\w\-_]+)/g,"contains(concat(' ', @class, ' '), ' $1 ')");F=F.replace(/\[(\w+)(\^|\$|\*)?=?([\w\-_]+)?\]/g,function(e,j,i,h,g){var f=e;switch(i){case"^":f="starts-with(@"+j+", '"+h+"')";break;case"$":f="substring(@"+j+", (string-length(@"+j+") - "+(h.length-1)+"), 6) = '"+h+"'";break;case"*":f="contains(concat(' ', @"+j+", ' '), '"+h+"')";break;default:f="@"+j+((h)?"='"+h+"'":"");}return f;});U+="[not("+F+")]";break;}}}var T=document.evaluate(U,document,null,0,null);var S=T.iterateNext();while(S){K.push(S);S=T.iterateNext();}}return K;};}else{DOMAssistant.cssSelection=function(D){var Bi=D.replace(/\s*(,)\s*/g,"$1").split(",");var BT=new A();var A9=new A();var Bh=new A();var Bz,AA,Aj,Z,AR,BH,H,Q,A4,Ag,Bw,Aq,S,AF,BC,BS,g,d,AJ,BK,Az;var Bd=/^(>|\+|~)$/;var AD=/^(\w+)?(#[\w\-_]+|\*)?((\.[\w\-_]+)*)?((\[\w+(\^|\$|\*)?=?[\w\-\_]+\]+)*)?(((:\w+[\w\-]*)(\((odd|even|\d*n?((\+|\-)\d+)?|\w+|((\w*\.[\w\-_]+)*)?|(\[#?\w+(\^|\$|\*)?=?[\w\-\_]+\]+))\))?)*)?/;var F;function Br(){for(var b=0,a=A9.length;b0){Aj=false;for(var Av=0,A0=Aw;Av0&&Bd.test(f)){AR=Bd.exec(f);if(AR){BH=/^\w+/.exec(Z[Ar+1]);if(BH){H=new RegExp("(^|\\s)"+BH+"(\\s|$)","i");Q=AR[0];if(Q===">"){for(var Ap=0,e=A9.length,Ba;Ap0){if(!BQ||typeof BQ==="undefined"||(BQ&&BQ.test(Au))){BC=true;}}if(!BC){break;}}if(BC){Aq.added=true;Ah.push(Aq);}}}Br();Bh=Ah;A9=Bh;}if(Bb.pseudoClass){var AH=Bb.pseudoClass;var Bm=Bb.pseudoValue;var BY=Bh;Bh=[];Bz=[];if(/^:not$/.test(AH)){Bm=Bm.replace(/^\[#([\w\-\_]+)\]$/,"[id=$1]");var AI=/^(\w+)/.exec(Bm);var A1=/\.([\w\-_]+)/.exec(Bm);var Ay=/\[(\w+)(\^|\$|\*)?=?([\w\-_]+)?\]/.exec(Bm);var Bn=new RegExp("(^|\\s)"+((AI)?AI[1]:(A1)?A1[1]:"")+"(\\s|$)","i");if(Ay){var Bl=Ay[3];var Bf="^"+Ay[3]+"$";var AE=Ay[2];if(typeof AE==="string"){switch(AE){case"^":Bf=("^"+Bl);break;case"$":Bf=(Bl+"$");break;case"*":Bf=(Bl);break;}}Bn=new RegExp(Bf,"i");}for(var AT=0,A8=BY.length,E;AT0){Ab=A2;var R=(Bg[4])?parseInt((Bg[4]+Bg[5]),10):0;X=R-1;}for(var AK=0,BD=BY.length;AK=Bk){for(var Bo=0,Bj=d.length,I;Bo0){if(!Q||typeof Q==="undefined"||(Q&&Q.test(L))){G.push(M);}}}return G;};}return DOMAssistant.elmsByAttribute.call(this,D,E,C,F);},elmsByTag:function(C){if(document.evaluate){DOMAssistant.elmsByTag=function(D){var E=new A();var G=document.evaluate(".//"+((typeof D==="string")?D:"*"),this,null,0,null);var F=G.iterateNext();while(F){E.push(F);F=G.iterateNext();}return E;};}else{DOMAssistant.elmsByTag=function(D){var F=new A();var H=this.getElementsByTagName(D);for(var G=0,E=H.length;G0)?" ":"")+B;}return this;},removeClass:function(B){var A=new RegExp(("(^|\\s)"+B+"(\\s|$)"),"i");this.className=this.className.replace(A,function(C){var D="";if(new RegExp("^\\s+.*\\s+$").test(C)){D=C.replace(/(\s+).+/,"$1");}return D;}).replace(/^\s+|\s+$/g,"");return this;},replaceClass:function(B,C){var A=new RegExp(("(^|\\s)"+B+"(\\s|$)"),"i");this.className=this.className.replace(A,function(D,G,F){var E=G+C+F;if(new RegExp("^\\s+.*\\s+$").test(D)){E=D.replace(/(\s+).+/,"$1");}return E;}).replace(/^\s+|\s+$/g,"");return this;},hasClass:function(A){return new RegExp(("(^|\\s)"+A+"(\\s|$)"),"i").test(this.className);},getStyle:function(B){var A="";if(document.defaultView&&document.defaultView.getComputedStyle){A=document.defaultView.getComputedStyle(this,"").getPropertyValue(B);}else{if(this.currentStyle){A=B.replace(/\-(\w)/g,function(C,D){return D.toUpperCase();});A=this.currentStyle[A];}}return A;}};}();DOMAssistant.attach(DOMAssistant.CSS);DOMAssistant.Content=function(){return{prev:function(){var A=this.previousSibling;while(A&&A.nodeType!==1){A=A.previousSibling;}return A;},next:function(){var A=this.nextSibling;while(A&&A.nodeType!==1){A=A.nextSibling;}return A;},create:function(C,B,A,D){var E=DOMAssistant.$(document.createElement(C));if(B){E.setAttributes(B);}if(typeof D!=="undefined"){E.addContent(D);}if(A){DOMAssistant.Content.addContent.call(this,E);}return E;},setAttributes:function(A){for(var B in A){if(/class/i.test(B)){this.className=A[B];}else{this.setAttribute(B,A[B]);}}return this;},addContent:function(A){if(typeof A==="string"){this.innerHTML+=A;}else{this.appendChild(A);}return this;},replaceContent:function(B){for(var E=(this.childNodes.length-1),F,A;E>=0;E--){F=this.childNodes[E];A=F.attributes;if(A){for(var C=0,D=A.length;C<\/script>"); document.getElementById("ieScriptLoad").onreadystatechange = function() { if (this.readyState === "complete") { DOMHasLoaded(); } }; } /*@end @*/if(document.addEventListener){document.addEventListener("DOMContentLoaded",DOMHasLoaded,false);}if(navigator.userAgent.search(/WebKit/i)!==-1){DOMLoadTimer=setInterval(function(){if(document.readyState.search(/loaded|complete/i)!==-1){var loaded=new DOMHasLoaded();}},10);}window.onload=DOMHasLoaded;return{DOMReady:function(){for(var i=0,il=arguments.length,func,callFunc;i