// http://jquery.com/docs/ajax/
if ( typeof XMLHttpRequest == 'undefined' && typeof window.ActiveXObject == 'function') {
- var XMLHttpRequest = function() {
- return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') >= 0) ?
- "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP");
- };
+ var XMLHttpRequest = function() {
+ return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') >= 0) ?
+ "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP");
+ };
}
$.xml = function( type, url, data, ret ) {
- var xml = new XMLHttpRequest();
+ var xml = new XMLHttpRequest();
- if ( xml ) {
- xml.open(type || "GET", url, true);
+ if ( xml ) {
+ xml.open(type || "GET", url, true);
- if ( data )
- xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ if ( data )
+ xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- if ( ret )
- xml.onreadystatechange = function() {
- if ( xml.readyState == 4 ) ret(xml);
- };
+ if ( ret )
+ xml.onreadystatechange = function() {
+ if ( xml.readyState == 4 ) ret(xml);
+ };
- xml.send(data)
- }
+ xml.send(data)
+ }
};
$.httpData = function(r,type) {
- return r.getResponseHeader("content-type").indexOf("xml") > 0 || type == "xml" ?
- r.responseXML : r.responseText;
+ return r.getResponseHeader("content-type").indexOf("xml") > 0 || type == "xml" ?
+ r.responseXML : r.responseText;
};
$.get = function( url, ret, type ) {
- $.xml( "GET", url, null, function(r) {
- if ( ret ) ret( $.httpData(r,type) );
- });
+ $.xml( "GET", url, null, function(r) {
+ if ( ret ) ret( $.httpData(r,type) );
+ });
};
$.getXML = function( url, ret ) {
- $.get( url, ret, "xml" );
+ $.get( url, ret, "xml" );
};
$.post = function( url, data, ret, type ) {
- $.xml( "POST", url, $.param(data), function(r) {
- if ( ret ) ret( $.httpData(r,type) );
- });
+ $.xml( "POST", url, $.param(data), function(r) {
+ if ( ret ) ret( $.httpData(r,type) );
+ });
};
$.postXML = function( url, data, ret ) {
- $.post( url, data, ret, "xml" );
+ $.post( url, data, ret, "xml" );
};
$.param = function(a) {
- var s = [];
- for ( var i in a )
- s[s.length] = i + "=" + encodeURIComponent( a[i] );
- return s.join("&");
+ var s = [];
+ for ( var i in a )
+ s[s.length] = i + "=" + encodeURIComponent( a[i] );
+ return s.join("&");
};
$.fn.load = function(a,o,f) {
- // Arrrrghhhhhhhh!!
- // I overwrote the event plugin's .load
- // this won't happen again, I hope -John
- if ( a && a.constructor == Function )
- return this.bind("load", a);
+ // Arrrrghhhhhhhh!!
+ // I overwrote the event plugin's .load
+ // this won't happen again, I hope -John
+ if ( a && a.constructor == Function )
+ return this.bind("load", a);
- var t = "GET";
- if ( o && o.constructor == Function ) {
- f = o; o = null;
- }
- if (o != null) {
- o = $.param(o);
- t = "POST";
- }
- var self = this;
- $.xml(t,a,o,function(h){
- var h = h.responseText;
- self.html(h).find("script").each(function(){
- try {
- eval( this.text || this.textContent || this.innerHTML );
- } catch(e){}
- });
- if(f)f(h);
- });
- return this;
+ var t = "GET";
+ if ( o && o.constructor == Function ) {
+ f = o;
+ o = null;
+ }
+ if (o != null) {
+ o = $.param(o);
+ t = "POST";
+ }
+ var self = this;
+ $.xml(t,a,o,function(h){
+ var h = h.responseText;
+ self.html(h).find("script").each(function(){
+ try {
+ eval( this.text || this.textContent || this.innerHTML );
+ } catch(e){}
+ });
+ if(f)f(h);
+ });
+ return this;
};
"click","dblclick","mousedown","mouseup","mouseenter","mouseleave",
"mousemove","mouseover","mouseout","change","reset","select","submit",
"keydown","keypress","keyup","abort","error","ready"];
+
for ( var i = 0; i < e.length; i++ ) {
(function(){
var o = e[i];
+$.speed = function(s,o) {
+ if ( o && o.constructor == Function ) o = { onComplete: o };
+ o = o || {};
+ var ss = {"crawl":1200,"xslow":850,"slow":600,"medium":400,"fast":200,"xfast":75,"normal":400};
+ o.duration = typeof s == "number" ? s : ss[s] || 400;
+ return o;
+};
+
+$.fn.hide = function(a,o) {
+ o = $.speed(a,o);
+ return a ? this.each(function(){
+ new fx.FadeSize(this,o).hide();
+ }) : this._hide();
+};
+
+$.fn.show = function(a,o) {
+ o = $.speed(a,o);
+ return a ? this.each(function(){
+ new fx.FadeSize(this,o).show();
+ }) : this._show();
+};
+
+$.fn.slideDown = function(a,o) {
+ o = $.speed(a,o);
+ return this.each(function(){
+ new fx.Resize(this,o).show("height");
+ });
+};
+
+$.fn.slideUp = function(a,o) {
+ o = $.speed(a,o);
+ return this.each(function(){
+ new fx.Resize(this,o).hide("height");
+ });
+};
+
+$.fn.fadeOut = function(a,o) {
+ o = $.speed(a,o);
+ return a ? this.each(function(){
+ new fx.Opacity(this,o).hide();
+ }) : this._hide();
+};
+
+$.fn.fadeIn = function(a,o) {
+ o = $.speed(a,o);
+ return a ? this.each(function(){
+ new fx.Opacity(this,o).show();
+ }) : this._show();
+};
+
+$.fn.center = function(f) {
+ return this.each(function(){
+ if ( !f && this.nodeName == 'IMG' &&
+ !this.offsetWidth && !this.offsetHeight ) {
+ var self = this;
+ setTimeout(function(){
+ $(self).center(true);
+ }, 13);
+ } else {
+ var s = this.style;
+ var p = this.parentNode;
+ if ( $.css(p,"position") == 'static' )
+ p.style.position = 'relative';
+ s.position = 'absolute';
+ s.left = parseInt(($.css(p,"width") - $.css(this,"width"))/2) + "px";
+ s.top = parseInt(($.css(p,"height") - $.css(this,"height"))/2) + "px";
+ }
+ });
+};
+
+$.setAuto = function(e,p) {
+ var a = e.style[p];
+ var o = $.css(e,p);
+ e.style[p] = 'auto';
+ var n = $.css(e,p);
+ if ( o != n )
+ e.style[p] = a;
+};
+
+/*
+ * I originally wrote fx() as a clone of moo.fx and in the process
+ * of making it small in size the code became illegible to sane
+ * people. You've been warned.
+ */
+
function fx(el,op,ty,tz){
var z = this;
z.a = function(){z.el.style[ty]=z.now+z.o.unit};
z.clear = function(){clearInterval(z.timer);z.timer=null};
z.el = el.constructor==String?document.getElementById(el):el;
var y = z.el.style;
- z.oo = y.overflow;
+ z.oo = y.overflow;
y.overflow = "hidden";
z.o = {
- unit: "px",
- duration: (op && op.duration) || 400,
- onComplete: (op && op.onComplete) || op
- };
+ unit: "px",
+ duration: (op && op.duration) || 400,
+ onComplete: (op && op.onComplete) || op
+ };
z.step = function(f,tt){
var t = (new Date).getTime();
var p = (t - z.s) / z.o.duration;
var j = fx.fn[i];
z[j] = function(a,b){p[j]();r[j](a,b);};
})()}
-};
-
-$.speed = function(s,o) {
- if ( o && o.constructor == Function ) o = { onComplete: o };
- o = o || {};
- var ss = {"crawl":1200,"xslow":850,"slow":600,"medium":400,"fast":200,"xfast":75,"normal":400};
- o.duration = typeof s == "number" ? s : ss[s] || 400;
- return o;
-};
-
-$.fn.hide = function(a,o) {
- o = $.speed(a,o);
- return a ? this.each(function(){
- new fx.FadeSize(this,o).hide();
- }) : this._hide();
-};
-
-$.fn.show = function(a,o) {
- o = $.speed(a,o);
- return a ? this.each(function(){
- new fx.FadeSize(this,o).show();
- }) : this._show();
-};
-
-$.fn.slideDown = function(a,o) {
- o = $.speed(a,o);
- return this.each(function(){
- new fx.Resize(this,o).show("height");
- });
-};
-
-$.fn.slideUp = function(a,o) {
- o = $.speed(a,o);
- return this.each(function(){
- new fx.Resize(this,o).hide("height");
- });
-};
-
-$.fn.fadeOut = function(a,o) {
- o = $.speed(a,o);
- return a ? this.each(function(){
- new fx.Opacity(this,o).hide();
- }) : this._hide();
-};
-
-$.fn.fadeIn = function(a,o) {
- o = $.speed(a,o);
- return a ? this.each(function(){
- new fx.Opacity(this,o).show();
- }) : this._show();
-};
-
-$.fn.center = function(f) {
- return this.each(function(){
- if ( !f && this.nodeName == 'IMG' &&
- !this.offsetWidth && !this.offsetHeight ) {
- var self = this;
- setTimeout(function(){
- $(self).center(true);
- }, 13);
- } else {
- var s = this.style;
- var p = this.parentNode;
- if ( $.css(p,"position") == 'static' )
- p.style.position = 'relative';
- s.position = 'absolute';
- s.left = parseInt(($.css(p,"width") - $.css(this,"width"))/2) + "px";
- s.top = parseInt(($.css(p,"height") - $.css(this,"height"))/2) + "px";
- }
- });
-};
-
-$.setAuto = function(e,p) {
- var a = e.style[p];
- var o = $.css(e,p);
- e.style[p] = 'auto';
- var n = $.css(e,p);
- if ( o != n )
- e.style[p] = a;
-};
+};
\ No newline at end of file
},
parent: function(a) {
- this.cur = $.map(this.cur,function(d){
- return d.parentNode;
- });
- if ( a ) this.cur = $.filter(a,this.cur).r;
- return this;
+ this.cur = $.map(this.cur,function(d){
+ return d.parentNode;
+ });
+ if ( a ) this.cur = $.filter(a,this.cur).r;
+ return this;
},
parents: function(a) {
- this.cur = $.map(this.cur,$.parents);
- if ( a ) this.cur = $.filter(a,this.cur).r;
- return this;
+ this.cur = $.map(this.cur,$.parents);
+ if ( a ) this.cur = $.filter(a,this.cur).r;
+ return this;
},
siblings: function(a) {
- // Incorrect, need to exclude current element
- this.cur = $.map(this.cur,$.sibling);
- if ( a ) this.cur = $.filter(a,this.cur).r;
- return this;
- },
-
- parents: function(a) {
+ // Incorrect, need to exclude current element
+ this.cur = $.map(this.cur,$.sibling);
+ if ( a ) this.cur = $.filter(a,this.cur).r;
return this;
},
};
$.attr = function(o,a,v){
- if ( a && a.constructor == String ) {
- var fix = {
- 'for': 'htmlFor',
- 'text': 'cssText',
- 'class': 'className',
- 'float': 'cssFloat'
- };
- a = (fix[a] && fix[a].replace && fix[a]) || a;
- var r = new RegExp("-([a-z])","ig");
- a = a.replace(r,function(z,b){return b.toUpperCase();});
- if ( v != null ) {
- o[a] = v;
- if ( o.setAttribute ) o.setAttribute(a,v);
- }
- return o[a] || o.getAttribute(a) || '';
- } else return '';
+ if ( a && a.constructor == String ) {
+ var fix = {
+ 'for': 'htmlFor',
+ 'text': 'cssText',
+ 'class': 'className',
+ 'float': 'cssFloat'
+ };
+ a = (fix[a] && fix[a].replace && fix[a]) || a;
+ var r = new RegExp("-([a-z])","ig");
+ a = a.replace(r,function(z,b){return b.toUpperCase();});
+ if ( v != null ) {
+ o[a] = v;
+ if ( o.setAttribute ) o.setAttribute(a,v);
+ }
+ return o[a] || o.getAttribute(a) || '';
+ } else return '';
};
$.filter = function(t,r,not) {
return b;
};
-$.cleanSpaces = function(t){return t.replace(/^\s+|\s+$/g, '')};
+$.cleanSpaces = function(t){
+ return t.replace(/^\s+|\s+$/g, '')
+};
$.ofType = function(a,n,e) {
- var t = $.grep($.sibling(a),function(b){return b.nodeName == a.nodeName});
- if ( e ) n = t.length - n - 1;
- return n != null ? t[n] == a : t.length;
+ var t = $.grep($.sibling(a),function(b){return b.nodeName == a.nodeName});
+ if ( e ) n = t.length - n - 1;
+ return n != null ? t[n] == a : t.length;
};
$.sibling = function(a,n,e) {
- var type = [];
- var tmp = a.parentNode.childNodes;
- for ( var i = 0; i < tmp.length; i++ ) {
- if ( tmp[i].nodeType == 1 )
- type[type.length] = tmp[i];
- if ( tmp[i] == a )
- type.n = type.length - 1;
- }
- if ( e ) n = type.length - n - 1;
- type.cur = ( type[n] == a );
- type.prev = ( type.n > 0 ? type[type.n - 1] : null );
- type.next = ( type.n < type.length - 1 ? type[type.n + 1] : null );
- return type;
+ var type = [];
+ var tmp = a.parentNode.childNodes;
+ for ( var i = 0; i < tmp.length; i++ ) {
+ if ( tmp[i].nodeType == 1 )
+ type[type.length] = tmp[i];
+ if ( tmp[i] == a )
+ type.n = type.length - 1;
+ }
+ if ( e ) n = type.length - n - 1;
+ type.cur = ( type[n] == a );
+ type.prev = ( type.n > 0 ? type[type.n - 1] : null );
+ type.next = ( type.n < type.length - 1 ? type[type.n + 1] : null );
+ return type;
};
$.hasWord = function(e,a) {
- if ( e == null ) return false;
- if ( e.className != null ) e = e.className;
- return new RegExp("(^|\\s)" + a + "(\\s|$)").test(e)
+ if ( e == null ) return false;
+ if ( e.className != null ) e = e.className;
+ return new RegExp("(^|\\s)" + a + "(\\s|$)").test(e)
};
$.getAll = function(o,r) {
for ( var j = 0; j < b.length; j++ )
d[j] = b[j];
- for ( var i = 0; i < a.length; i++ ) {
- var c = true;
- for ( var j = 0; j < b.length; j++ )
- if ( a[i] == b[j] )
- c = false;
- if ( c )
- d[d.length] = a[i];
- }
+ for ( var i = 0; i < a.length; i++ ) {
+ var c = true;
+ for ( var j = 0; j < b.length; j++ )
+ if ( a[i] == b[j] )
+ c = false;
+ if ( c )
+ d[d.length] = a[i];
+ }
return d;
};
$.grep = function(a,f,s) {
- var r = [];
+ var r = [];
if ( a != null )
for ( var i = 0; i < a.length; i++ )
if ( (!s && f(a[i],i)) || (s && !f(a[i],i)) )
r[r.length] = a[i];
- return r;
+ return r;
};
$.map = function(a,f) {
- var r = [];
- for ( var i = 0; i < a.length; i++ ) {
- var t = f(a[i],i);
- if ( t != null ) {
- if ( t.constructor != Array ) t = [t];
+ var r = [];
+ for ( var i = 0; i < a.length; i++ ) {
+ var t = f(a[i],i);
+ if ( t != null ) {
+ if ( t.constructor != Array ) t = [t];
r = $.merge( t, r );
}
- }
- return r;
+ }
+ return r;
};
// Bind an event to an element
};
function triggerEvent(element,type) {
- if ( element["on" + type] )
- element["on" + type]({ type: type });
+ if ( element["on" + type] )
+ element["on" + type]({ type: type });
}
function handleEvent(event) {
var handlers = [];
for ( var i in this.events[event.type] )
handlers[handlers.length] = this.events[event.type][i];
- for ( var i = 0; i < handlers.length; i++ ) {
+ for ( var i = 0; i < handlers.length; i++ ) {
try {
if ( handlers[i].constructor == Function ) {
this.$$handleEvent = handlers[i];
};
setTimeout(function(){
- if ( typeof Prototype != "undefined" && $.g == null && $.clean == null )
- throw "Error: You are overwriting jQuery, please include jQuery last.";
+ if ( typeof Prototype != "undefined" && $.g == null && $.clean == null )
+ throw "Error: You are overwriting jQuery, please include jQuery last.";
}, 1000);