/*
 * JXtension - A Sufficient JavaScript Library
 * http://jxtension.gotochriswest.com/
 *
 * Copyright (c) 2010 Christopher West
 * Licensed under the MIT license.
 * http://jxtension.gotochriswest.com/license/
 * 
 * Version: 1.1.0 - Full
 * Revised: January 12, 2010
 */
JX={creator:"Chris West",version:"1.1.0 (Full)",browser:"Unknown",browserVersion:"Unknown",OS:"Unknown",toString:function(){return"JXtension version "+this.version+" was created by "+this.creator+"."},select:function(f){var g=[];if(typeof f=="string"){var f=f.trim().replace(/\s+/g," ");f=f.replace(/ ?> ?/g," >");f=f.replace(/@(\w+)\b/,"[name=$1]");f=f.replace(/\[(\!)?(\w+)\]/g,"[$2$1=*]");f=f.replace(/(\(.+?\)|\[.+?\])/g,function(j){return j.replace(/,/g,";").replace(/\s+/g,"")});f=f.replace(/\:(TEXT|FILE|RADIO|CHECKBOX|BUTTON|SUBMIT|RESET|PASSWORD|IMAGE)/ig,function(j){return"[type="+j.substring(1).toLowerCase()+"]"});var e=f.split(/ ?, ?/g);var k=arguments.length==1?[document.documentElement]:Array.parse(arguments[1]);for(var h,a,b,c=0,d=e.length;c<d;c++){e[c]=e[c].split(" ");a=e[c].length;e[c][-1]=k;for(b=0;b<a;b++){if(h=(e[c][b].charAt(0)==">")){e[c][b]=e[c][b].substring(1)}if(/^#/.test(e[c][b])){e[c][b]=JX.getByID(e[c][b].substring(1),e[c][b-1],h)}else{if(/^\w/.test(e[c][b])){e[c][b]=JX.getByTag(e[c][b],e[c][b-1],h)}else{e[c][b]=JX.getByOther(e[c][b],e[c][b-1],h)}}if(e[c][b][0]==undefined){e[c][b]=[]}}if(a>0){g=g.concat(e[c][b-1])}}}else{g=Array.parse(f)}g=g.uniquify();g.execute=function(j){if(typeof j=="string"){(function(l){l[j]()}).map(this)}else{(function(l){j.apply(l,[])}).map(this)}return this};g.setHTML=function(j){(function(q){var m=/^(INPUT|TEXTAREA)$/i.test(q.nodeName)?"value":"innerHTML";if(!q[m]){q[m]=""}var l,o="",s=0,n=0,r=j.indicesOf("$(this)");if(r){for(;n<r.length;n++){l=r[n];if(l>0&&j.charAt(l-1)=="\\"){o+=j.substring(s,l-1)+j.substring(l,l+7)}else{o+=j.substring(s,l)+q[m]}s=l+7}}o+=j.substring(s,j.length);q[m]=o}).map(this);return this};g.setText=function(j){(function(l){if(/^(INPUT|TEXTAREA)$/i.test(l.nodeName)){$(l).setHTML(j+"")}else{$(l).setHTML((j+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))}}).map(this);return this};g.getText=function(j){var l=function(m){if(/^(INPUT|TEXTAREA)$/i.test(m.nodeName)){return m.value}else{if(m.innerText){return m.innerText}else{return m.textContent}}}.map(this);return isNaN(j)?l:l[j]};g.get=function(m,j){var l=(function(n){return n[m]}).map(this);if(j!=undefined){return l[j]}return l};g.setCSS=function(j,l){j=j.replace(/(-\w)/g,function(m){return m.charAt(1).toUpperCase()});(function(n){try{n.style[j]=l+""}catch(m){}}).map(this);return this};g.getCSS=function(m,j){m=m.replace(/(-\w)/g,function(n){return n.charAt(1).toUpperCase()});var l=(function(n){return n.style[m]}).map(this);if(j!=undefined){return l[j]}return l};g.set=function(j,l){(function(n){try{n[j]=l}catch(m){}}).map(this);return this};g.getElement=function(j){return this[j]};g.slice=function(n,l){if(n==null){n=0}if(l==null){l=this.length}var j=[];for(var m=n;m<l;m++){j.push(this[m])}return $(j)};g.filter=function(){var q=0,m=[],r=Array.parse(arguments[1]);if(typeof arguments[0]=="function"){for(var s=arguments[0];q<this.length;q++){if(s.apply(this[q],r)){m.push(this[q])}}}else{if(/^(DESCENDANT|ANCESTOR|PARENT|CHILD) ?OF$/i.test(arguments[0])){var u,t,o,n,l=RegExp.$1.toUpperCase();for(;q<this.length;q++){n=true;for(o=0;o<r.length&&n;o++){u=r[o];t=this[q];if(l=="ANCESTOR"||l=="PARENT"){t=u;u=this[q]}if(l=="ANCESTOR"||l=="DESCENDANT"){n=JX.contains(u,t)}else{n=u.parentNode==t}}if(n){m.push(this[q])}}}}return $(m)};g.remove=function(){(function(j){if(p=j.parentNode){p.removeNode(j)}}).map(this);return this};g.bind=function(l,n,j){j=j||Infinity;l=/^on/.test(l)?l:"on"+l;for(var q,o,m=0;m<this.length;m++){o=this[m];q=o[l];old=q;if(!(q instanceof Function&&q.fncs instanceof Array)){(o[l]=(q=function(){for(var r=true,s=0;s<q.fncs.length;s++){if(0<q.fncs[s][1]--){JX.handler=q.fncs[s][0];r=((JX.lastHandlerReturn=q.fncs[s][0].apply(this,arguments))!=false)&&r;JX.lastHandler=JX.handler;JX.handler=undefined}else{q.fncs.splice(s--,1)}}return r})).fncs=[];if(old instanceof Function){q.fncs.push([old,j])}}q.fncs.push([n,j])}return this};g.unbind=function(l,o){l=/^on/.test(l)?l:"on"+l;for(var q,n=0;n<this.length;n++){q=this[n][l];if(q instanceof Function&&q.fncs instanceof Array){for(var m=0;m<q.fncs.length;m++){if(q.fncs[m][0]==o){q.fncs.splice(m,1);return this}}}else{if(q==o){q=undefined}}}return this};g.bindHover=function(m,n,l,j){this.bind("mouseover",m).bind("mouseout",n);if(l){this.execute(function(){this.onmouseout()})}if(j){this.bindFocus(m,n)}return this};g.bindFocus=function(j,l,n,m){this.bind("onfocus",j).bind("onblur",l);if(n){this.execute(function(){this.onblur()})}if(m){this.bindHover(j,l)}return this};g.hide=function(){return $(this).setCSS("display","none")};g.show=function(){return $(this).setCSS("display","")};g.addClass=function(j){(function(l){if(l.className!=undefined&&l.className.length>0){l.className+=" "+j}else{l.className=j}}).map(this);return this};g.removeClass=function(j){(function(m){if(m.className!=undefined){var n=m.className.trim().split(" ");var l=n.indexOf(j);if(l>=0){n.splice(l,1)+'"'}m.className=n.join(" ")}}).map(this);return this};g.setClass=function(j){return this.set("className",j)};return g},filter:function(y,o){var v;if(/#([^#\[\(@\.]+)/.test(o)){if((!(v=document.getElementById(RegExp.$1))||!(v=[v].intersect(y)))){return[[],y]}else{y=v}}var s,t,r,n,x=o.match(/\.[^#\[\(@\.]+/g);if(x==undefined){x=[]}else{x=x.join(",").replace(/\./g,"").split(",");for(s=0,t=x.length;s<t;s++){x[s]=new RegExp("\\b"+x[s]+"\\b")}}n=x.length;var f=o.match(/\[.+?\!?=(\*|\w+(\\\[\w*\\\])*)?\]/g);if(f==undefined){f=[]}else{for(s=0,t=f.length;s<t;s++){f[s]=f[s].match(/\[(.+?)(\!?)=(\*|\w+(\\\[\w*\\\])*|)\]/).splice(1,3);f[s][0]=f[s][0].replace(/^class$/,"className")}}var b=f.length;var a,l=[];for(s=0,t=y.length;s<t;s++){a=true;for(r=0;a&&r<n;r++){a=x[r].test(y[s].className)}for(r=0;a&&r<b;r++){if(f[r][2]=="*"){a=((y[s][f[r][0]]!=null)==(f[r][1]==""))}else{a=((y[s][f[r][0]]==f[r][2])==(f[r][1]==""))}}if(!a){l.push(y.splice(s,1)[0]);s--;t--}}var c=o.match(/:element\((.+?)\)/i);if(c!=undefined&&y.length>0){c=c[1].replace(/(^|;)first(;|$)/i,"$11$2");var e=/\beven\b/i.test(c);var d=/\bodd\b/i.test(c);var u,w=/(^|;)last(;|$)/i.test(c);c=c.split(";");var h=c.length;var q,g=y;var m=g[0].parentNode;y=[];t=g.length;do{r=1;for(s=0;s<t;s++){if(g[s].parentNode==m){if((e&&r%2==0)||(d&&r%2==1)){q=-1}else{for(q=0;q<h;q++){if(parseInt(c[q])==r){break}else{if(/\b(\d+):(\d+)\b/.test(c[q])){if(parseInt(RegExp.$1)<=r&&r<=parseInt(RegExp.$2)){break}}else{if(/\b(\d+):(last)\b/i.test(c[q])){if(parseInt(RegExp.$1)<=r){break}}}}}}if(q<h){y.push(g.splice(s,1)[0]);u=-1}else{if(w){u=l.length}l.push(g.splice(s,1)[0])}s--;t--;r++}}if(u>-1&&w){y.push(l.splice(u,1)[0])}if(t>0){m=g[0].parentNode}else{m=undefined}}while(m!=undefined)}return[y,l]},contains:function(a,b){return a.contains?a.contains(b):((a.compareDocumentPosition(b)&16)>0)},set:function(d,a,c){if(arguments.length==2){for(var b in a){d[b]=a[b]}}else{d[a]=c}},getByID:function(f,d,e){var c=document.getElementById(f.replace(/^([^#\[\(@\.]+).*$/,"$1"));if(c==undefined){return[]}for(var b=0,a=d.length;b<a;b++){if(JX.contains(d[b],c)&&e==(d[b]==c.parentNode)){return JX.filter([c],f)[0]}}return[]},getByOther:function(h,f,g){var c,d,b=[];for(var e=0,a=f.length;e<a;e++){if(f[e].hasChildNodes()){b=b.union(Array.fromList(f[e].childNodes))}}if(b.length==0){return[]}b=JX.filter(b,h);return g?b[0]:b[0].concat(JX.getByOther(h,b[0].concat(b[1]),false))},getByTag:function(e,f,h){var g=e;e=e.replace(/^(\w+).*$/,"$1").toUpperCase();for(var d=0,b=[],a=f.length;d<a;d++){b=b.union(Array.fromList(f[d].getElementsByTagName(e)))}if(h){for(var c,d=0,a=f.length;d<b.length;d++){for(c=0;c<a&&b[d].parentNode!=f[c];c++){}if(c==a){b.splice(d--,1)}}}b=JX.filter(b,g)[0];return b},xor:function(b,a){return !!b==!a},getCookie:function(b){var a=document.cookie.match("(^|; ?)"+encodeURIComponent(b)+"=(.+?)(;|$)");return a?decodeURIComponent(a[2]):a},setCookie:function(b,d,a,c,g,f){var e=[encodeURIComponent(b)+"="+encodeURIComponent(d)];if(a){e.push("expires="+a.toGMTString())}if(c){e.push("domain="+encodeURIComponent(c))}if(g){e.push("path="+encodeURIComponent(g))}if(f){e.push("secure")}document.cookie=e.join("; ")},deleteCookie:function(a){setCookie(a,"",new Date(0))},$_GET:{}};if(!Array.prototype.toString$){Array.prototype.toString$=Array.prototype.toString}Array.prototype.toString=function(d){if(!d){return this.toString$()}var c;if(c=!(d instanceof Array)){d=[this]}else{if(c=(d.indexOf(this)==-1)){d=d.concat([this])}}if(c){for(var e,a="",b=0;b<this.length;b++){e=(this[b] instanceof Array?this[b].toString(d):this[b]);if(e==undefined){e=""}a+=","+e}if(this.length>0){a=a.substring(1)}return"["+a+"]"}else{return"[...]"}};Array.parse=function(a){return a instanceof Array?a:[a]};Array.fromList=function(b){if(b instanceof Array){return b}if(!b||!(parseInt(b.length)>0)){return[]}for(var c=0,a=[];c<b.length;c++){a.push(b[c])}return a};Array.prototype.equals=function(b,d){if(!d){d=[this]}else{if(d.indexOf(this)==-1){d=d.concat([this])}else{return true}}if(this===b){return true}if(!(b instanceof Array)||this.length!=b.length){return false}for(var c=0,a=this.length;c<a;c++){if(this[c] instanceof Array){if(!this[c].equals(b[c],d)){return false}}else{if((b[c] instanceof Array)||this[c]!==b[c]){return false}}}return true};Array.prototype.uniquify=function(){var a,b=0,c=this.clone();for(;b<c.length;b++){for(a=b+1;a<c.length;a++){if(c[b].equals?c[b].equals(c[a]):(c[a].equals?c[a].equals(c[b]):c[b]==c[a])){c.splice(a--,1)}}}return c};Array.prototype.clone=function(c){var a,b=[];if(c){if(!(c instanceof Array)){c=[this,b]}else{if((a=c.indexOf(this))>-1){return c[a+1]}else{c.splice(0,0,this,b)}}}for(a=0,len=this.length;a<len;a++){if(c&&this[a] instanceof Array){b.push(this[a].clone(c))}else{b.push(this[a])}}return b};Array.prototype.subtract=function(c){if(!(c instanceof Array)){return[]}var a,b=0,e=[],d=[];for(;b<this.length;b++){for(a=0;a<c.length;a++){if(d[a]!=true&&(c[a].equals?c[a].equals(this[b]):(this[b].equals?this[b].equals(c[a]):c[a]==this[b]))){d[a]=true;break}}if(a==c.length){e.push(this[b])}}return e};Array.prototype.intersect=function(a){if(!(a instanceof Array)){return[]}return this.subtract(this.subtract(a))};Array.prototype.union=function(a){if(!(a instanceof Array)){return[]}return this.concat(a.subtract(this))};Array.prototype.indicesOf=function(d,b){var e=[];for(var c=0,a=this.length;c<a;c++){if(b&&this[c].equals?this[c].equals(d):this[c]===d){e.push(c)}}return e};if(Array.prototype.indexOf&&!Array.prototype.indexOf$){Array.prototype.indexOf$=Array.prototype.indexOf}Array.prototype.indexOf=function(e,d,b){if(!b&&this.indexOf$){return this.indexOf$(e,d)}for(var c=parseInt(d)||0,a=this.length;c<a;c++){if(b&&this[c].equals?this[c].equals(e):this[c]===e){return c}}return -1};Function.concat=function(b){var a=arguments;return function(){if(b==undefined){b=this}ret=[];for(var c=1;c<a.length;c++){if(a[c] instanceof Function){ret.push(a[c].apply(b,arguments))}}return ret}};Function.prototype.map=function(d,e){if(e==undefined){e=this}d=Array.fromList(d);var c=[];for(var b=0,a=d.length;b<a;b++){c.push(this.apply(e,Array.parse(d[b])))}return c};Color=function(){this.setColor.apply(this,arguments)};Color.random=function(){return new Color(Math.random()*255,Math.random()*255,Math.random()*255)};JX.set(Color.prototype,{setColor:function(){if(arguments.length==1){var a=/^#?(([\dA-F]{3}){1,2})$/i.exec(arguments[0]+"");if(a){var b=a[1];if(b.length==3){b=b.replace(/(.)/g,"$1$1")}this.red=parseInt(b.substring(0,2),16);this.green=parseInt(b.substring(2,4),16);this.blue=parseInt(b.substring(4,6),16)}else{if(a=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.exec(arguments[0]+"")){this.setColor.apply(this,[a[1],a[2],a[3]])}}}else{if(arguments.length==3){this.red=Math.max(Math.min(Math.round(arguments[0]),255),0);this.green=Math.max(Math.min(Math.round(arguments[1]),255),0);this.blue=Math.max(Math.min(Math.round(arguments[2]),255),0)}}if(isNaN(this.red)){this.red=0}if(isNaN(this.green)){this.green=0}if(isNaN(this.blue)){this.blue=0}},getHexCode:function(){var a=[this.red.toString(16),this.green.toString(16),this.blue.toString(16)].join(",").replace(/\b([\da-f])\b/gi,"0$1");return"#"+a.toUpperCase().replace(/,/g,"")},combine:function(e,f){f=new Number(f);if(isNaN(f)){f=50}var g=Math.max(Math.min(f,100),0)/100;var a=1-g;var b=[[this.red,e.red]];b.push([this.green,e.green]);b.push([this.blue,e.blue]);for(var d=0;d<3;d++){b[d]=b[d][0]*a+b[d][1]*g}var c=new Color();c.setColor.apply(c,b);return c},getSafeColor:function(){var a=this.getLuminance()<128?255:0;return new Color(a,a,a)},getLuminance:function(){return 0.3*this.red+0.6*this.green+0.1*this.blue},toGrayscale:function(){var a=Math.round(this.getLuminance());return new Color(a,a,a)},getOpposite:function(){with(this){return new Color(255-red,255-green,255-blue)}},getLighter:function(a){return this.combine(new Color(255,255,255),a?a:30)},getDarker:function(a){return this.combine(new Color(0,0,0),a?a:30)}});Color.prototype.toString=Color.prototype.getHexCode;RegExp.fromWildExp=function(c,f){var h=f&&f.indexOf("o")>-1;var d,b,g="",a=(f&&f.indexOf("s")>-1?"?":"");var e=new RegExp("~.|\\[!|"+(h?"{\\d+,?\\d*\\}|[":"[")+(f&&f.indexOf("p")>-1?"":"\\(\\)")+"\\{\\}\\\\\\.\\*\\+\\?\\:\\|\\^\\$%_#]");while((d=c.search(e))>-1&&d<c.length){g+=c.substring(0,d);if((b=RegExp.lastMatch)=="[!"){g+="[^"}else{if(b.charAt(0)=="~"){g+="\\"+b.charAt(1)}else{if(b=="*"||b=="%"){g+=".*"+a}else{if(b=="?"||b=="_"){g+="."}else{if(b=="#"){g+="\\d"}else{if(h&&b.charAt(0)=="{"){g+=b+a}else{g+="\\"+b}}}}}}c=c.substring(d+b.length)}g+=c;if(f){if(/[ab]/.test(f)){g="^"+c}if(/[ae]/.test(f)){g+="$"}}return new RegExp(g,f?f.replace(/[^gim]/g,""):"")};if(!String.prototype.replace$){String.prototype.replace$=String.prototype.replace}String.prototype.replace=function(f,d,a){var g="";var c=this;if(f instanceof RegExp){return g+c.replace$(f,d)}if(a==undefined){a=1}var e=f.length;for(var b=0;b!=a&&(index=c.indexOf(f))>=0;b++){g+=c.substring(0,index)+d;c=c.substring(index+e)}return g+c};String.prototype.indicesOf=function(d){var e=[];var a=this.indexOf(d);var c=d.length;var b=this;while(a>=0){e.push(a);b=b.substring(a+c);a=b.indexOf(d)}return e};String.prototype.reverse=function(){return this.split("").reverse().join("")};String.prototype.toProperCase=function(){return this.replace(/(^|[^\w'-])\w/g,function(a){return a.toUpperCase()})};if(!String.prototype.trim){String.prototype.trim=function(){return this.trimLeft().trimRight()}}if(!String.prototype.trimLeft){String.prototype.trimLeft=function(){return this.replace$(/^\s+/,"")}}if(!String.prototype.trimRight){String.prototype.trimRight=function(){return this.replace$(/\s+$/,"")}}String.prototype.remove=function(b,a){b=parseInt(b)||0;a=parseInt(a);if(isNaN(a)){a=this.length}if(a<b){a=b}return this.slice(0,b)+this.slice(a)};String.prototype.findText=function(b,d){var c=d&&d.indexOf("g")>-1;var a=this.match(RegExp.fromWildExp(b,d));return a?(c?a:a[0]):a};String.prototype.findIndex=function(j,a){var f=a&&a.indexOf("g")>-1;var e=this.findText(j,a);if(!e){return e}for(var h,b=0,c=0,k=this,d=0;d<e.length;d++){h=k.indexOf(e[d]);b+=h+c;c=e[d].length;k=k.substring(h+c);e[d]=b;if(!f){return e[0]}}return e};String.prototype.findReplace=function(a,c,b){return this.replace.apply(this,[RegExp.fromWildExp(a,b),c])};with(JX){$=[{b:"Chrome",ua:"Chrome"},{b:"OmniWeb",ua:"OmniWeb",vi:"OmniWeb/"},{b:"Safari",s:navigator.vendor,t:"Apple",vi:"Version"},{b:"Opera",p:window.opera},{b:"iCab",s:navigator.vendor,t:"iCab"},{b:"Konqueror",s:navigator.vendor,t:"KDE"},{b:"Firefox",ua:"Firefox"},{b:"Camino",s:navigator.vendor,t:"Camino"},{b:"Netscape",ua:"Netscape"},{b:"Internet Explorer",ua:"MSIE",vi:"MSIE"},{b:"Mozilla",ua:"Gecko",vi:"rv"},{b:"Netscape",ua:"Mozilla",vi:"Mozilla"}];for(var i=0;i<$.length;i++){$.vi=$[i].vi||$[i].b;if(($[i].s&&$[i].s.indexOf($[i].t)>-1||$[i].ua&&navigator.userAgent.indexOf($[i].ua)>-1||$[i].p)&&(browser=$[i].b)){break}}$.fn=function(b){var a=b.indexOf($.vi);return a<0?false:parseFloat(b.substring(a+$.vi.length+1))};browserVersion=$.fn(navigator.userAgent)||$.fn(navigator.appVersion)||browserVersion;$=[{n:"Windows",s:"platform",t:"Win"},{n:"Mac",s:"platform",t:"Mac"},{n:"iPhone/iPod",s:"userAgent",t:"iPhone"},{n:"Linux",s:"platform",t:"Linux"}];for(var i=0;i<$.length;i++){if(navigator[$[i].s].indexOf($[i].t)>-1&&(OS=$[i].n)){break}}if(self.location.search.length>0){(function(d){var b,c,e=d.split("=");b=decodeURIComponent(e[0]);c=decodeURIComponent(e[1]);if($_GET[b]){($_GET[b]=Array.parse($_GET[b])).push(c)}else{$_GET[b]=c}}).map(self.location.search.substring(1).replace(/\+/g, " ").split("&"))}}$=function(){return JX.select.apply(this,arguments)};