/**
 * a library containing (HTML)node methods 
 * (c) 2004 - 2007  Leen Besslink and Jan Vermaat 
 * $Revision: 1.38 $ - februari 2007 and later
 *
 * Licence: GNU LESSER GENERAL PUBLIC LICENSE (http://www.gnu.org/copyleft/lesser.html)
 *
 *  methods 
 * down (el[object], condition[string], deepChild[bool])
 * childNodeBy (el[object], condition[string], deepChild[bool])
 *	return: het gewenste child-object of false
 *
 * childNodesBy (el[object], condition[string], deepChild[bool])
 *	return: een array met child-object's of false
 *
 * up (el[object], condition[string])
 * parentNodeBy (el[object], condition[string])
 *	return: het gewenste parentobject of false
 * 
 * getPreviousSibling (el[object], condition[string])
 * 	return: het gewenste previous sibling object of false
 *
 * getNextSibling (el[object], condition[string])
 *	return: het gewenste next sibling object of false
 *
 * onload (this[object], functionname[string], arg1, arg2, arg3....)
 *	return : nothing
 *
 * create () : create a new node
 * 
 * hasChildNodes ()
 *	return : true of false
 *
 * up () and down () , aliasses
 *
 * node () : shorthand for document.getElementById
 *	
 * properties ===================================== //
 *
 * version // version number like Revision 1.3
 *
 * hasChildren // true of false
 *
 */

var nodes = {
	version:'$Revision: 1.38 $',
	__n:0,
	_onload_timeout:5,
	_onload_max_timeout:600,
	
	childNodeBy:function (el, condition, deepChild) {
		return this.childNodesBy (el, condition, deepChild, false);
	},

	childNodesBy:function (el, condition, deepChild, _list) {
		if (this.is_node (el) == false)
			return false;

		if (typeof _list == 'undefined')
			_list = true;

		if (_list === true)
			var retval = [];

		if (condition == false)
			return false;

		if (typeof el == 'undefined' || typeof el == 'function')
			return false;

		if (!el.hasChildNodes ())
			return false;

		for (var el2 in el.childNodes)
			if (el2 != 'length') {
				var el3 = el.childNodes [el2];

				if (this.check_condition (el3, condition)) {
					if (_list === true)
						retval [retval.length] = el3;
					else
						return el3;
				}

				var el4 = this.childNodesBy (el3, condition, deepChild, _list);

				if (el4 !== false) {
					if (_list === true) {
						if (deepChild === true)
							var retval = [].concat (retval, el4);
						else // TODO ?: you'll get duplicates !!
							retval [retval.length] = el3;
					} else {
						if (deepChild === true)
							return el4;
						else
							return el3;
					}
				}
			}
		if (_list === true)
			return retval;

		return false;
	},

	parentNodeBy:function (el, condition) {
		if (typeof condition != 'string')
			condition = false;
	
		while (true) {
			if (el == null)
				return false;
				
			if (typeof el.parentNode == 'undefined') 
				return false;
	
			if (condition == false) 
				return el.parentNode;
	
			if (this.check_condition (el.parentNode, condition)) 
				return el.parentNode;
	
			var el = el.parentNode;
		}
		return false;
	},
	cccounter:0,
	check_condition:function (el, condition) {

		if (typeof condition != 'string')
			return false;
		
		if (!el)
			return false;
	
		var arr = condition.split ('=', 2);
	
		if (arr.length == 1)
			arr [1] = '';
	
		if (typeof arr.length != 'undefined' && arr.length == 2) {
			var negative = arr [0].replace (/\!$/, '');
			if (negative == arr [0]) {
				negative = false;
			} else {
				arr [0] = negative;
				negative = true;
			}
			try {
				if (negative) {
					if (el.getAttribute)
						if (nodes.make_string (el.getAttribute (arr [0])) != arr [1])
							return true;
	
					if (nodes.make_string (el [arr [0]]) != arr [1])
						return true;
				} else {
					if (el.getAttribute)
						if (nodes.make_string (el.getAttribute (arr [0])) == arr [1])
							return true;
	
					if (nodes.make_string (el [arr [0]]) == arr [1])
						return true;
				}
			} catch (e) {
			}
		}
		return false;
	},
	
	make_string:function (val) {
		switch (typeof val) {
		case 'undefined':
		case 'null':
			return '';
		case 'object':
			if (val === null)
				return '';
		}
		return val;
	},
	
	is_node:function (node) {
	/**
	 *	nodeType:
	 *	3 == text-node (space, tab, newline)
	 *	8 == comment
	 */
		if (node != null && typeof node != 'undefined')
			if (typeof node.nodeType != 'undefined') {
				var nodeType = node.nodeType.toString ();
				if (nodeType !== '3' && nodeType !=='8')
					return true;
			}
		return false;
	},
	
	getPreviousSibling:function (p, cond) {
		var s = p.previousSibling;
		if (s === null)
			return false;
	
		if (typeof cond != 'undefined') {
			if (this.check_condition (s, cond))
				return s;
			else
				return this.getPreviousSibling (s, cond);
		}
	
		if (!this.is_node (s))
			return this.getPreviousSibling (s, cond);
		else
			return s;
	},

	getNextSibling:function (p, cond) {
		var s = p.nextSibling;
		if (s === null)
			return false;
	
		if (typeof cond != 'undefined') {
			if (this.check_condition (s, cond))
				return s;
			else
				return this.getNextSibling (s, cond);
		}
	
		if (!this.is_node (s))
			return this.getNextSibling (s, cond);
		else
			return s;
	},
	
	next:function (el, condition) {
		return this.getNextSibling (el, condition);
	},
	
	previous: function (el, condition) {
		return this.getPreviousSibling (el, condition);
	},
	/**
	 * 3 functions for the dom.onload
	 * api : dom.onload(objFunction, strArgument, strArgumant, strArgument.....)
	 * or : dom.onload(obj, ObjFunction, strArgumant, strArgument,...)
	 * dom.onload()
	 * helper functions: _onload, _onReady and hasChildNodes
	 * dom.onload is based on based on domReady.js
	 * http://www.brothercake.com/scripts/domready/domReady.js
	 * *****************************************************
	 * DOM scripting by brothercake -- http://www.brothercake.com/
	 * GNU Lesser General Public License -- http://www.gnu.org/licenses/lgpl.html
	 *******************************************************
	 */
	onload:function () {
		if (typeof document.getElementsByTagName == 'undefined' || arguments.length < 1)
			return false;
	
		var iStart = typeof arguments [0] == 'object'? 2: 1;
	
		this.readyList = this.readyList? this.readyList: [];
		var args = [{type:'load'}];
	
		for (var i=iStart ; i< arguments.length; i++) 
			args[i-iStart] = arguments[i];
	
		if (iStart==2 && typeof arguments [1] == 'function')
			this.readyList [this.readyList.length] = {'func':arguments[1], 'args':args, 'obj':arguments [0]};
		else
			this.readyList [this.readyList.length] = {'func':arguments[0], 'args':args};	
	
		this.hasChildren? this._onReady (): this._onload ();
	},
	
	_onload:function () {
		if ( this.hasChildNodes () )
			return this._onReady ();
	
		if (this.__n >= this._onload_max_timeout)
			return alert ('A timeout error has occurred in DOM-nodes');
	
		if(this.__n++ < this._onload_max_timeout)
			setTimeout('nodes._onload()', this._onload_timeout);
			
	},
	
	_onReady:function () { 
		for (var el in this.readyList)
			if (typeof this.readyList [el].obj == 'undefined')
				this.readyList [el].func.apply (window, this.readyList [el].args );
			else
				this.readyList [el].func.apply (this.readyList [el].obj, this.readyList [el].args );
		
		this.readyList = [];
	},
	
	hasChildNodes:function () {
		if (typeof document.getElementsByTagName != 'undefined' && (document.getElementsByTagName('body')[0] != null || document.body != null)) 
			this.hasChildren = true;
		
		return this.hasChildren;
	},
	
	/**
	 * create a DOM element
	 * @param object args: an object with all of the attributes: like this
	 * {
	 * 	nodeName: INPUT,
	 *  id:test,
	 *  value:foo
	 * }
	 */
	create: function (args) {
		if (typeof args=='undefined' || typeof args=='string') 
			return document.createElement (args || 'DIV');
			
		var el = document.createElement (args['nodeName']||'DIV');
		delete args['nodeName'];
		
		if (args['class']) 
			args['className'] = args['class'];
		
		delete args['class'];	
		
		if (args['innerHTML']) 
			el.innerHTML = args['innerHTML'];

		delete args['innerHTML'];
		
		if (args['className']) 
			el.className = args['className'];
		
		delete args['className'];
		
		for (var elm in args)
			el.setAttribute (elm, args[elm]);
		
		return el;
	},
	
	/**
	 * alias for  parentNodeBy()
	 */
	up : function (e, c) {	return this.parentNodeBy (e, c) },
	
	/**
	 * alias for  childNodeBy()
	 */
	down : function (e, c, d) {d = d || true; return this.childNodeBy (e, c, d) },

	/**
	 * alias for  childNodesBy()
	 */
	downAll : function (e, c, d) {d = d || true; return this.childNodesBy (e, c, d) },
	
	/**
	 * shorthand for document.getElementById an sly.find
	 * example:
	 dom.node ('foo')
	 dom.node ('#foo')
	 dom.node('.foo') => gets the first element with the classname foo
	 */
	node: function (id) { 
		var retval = (/^#|^\./.test(id))? this.Sly.find (id): document.getElementById (id);
		return typeof retval==='undefined'? null: retval;
	 },
	 
	 /**
	 * find the first element with a CSS selector; uses sly.find
	 * @param	c	CSS selector condition
	 * @param	el	dom object a part of the dom (optional)
	 */
	 find: function (c, el) {
	  	return this.Sly.find (c, el);
	 },
	
	/**
	 * use sly to search trough nodes
	 * @param cs: the CSS selector
	 * @param el: dom object a part of the dom (optional, standard Sly searches through the whole document)
	 * example: 
	 * dom.nodes ("#tester", el);
	 */
	nodes: function (cs, el) {
		var first = new this.slyObj ();
		var second = this.Sly.search (cs, el);
		
		// merge both arrays 
		var i = first.length, j = 0;

		if ( typeof second.length === "number" ) 
			for ( var l = second.length; j < l; j++ ) 
				first[ i++ ] = second[ j ];
			
		else 
			while ( second[j] !== undefined ) 
				first[ i++ ] = second[ j++ ];
		
		first.length = i;
		return first;
	},
	
	/**
	* internal. Used for Sly.search
	*/
	slyObj:function () {
		this.length = 0;
		
		this.each = function (func) {
						
			if (typeof func !=='function')
				return false;
			
			var len =  this.length;
			
			for (var i = 0; i < len; i++) 
				func (this[i]);
			
		}
		return this;
	},
	
	
	/**
	 * helper function
	 * get the CSS s syntax of a 'className'
	 * we add an dot (.) to the name if there is not a dot
	 *
	 * example 
	 * getClassName('test') => '.test'
	 * getClassName('.test2') => '.test2'
	 *
	 * n: string
	 * returns string or false
	 */
	getClassName: function (n) {
		return typeof n=='string'? (/^\./.test(n)? n : '.' + n): false;
	},
	
	/**
	 * add one or more event handlers to an DOM element
	 * actualy we add one (1) function to the element event handler
	 * this function points to an array of handlerfuntions
	 *
	 * el.onclick => function => functionid
	 * nodes.__HANDLERS__.onclick.functionid is an array with functions
	 * nodes.__HID__ the counter to give each element function an unique ID
	 *
	 */
	add: function (el, type, func) {
		type = /^on/.test (type)? type: 'on' + type;

		// create the internal data sturcture
		if (!this.__HID__)
			nodes.__HID__ = 0;
			
		if (!this.__HANDLERS__)
			this.__HANDLERS__ = {};
		
		if (!this.__HANDLERS__[type])
			this.__HANDLERS__[type] = {};
		// end of create structure
		
		var arr = this.__HANDLERS__[type];
		
		// if the dom element hasnt a event handler function create one
		if (typeof el[type] !== 'function') {
	
			var hid = this.__HID__;

			// create the eventhandler function. Do it once
			// pass the e (event) if any
			el[type] = function (e) {
				var hid = this[type].hid;
				
				var retval;
				
				// check if any real user defined event handler functions are attached 
				// restore the this object and pass the event (if any)
				for (var i= 0; i < arr[hid].length; i++)
					if (arr[hid][i].apply (this, [e]) === false)
						retval = false;

				return retval;
			}
			//add the unique counter to the event handler function
			el[type].hid = hid;
			
			this.__HID__++;
		} else {
			var hid = el[type].hid;
		}

		
		if (!arr[hid])
			arr[hid] = [];

		if (typeof arr[hid]=='object')
			arr[hid]  [ arr[hid].length ] =  func;

	},
	
	/**
	 * run once at start
	 * create nodes.onclick, nodes.onmouseover etc.
	 * and
	 * create dom.nodes.onclick, onblur etc
	 * we create all the standard 'eventhandlers' as they are predefined in nodes.eventArray
	 * the 'eventhandlers' don't do much. You have to activate them and say what handler you want
	 *
	 * examples
	 * dom.nodes ('.tester').onclick (function (e) {alert ('clicked')});
	 *
	 * dom.onclick (el, function (){})
	 */
	allevents: function (type) {
		var ae = ['onunload','onchange','onsubmit','onreset','onselect','onblur','onfocus','onkeydown','onkeypress','onkeyup','onclick','ondblclick','onmousedown','onmousemove','onmouseout','onmouseover','onmouseup'];
		var ael = ae.length;
		
		for (var i=0; i < ael; i++) {
			
			if (!nodes[ae[i]]) {
				nodes[ae[i]] = function (el, func) {
					nodes.add (el, ae[i], func);
				}
			}

			nodes.slyObj.prototype[ae[i]] = (
				
				function (type) {
					
					return function (func) {
						var len = this.length;
						
						for (var j = 0; j < len; j++) 
							dom.add (this[j], type, func);
					}
				}
			) (ae[i]);
		}

	}
	
}

/** 
 * dom is a alias of node; it is dom-scripting isn't it?
 */
var dom = nodes;
dom.allevents ();

/* Sly v1.0rc2 <http://sly.digitarald.com> - (C) 2009 Harald Kirschner <http://digitarald.de> - Open source under MIT License */
nodes.Sly=(function(){var q={};var b=function(E,D,C,i){E=(typeof(E)=="string")?E.replace(/^\s+|\s+$/,""):"";var e=q[E]||(q[E]=new b.initialize(E));return(D==null)?e:e.search(D,C,i)};b.initialize=function(e){this.text=e};var t=b.initialize.prototype=b.prototype;b.implement=function(i,e){for(var C in e){b[i][C]=e[C]}};var k=b.support={};(function(){var i=document.createElement("div"),C=(new Date()).getTime();i.innerHTML='<a name="'+C+'" class="€ b"></a>';i.appendChild(document.createComment(""));k.byTagAddsComments=(i.getElementsByTagName("*").length>1);k.hasQsa=!!(i.querySelectorAll&&i.querySelectorAll(".€").length);k.hasByClass=(function(){if(!i.getElementsByClassName||!i.getElementsByClassName("b").length){return false}i.firstChild.className="c";return(i.getElementsByClassName("c").length==1)})();var e=document.documentElement;e.insertBefore(i,e.firstChild);k.byIdAddsName=!!(document.getElementById(C));e.removeChild(i)})();var r=function(){return true};t.search=function(D,O,E){E=E||{};var H,T,W;if(!D){D=document}else{if(D.nodeType!=1&&D.nodeType!=9){if(typeof(D)=="string"){D=b.search(D);H=true}else{if(Object.prototype.toString.call(D)=="[object Array]"||(typeof(D.length)=="number"&&D.item)){var I=[];for(T=0;(W=D[T]);T++){if(W.nodeType==1||W.nodeType==9){I.push(W)}}H=(I.length>1);D=(H)?I:(I[0]||document)}}}}var M,J,P,C={},F={};var N=C;var U=b.getUid;var X=function(i){var e=U(i);return(N[e])?null:(N[e]=true)};if(O&&O.length){for(T=0;(W=O[T]);T++){X(W)}}if(k.hasQsa&&!H&&D.nodeType==9&&!(/\[/).test(this.text)){try{var G=D.querySelectorAll(this.text)}catch(V){}if(G){if(!O){return b.toArray(G)}for(T=0;(W=G[T]);T++){if(X(W)){O.push(W)}}if(!E.unordered){O.sort(b.compare)}return O}}var K=this.parse();if(!K.length){return[]}for(var T=0,S;(S=K[T]);T++){var L=X;if(S.first){if(!O){L=r}else{M=true}if(H){P=D}else{if(S.combinator){P=[D]}}}if(S.last&&O){N=C;J=O}else{N={};J=[]}if(!S.combinator&&!H){J=S.combine(J,D,S,F,L,!(J.length))}else{for(var R=0,Q=P.length;R<Q;R++){J=S.combine(J,P[R],S,F,L)}}if(S.last){if(J.length){O=J}}else{P=J}}if(!E.unordered&&M&&O){O.sort(b.compare)}return O||[]};t.find=function(C,i,e){return this.search(C,i,e)[0]};t.match=function(E,D){var e=this.parse();if(e.length==1){return !!(this.parse()[0].match(E,{}))}if(!D){D=E;while(D.parentNode){D=D.parentNode}}var F=this.search(D),C=F.length;if(!C--){return false}while(C--){if(F[C]==E){return true}}return false};t.filter=function(e){var E=[],C=this.parse()[0].match;for(var D=0,F;(F=e[D]);D++){if(C(F)){E.push(F)}}return E};var z;b.recompile=function(){var i,e=[","],C=["!"];for(i in o){if(i!=" "){e[(i.length>1)?"unshift":"push"](b.escapeRegExp(i))}}for(i in v){C.push(i)}z=new RegExp("[\\w\\u00a1-\\uFFFF][\\w\\u00a1-\\uFFFF-]*|[#.](?:[\\w\\u00a1-\\uFFFF-]|\\\\:|\\\\.)+|[ \\t\\r\\n\\f](?=[\\w\\u00a1-\\uFFFF*#.[:])|[ \\t\\r\\n\\f]*("+e.join("|")+")[ \\t\\r\\n\\f]*|\\[([\\w\\u00a1-\\uFFFF-]+)[ \\t\\r\\n\\f]*(?:(["+C.join("")+"]?=)[ \\t\\r\\n\\f]*(?:\"([^\"]*)\"|'([^']*)'|([^\\]]*)))?]|:([-\\w\\u00a1-\\uFFFF]+)(?:\\((?:\"([^\"]*)\"|'([^']*)'|([^)]*))\\))?|\\*|(.+)","g")};var l=function(e){return{ident:[],classes:[],attributes:[],pseudos:[],combinator:e}};var g=function(e){return e};t.parse=function(I){var E=(I)?"plain":"parsed";if(this[E]){return this[E]}var J=this.text;var H=(I)?g:this.compute;var G=[],D=l(null);D.first=true;var F=function(K){G.push(H(D));D=l(K)};z.lastIndex=0;var C,i;while((C=z.exec(J))){if(C[11]){if(b.verbose){throw SyntaxError('Syntax error, "'+i+'" unexpected at #'+z.lastIndex+' in "'+J+'"')}return(this[E]=[])}i=C[0];switch(i.charAt(0)){case".":D.classes.push(i.slice(1).replace(/\\/g,""));break;case"#":D.id=i.slice(1).replace(/\\/g,"");break;case"[":D.attributes.push({name:C[2],operator:C[3]||null,value:C[4]||C[5]||C[6]||null});break;case":":D.pseudos.push({name:C[7],value:C[8]||C[9]||C[10]||null});break;case" ":case"\t":case"\r":case"\n":case"\f":C[1]=C[1]||" ";default:var e=C[1];if(e){if(e==","){D.last=true;F(null);D.first=true;continue}if(D.first&&!D.ident.length){D.combinator=e}else{F(e)}}else{if(i!="*"){D.tag=i}}}D.ident.push(i)}D.last=true;G.push(H(D));return(this[E]=G)};function u(C,i,e,D){return(C)?((D)?function(E,F){return i(E,e,F)&&C(E,F)}:function(E,F){return C(E,F)&&i(E,e,F)}):function(E,F){return i(E,e,F)}}var j=function(){return true};var B=function(e,i){return(e.id==i)};var c=function(i,e){return(i.nodeName.toUpperCase()==e)};var h=function(e){return(new RegExp("(?:^|[ \\t\\r\\n\\f])"+e+"(?:$|[ \\t\\r\\n\\f])"))};var f=function(e,i){return e.className&&i.test(e.className)};var p=function(e){e.getter=b.lookupAttribute(e.name)||b.getAttribute;if(!e.operator||!e.value){return e}var i=v[e.operator];if(i){e.escaped=b.escapeRegExp(e.value);e.pattern=new RegExp(i(e.value,e.escaped,e))}return e};var s=function(i,e){var C=e.getter(i,e.name);switch(e.operator){case null:return C;case"=":return(C==e.value);case"!=":return(C!=e.value)}if(!C&&e.value){return false}return e.pattern.test(C)};t.compute=function(H){var I,N,J,O,F,D,P=H.tag,C=H.id,G=H.classes;var K=(P)?P.toUpperCase():null;if(C){D=true;F=u(null,B,C);O=function(Q){if(Q.getElementById){var R=Q.getElementById(C);return(R&&(!K||R.nodeName.toUpperCase()==K)&&(!k.getIdAdds||R.id==C))?[R]:[]}var T=Q.getElementsByTagName(P||"*");for(var i=0,S;(S=T[i]);i++){if(S.id==C){return[S]}}return[]}}if(G.length>0){if(!O&&k.hasByClass){for(I=0;(N=G[I]);I++){F=u(F,f,h(N))}var M=G.join(" ");O=function(i){return i.getElementsByClassName(M)}}else{if(!O&&G.length==1){D=true;var L=h(G[0]);F=u(F,f,L);O=function(R){var U=R.getElementsByTagName(P||"*");var T=[];for(var Q=0,S;(S=U[Q]);Q++){if(S.className&&L.test(S.className)){T.push(S)}}return T}}else{for(I=0;(N=G[I]);I++){J=u(J,f,h(N))}}}}if(P){if(!O){F=u(F,c,K);O=function(i){return i.getElementsByTagName(P)}}else{if(!D){J=u(J,c,K)}}}else{if(!O){O=function(R){var U=R.getElementsByTagName("*");if(!k.byTagAddsComments){return U}var T=[];for(var Q=0,S;(S=U[Q]);Q++){if(S.nodeType===1){T.push(S)}}return T}}}for(I=0;(N=H.pseudos[I]);I++){if(N.name=="not"){var E=b(N.value);J=u(J,function(Q,i){return !i.match(Q)},(E.parse().length==1)?E.parsed[0]:E)}else{var e=d[N.name];if(e){J=u(J,e,N.value)}}}for(I=0;(N=H.attributes[I]);I++){J=u(J,s,p(N))}if((H.simple=!(J))){H.matchAux=j}else{H.matchAux=J;F=u(F,J)}H.match=F||j;H.combine=b.combinators[H.combinator||" "];H.search=O;return H};var o=b.combinators={" ":function(H,D,G,e,K,J){var C=G.search(D);if(J&&G.simple){return b.toArray(C)}for(var I=0,F,E=G.matchAux;(F=C[I]);I++){if(K(F)&&E(F,e)){H.push(F)}}return H},">":function(F,E,e,I,G){var C=e.search(E);for(var D=0,H;(H=C[D]);D++){if(H.parentNode==E&&G(H)&&e.matchAux(H,I)){F.push(H)}}return F},"+":function(C,i,e,E,D){while((i=i.nextSibling)){if(i.nodeType==1){if(D(i)&&e.match(i,E)){C.push(i)}break}}return C},"~":function(C,i,e,E,D){while((i=i.nextSibling)){if(i.nodeType==1){if(!D(i)){break}if(e.match(i,E)){C.push(i)}}}return C}};var d=b.pseudos={"first-child":function(e){return d.index(e,0)},"last-child":function(e){while((e=e.nextSibling)){if(e.nodeType===1){return false}}return true},"only-child":function(C){var i=C;while((i=i.previousSibling)){if(i.nodeType===1){return false}}var e=C;while((e=e.nextSibling)){if(e.nodeType===1){return false}}return true},"nth-child":function(E,G,F){var i=b.parseNth(G||"n");if(i.special!="n"){return d[i.special](E,i.a,F)}F=F||{};F.positions=F.positions||{};var C=b.getUid(E);if(!F.positions[C]){var D=0;while((E=E.previousSibling)){if(E.nodeType!=1){continue}D++;var e=F.positions[b.getUid(E)];if(e!=undefined){D=e+D;break}}F.positions[C]=D}return(F.positions[C]%i.a==i.b)},empty:function(e){return !(e.innerText||e.textContent||"").length},contains:function(e,i){return(e.innerText||e.textContent||"").indexOf(i)!=-1},index:function(C,e){var i=1;while((C=C.previousSibling)){if(C.nodeType==1&&++i>e){return false}}return(i==e)},even:function(e,C,i){return d["nth-child"](e,"2n+1",i)},odd:function(e,C,i){return d["nth-child"](e,"2n",i)}};d.first=d["first-child"];d.last=d["last-child"];d.nth=d["nth-child"];d.eq=d.index;var v=b.operators={"*=":function(e,i){return i},"^=":function(e,i){return"^"+i},"$=":function(e,i){return e+"$"},"~=":function(e,i){return"(?:^|[ \\t\\r\\n\\f])"+i+"(?:$|[ \\t\\r\\n\\f])"},"|=":function(e,i){return"(?:^|\\|)"+i+"(?:$|\\|)"}};var n={"class":"className"};b.lookupAttribute=function(i){var C=n[i];if(C){return function(D){return D[C]}}var e=/^(?:src|href|action)$/.test(i)?2:0;return function(D){return D.getAttribute(i,e)}};b.getAttribute=function(i,e){return i.getAttribute(e)};var x=Array.slice||function(e){return Array.prototype.slice.call(e)};try{x(document.documentElement.childNodes)}catch(A){x=function(e){if(e instanceof Array){return e}var D=e.length,C=new Array(D);while(D--){C[D]=e[D]}return C}}b.toArray=x;b.compare=(document.compareDocumentPosition)?function(i,e){return(3-(i.compareDocumentPosition(e)&6))}:function(i,e){return(i.sourceIndex-e.sourceIndex)};var w=1;b.getUid=(window.ActiveXObject)?function(e){return(e.$slyUid||(e.$slyUid={id:w++})).id}:function(e){return e.$slyUid||(e.$slyUid=w++)};var m={};b.parseNth=function(D){if(m[D]){return m[D]}var C=D.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!C){return false}var i=parseInt(C[1],10),e=(parseInt(C[3],10)||0)-1;if((i=(isNaN(i))?1:i)){while(e<1){e+=i}while(e>=i){e-=i}}switch(C[2]){case"n":C={a:i,b:e,special:"n"};break;case"odd":C={a:2,b:0,special:"n"};break;case"even":C={a:2,b:1,special:"n"};break;case"first":C={a:0,special:"index"};break;case"last":C={special:"last-child"};break;case"only":C={special:"only-child"};break;default:C={a:(i)?(i-1):e,special:"index"}}return(m[D]=C)};b.escapeRegExp=function(e){return e.replace(/[-.*+?^${}()|[\]\/\\]/g,"\\$&")};b.generise=function(e){b[e]=function(C){var i=b(C);return i[e].apply(i,Array.prototype.slice.call(arguments,1))}};var a=["parse","search","find","match","filter"];for(var y=0;a[y];y++){b.generise(a[y])}b.recompile();return b})();

