You are on page 1of 11

/*

* JQuery (http://jquery.com/)
* By John Resig (http://ejohn.org/)
* Under an Attribution, Share Alike License
*/

function $(a,c) {
if ( a == null ) return;
// Since we're using Prototype's $ function,
// be nice and have backwards compatability
if ( typeof Prototype != "undefined" && a.constructor == String ) {
var re = new RegExp( "[^a-zA-Z0-9_-]" );
if ( !re.test(a) ) {
var c = ((c&&c.documentElement) || document);
if ( c.getElementsByTagName(a).length == 0 ) {
var obj = c.getElementById(a);
if ( obj != null ) return obj;
}
}
}

// Load Dynamic Function List
var self = {
cur: $.Select(a,c),

// The only two getters
size: function() {
return this.get().length;
},
get: function(i) {
if ( i == null )
return this.$$unclean ? $.sibling(this.$$unclean[0]) : this.cur;
else
return (this.get())[i];
},

"_get": function(i) {
if ( i == null )
return this.cur;
else
return this.cur[i];
},

each: function(f) {
for ( var i = 0; this.cur && i < this._get().length; i++ ) {
if ( this._get(i) ) {
this._get(i).$$tmpFunc = f;
this._get(i).$$tmpFunc(i);
this._get(i).$$tmpFunc = null;
}
}
return this;
},
set: function(a,b) {
return this.each(function(){
if ( b == null )
for ( var j in a )
this[j] = a[j];
else {
if ( b.constructor != String ) {
for ( var i in b ) {
var c = $.Select(i,this);
for ( var j in c )
c[j][a] = b[i];

addClass: function(c) { return this. h ). } }). }. }.display = this. removeClass: function(c) { return this.style. }).className."display").style[a] = b.each(function(){ var d = $. remove: function() { this. }). } } else this[a] = b.c)) return. this.getCSS(this.$$oldblock ? this. toggle: function() { return this.cur = []. }). }. }).hasWord(this.removeChild( this ). if ( d == "none" || d == '' ) $(this).b){ return this.b) { return this. i < s.split( " " ).each(function(){ this.style[j] = a[j].css(a.each(function(){ if ($.c)) return. var s = this.className. css: function(a.length.}).style.show(). for ( var i = 0.each(function(){this. }.parentNode. var ret = "". i++ ) if ( s[i] != c ) ret += ( ret. html: function(h) { return this.length > 0 ? " " : "" ) + c. }. }.each(function(){ this. }. }.className += ( this. }). else $(this). this.display = 'none'.getCSS(this. else this. }.$$oldblock : 'block'. hide: function(a) { return this.each(function(){ if (!$.set( "innerHTML".hide(). show: function(a) { return this. return this.hasWord(this.each(function(){ if ( !b ) for ( var j in a ) this. wrap: function() { . this."display"). }).b). }.$$oldblock = $.className = ret. this.length > 0 ? " " : "" ) + s[i]. // Deprecated style: function(a.

) this. this. }).length .length .cloneNode != null ) this.firstChild ). var a = arguments.clean(arguments).each(function(){ var b = a[0]. i < a.append( this ).parentNode.cloneNode(true). i >= 0.clean(arguments). }. after: function() { var a = $. i++ ) { if ( self. else $(a[i]). return this.t. } }).clean(arguments). before: function() { var a = $.appendChild( this ). this ).each(function(){ for ( var i = a. while ( b. }. this ). return this.length. return this.parentNode. this.append( self.1. }.firstChild ) b = b.$$unclean ) $(a[i]).) this.f) { return this. this. ret = []. }.each(function(){ .get() ). i-.nextSibling ). prepend: function() { var a = $.firstChild. }).f).each(function(){ for ( var i in a ) this.f). b. appendTo: function() { var self = this. unbind: function(t.each(function(){addEvent(this. find: function(t) { var old = []. var a = $.}).insertBefore( a[i]. i-. bind: function(t. return this.cloneNode(true). }).appendChild( a[i].cloneNode(true).t.insertBefore( a[i]. }).clean(arguments).cloneNode(true). }.}).1.each(function(){ for ( var i = 0. }. }. this.each(function(){ for ( var i in a ) if ( a[i].clean(arguments). append: function() { var a = $. return this. }.each(function(){ for ( var i = a.insertBefore( b.parentNode.each(function(){removeEvent(this. return this.cloneNode(true) ).f) { return this. }). i >= 0.insertBefore( a[i].

fn ) { if ( self[i] != null ) self["_"+i] = self[i]. not: function(t) { if ( t.cur = $.this. } }.cur. return this.cur = $. }.cur = this. } else { var r = $C("div").apply(self.this) ).constructor == Array ) this.}).$. for ( var i in $.constructor == String ) this.html(a).cur = $. else if ( t.html("<tbody>"+a+"</tbody>").constructor == String ) this.get(0).indexOf('<') >= 0 ) { if ( a.merge(this.cur = $.cur. }. ret = $.false). } function $C(a) { if ( a.merge(this.Select(t. this. return this.new Array(t)). else this. else this.cur. $.old.Select(t)).indexOf('<tr') >= 0 ) { var r = $C("table").function(a){return a != t.cur = $.$$unclean = r.t).cur).childNodes.childNodes[0]. return this. } } catch (e){} })(i).childNodes.constructor != String ) { for ( var i in self ) {(function(j){ try { if ( j.grep(this.push( this ). old. } else { .old = old. } if ( typeof Prototype != "undefined" && a.r.indexOf('on') != 0 || j == "onready" ) { a[j] = function() { return self[j].this.cur.get(0).r. } return r. this. } return self. }).cur.filter(t.cur = ret. filter: function(t) { this. self[i] = $.cur = $.merge( ret. r. }. return this.$$unclean = r.fn[i]. end: function() { this.merge(this. r.filter(t. }. add: function(t) { if ( t.arguments). }.} return a. return this.

}.indexOf(m[3]) != -1".childNodes.document).cur". //.m[3]. $.length. " class='$1' " ).constructor == String ) { //a[i] = a[i].ofType(a.innerHTML = a[i]. .0. for ( var j = 0.m[3])".n % 2 == 0 :(m[3] == 'odd'? $.true). i < a. } else return null.length ) { for ( var j = 0.sibling(a.currentStyle[p].m[3]).getComputedStyle(e. "nth-of-type": "$. } else { r.defaultView.defaultView. j++ ) r. " id='$1' " ). return document. "first-of-type": "$. j < div.childNodes.cloneNode(true) ). } } return r.id == m[2]". div. "last-of-type": "$.ownerDocument ? a. even: "i % 2 == 0".sibling(a.m[3]).([a-zA-Z0-9_-]+)/g.clean = function(a) { var r = new Array().replace( /#([a-zA-Z0-9_-]+)/g. var div = document. empty: "a.ofType(a.toUpperCase()".cur".ofType(a.1". }.0.createElement(a).style[p]) return e."-$1").length. parent: "a. "first-child": "$.m[3].documentElement".0)". else if (e. ':': { lt: "i < m[3]-0".p) { if (e. return $(document.sibling(a. $.cur))".length == 1".length .length.ownerDocument : document ).sibling(a.innerHTML).toUpperCase() == m[2]."").toLowerCase().getPropertyValue(p).sibling(a).true)". "nth-last-of-type": "$.getCSS = function(e. root: "a == ( a.n % 2 == 1:$. for ( var i = 0.push( a[i][j] ). "only-of-type": "$.sibling(a.getComputedStyle) { p = p.createElement("div").sibling(a.childNodes[j] ).length > 0".g = { '': "m[2] == '*' || a.0 == i".push( a[i] ).length == 0".style[p]. i++ ) { if ( a[i]. j < a[i]. last: "i == r. j++ ) r.m[3]). '#': "a. "last-child": "$.cur".childNodes.innerText || a.push( div.currentStyle) return e. p = p.0).nodeName. odd: "i % 2 == 1".lang == m[3]".true).ofType(a.defaultView && document. } else if ( a[i]. "nth-last-child": "$. gt: "i > m[3]-0". nth: "m[3] .true)". contains: "(a.0 == i". //a[i] = a[i].replace(/([A-Z])/g. else if (document. "only-child": "$. } } $.replace( /\. first: "i == 0". "nth-child": "(m[3] == 'even'?$. lang: "a. eq: "m[3] .ofType(a) == 1".

var re = new RegExp( "/?child::". "i" ).substr( a. "i" ).indexOf(m[4])==0:false".hasWord(a.m[2])".getAttribute(m[3])?a. t = t. document. "|=": "a.indexOf(m[4])==0:false".'display') == 'none' || $.getAttribute(m[3])?a.t.attributes. "~=": "$. " .constructor != String ) return new Array( t ). t = t.m[4])".'display') != 'none' && $. "": "m[3] == '*' ? a. $.hasWord(a.type == 'hidden') || $.Select. checked: "a. "!=": "a.getCSS(a.getCSS(a.indexOf('/').cssQuery = $.getAttribute(m[3])?a. var re = new RegExp( "/?preceding-sibling::".'visibility') != 'hidden')".length > 0 : a.checked != null && !a.replace( re.t. "" ).substr(1.Select(". // following . "@": { "=": "a. "$=": "a. "*=": "a..length ) == m[4] : false".length > 0" }.hasWord(a.fn = {}.getElementsByClass = function(a){return $.length).getAttribute('class'). indeterminate: "a.disabled == false". " ).length). " ~ " ).indexOf(m[4]) != -1 : false". m[4]. // Assume the root element is right :( if ( t..getAttribute(m[3]).Select(m[2]. "i" ).a).indexOf('/') ) t = t.getAttribute(m[3]) != null ? a. "/" ).type != 'hidden') && ($.getAttribute(m[3]) != m[4]". "i" ). "[": "$. if ( t. ". t = t.documentElement. t = t.": "$.substr(2. // If only.getAttribute(m[3]).length .replace( re. disabled: "a.disabled". enabled: "a.className.documentElement.getCSS(a. t = t."+a)}. $.. } // Make Xpath Axes Sane var re = new RegExp( "/?descendant::". " " ). "^=": "a.replace( re. "i" ).length). " + " ).m[4]. visible: "(!a. //var re = new RegExp( "/?following-sibling::". // Frequently-used Accessors window. "i" ).length.substr(t. var re = new RegExp( "/?self::".Select.replace( re. context ) { if ( context == null ) var context = document.indexOf("//") == 0 ) { context = context. t = t.getAttribute(m[3]). } else if ( t.m[2]) || $. //t = t. t = t.t.Select = function( t.getAttribute(m[3]) == m[4]". hidden: "(a.type || a. var re = new RegExp( "/?parent::".getElementsBySelector = $.getAttribute(m[3]). document.getAttribute(m[3]).replace( re. if ( t.replace( re.checked" }.getAttribute(m[3]).type && a.'visibility') == 'hidden'".getCSS(a.indexOf("/") == 0 ) { context = context.getAttribute(m[3])" }.checked".

substr(1. r ).sibling(a). for ( var i = 0.substr(1. t = t.n.indexOf('/') == 0 ) t = t.next. var m = re.length). t = t. return r.length). last = t.t. .t.length.shift().substr(1.cleanSpaces(t).t. done = $.. if ( t.indexOf('|') == 0 ) { if ( ret[0] == context ) ret. t = $. } else { var re = new RegExp( "^([#.getElementById(m[2]). t = $. var done = new Array().cleanSpaces(t).t.indexOf('+') == 0 ) { r = $.cleanSpaces(t). "i" ). } else if ( t. function(a){ return $.map( ret. r = $. } else if ( t.') == 0 || t.merge( done. function(a){ var r = new Array(). r = ret = new Array( context ). t = t.indexOf('/.substr(2." ) m[2] = "*".getAll(o).indexOf('>') == 0 || t. else r = []. } ).') == 0 || t. t = " " + t.length > 0 && last != t ) { var r = new Array(). t = $. } ). // preceding // ancestor // ancestor-or-self // descendant-or-self var ret = new Array( context ).firstChild ) : null ).sibling(a). "i" ). function(a){ return ( a.indexOf('~') == 0 ) { r = $. i++ ) r. while ( t.merge( $. t = t.t. var s = $.substr(1. t = $. var re = new RegExp( "^//". ret ).. } ).map( ret.map( ret.replace( re. t = $.exec(t). } if ( m[2] == "" || m[1] == ". } else if ( t. if ( s. var last = null. } else if ( t.substr(1.push( s[i] ).replace( re.parentNode.length).length). i++ ) { var o = ret[i].indexOf('. function(a){ return a.sibling( a.n > 0 ) for ( var i = s.cleanSpaces(t).length).indexOf('/') == 0 ) { r = $.length).') == 0 ) { if ( t.length > 0 ? $. else t = t. if ( o ) { switch( m[2] ) { case '*': r = $.map( ret. } ).cleanSpaces(t). if ( m[1] == "#" ) { var oid = document. "" ).childNodes. t = t. i < s.t.length.]?)([a-z0-9\\*-]*)". if ( oid != null ) r = [ oid ].indexOf('. "" ). i < ret.

t = $. done = $.getElementsByTagName( "input" ).exec(t). while ( t. } if ( ret && ret[0] == context ) ret. }.merge( o. if ( m[1] == ":" && m[2] == "not" ) r = $.exec(t).exec(t).g[m[1]]. '@'. break. r ).merge( $. r = $.type == m[2] }). } else { var re = new RegExp( "^(\\[) *([^\\]]*) *\\]".filter(m[3].getElementsByTagName( "input" ). m[2]. r ). var m = re.getElementsByTagName( "textarea" ).true).grep( o. "i" ). var m = re. break.getElementsByTagName( m[2] ). } } } } var val = $.f) {return $.#\\[a-zA-Z\\*]/) ) { var re = new RegExp( "^\\[ *@([a-z0-9\\(\\)-]+) *([~!\\|\\*$^=]*) *'?\"?([^'\"]*)'? \"? *\\]".r.match(/^[:\\.length > 0 && t.false). r ).grep. if ( m == null ) { var re = new RegExp( "^(:)([a-z0-9\\*-]*)\\( *[\"']?([^ \\)'\"]*)['\"]? *\\)".constructor == String ) .not) { var g = $. if ( m == null ) { var re = new RegExp( "^([:\\.#]*)([a-z0-9\\*-]*)".merge( o.filter(t.merge( o. "" ).r. m[3] ).cleanSpaces(t). ret = r. r = $. t = val.shift(). m[1]. var m = re. ret ). return done.r). case 'text': case 'radio': case 'checkbox': case 'hidden': case 'button': case 'submit': case 'image': case 'password': case 'reset': case 'image': case 'file': r = $. "i" ).filter = function(t. "i" ). else { if ( $. } } } t = t. case 'input': r = $.replace( re. r = val. if ( m != null ) { m = new Array( ''.r.f.getElementsByTagName( "select" ).grep(a.}. default: r = $. $.merge( o. var m = re. if ( not == false ) var g = function(a.merge( done.t.r. r ). break.exec(t). function(a){ return a. r ). break. "i" ).

next = ( type.prev = ( type.g[m[1]][m[2]] ) var f = $.1 ? type[type. i < s.n < type.hasWord = function(e.className. "" ).grep($. i++ ) if ( s[i] == a ) return true.1. $.ofType = function(a. $.getAll = function(o.sibling = function(a. if ( tmp[i] == a ) type. f ).push(s[i]).r) { if(!r) var r = new Array(). if ( e ) n = t. i++ ) { if ( s[i].sibling(a).g[m[1]]. $. type.nodeType == 1 ) { r.n. t = t.childNodes. i++ ) { if ( tmp[i].cur = ( type[n] == a ). if ( f != null ) { eval("f = function(a.1] : null ).nodeName}).n.length. r = g( r. return type. for ( var i = 0.e) { var t = $.length . var s = o.a) { if ( e == null ) return false.replace( re. }. } } } return { r: r. var tmp = a. "" ). var s = e.length .i){return " + f + "}").push( tmp[i] ). r ).e) { var type = new Array(). type. for ( var i = 0.n > 0 ? type[type. type.split( " " ).n .parentNode. $. t = t.cleanSpaces = function(t) { var re = new RegExp("^\\s+").nodeType == 1 ) type.g[m[1]][m[2]]. if ( e.replace( re.n . return false. }.className != null ) e = e. }.length. return n != null ? t[n] == a : t. else if ( $.nodeName == a. } if ( e ) n = type. }.1.n + 1] : null ). t: t }.getAll( s[i].1.b) { . $. $. $.merge = function(a. } } return r. i < s.length. }. i < tmp.length.length . for ( var i = 0. var re = new RegExp("\\s+$").childNodes.length . var f = $.n = type. }.function(b){return b. return t.n .

addEvent. . $. i++ ) { var t = f(a[i].merge( t.events ) removeEvent( element.events[type][handler.events) { if (type && element. i++ ) if ( (!s && f(a[i].guid++. for ( var i = 0. type.i)) || (s && !f(a[i]. if ( c ) b.push( a[i] ).events[type] ) removeEvent( element. return r. } else { for ( var i in element.$$guid) handler. if (element["on" + type]) handlers[0] = element["on" + type].guid = 1. // addEvent/removeEvent // Original by Dean Edwards // Modified by John Resig function addEvent(element.i)) ) r. if ( t != null ) { if ( t. i++ ) { var c = true. } } else { for ( var i in element. }. element["on" + type] = handleEvent. } return b. }.events[type]) { if ( handler ) { delete element. handler) { if (element. if (!handlers) { handlers = element. type. if ( a != null ) for ( var i = 0.events[type]. i ).events = {}. }. if (!element.$$guid] = handler.events[type] = {}.constructor != Array ) t = new Array(t). for ( var i = 0.push( a[i] ).events) element. element. j++ ) if ( a[i] == b[j] ) c = false.f) { var r = new Array(). var handlers = element. r = $.i).$$guid = addEvent. type. } } return r. i < a.s) { var r = new Array(). i < a. for ( var j = 0.events[type][i] ).f.$$guid].grep = function(a.length. $. } handlers[handler. } } }.length. handler) { if (!handler. r ). i < a. j < b. }.map = function(a.length.length. function removeEvent(element.

stopPropagation.".length. j < e. setTimeout(function(){ if ( typeof Prototype != "undefined" && $.preventDefault = fixEvent.cur.function handleEvent(event) { var returnValue = true. // Move to module $. event.preventDefault(). } return t.text(e[j]. }. for (var i in handlers) { try { if ( handlers[i].cancelBubble = true. .constructor == Function ) { this.preventDefault. event = event || fixEvent(window.type].childNodes[i]. returnValue = false. 1000).type] ) handlers.events[event. event. var t = "". fixEvent.$$handleEvent(event) === false) { event. }. var handlers = []. }. function fixEvent(event) { event. please include jQuery last.childNodes). i < e[j]. return event.type][i] ). j++ ) { for ( var i = 0. }.childNodes[i]. for ( var j = 0.fn.childNodes.events[event.$$handleEvent = handlers[i]. }. fixEvent.length. } } } catch(e){} } return returnValue. i++ ) t += e[j].stopPropagation = fixEvent.returnValue = false.nodeType != 1 ? e[j]. }.stopPropagation().event). if (this.childNodes[i].g == null && $.preventDefault = function() { this.stopPropagation = function() { this.nodeValue : $. for ( var i in this.fn.push( this.clean == null ) throw "Error: You are overwriting jQuery. //var handlers = this.text = function(e) { if ( !e ) var e = this.events[event.