/* 20090212 */
/**
 * Jelo Javascript Library - Copyright (c) 2008 HB Stone
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 */

var Jelo=window.Jelo||{};Jelo.uID=function(){var id=1;return function(){return id++;};}();Jelo.emptyFn=function(){};Jelo.each=function(a,f,s){if(typeof a.length=="number"){for(var i=0,l=a.length;i<l;i++){if(typeof a[i]!="undefined"){f.call(s||a[i],a[i],i,a);}}}else if(typeof a=="object"){for(var i in a){if(a.hasOwnProperty(i)){f.call(s||a[i],a[i],i,a);}}}};Jelo.delegate=function(s,f,a){s=s||window;f=f||Jelo.emptyFn;a=a||[];return function(){f.apply(s,a);};};(function(){if(!window.console||!console.firebug){var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i<names.length;++i){window.console[names[i]]=Jelo.emptyFn;}}
Jelo.Console=window.console;})();if(!('opera'in window)&&('ActiveXObject'in window)){(function(f){window.setTimeout=f(window.setTimeout);window.setInterval=f(window.setInterval);})(function(f){return function(c,t){var a=[].slice.call(arguments,2);return f(function(){c.apply(this,a);},t);};});}
Jelo.Environment=function(){var ua=navigator.userAgent.toLowerCase();var isStrict=document.compatMode=="CSS1Compat";var isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1);var isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1);var isLinux=(ua.indexOf("linux")!=-1);var isAir=(ua.indexOf("adobeair")!=-1);var isWebkit=(/webkit|khtml/).test(ua);var isSafari3=isWebkit&&(/webkit\/5/).test(ua);var isGecko=!isWebkit&&(/gecko/).test(ua);var isFirefox=isGecko&&(/firefox\/\d/).test(ua);var isOpera=(/opera/).test(ua);var isIE=!!(window.attachEvent&&!isOpera);var isIE7=isIE&&(/msie 7/).test(ua);var isIE8=isIE&&(/msie 8/).test(ua);var isIEold=isIE&&!isIE7&&!isIE8;var isGoogle=(/googlebot/).test(ua);var isSecure=window.location.href.toLowerCase().indexOf("https")===0;if(isIEold){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}
return{getViewWidth:function(full){return full?this.getDocumentWidth():this.getViewportWidth();},getViewHeight:function(full){return full?this.getDocumentHeight():this.getViewportHeight();},getDocumentWidth:function(){var scrollWidth=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;return Math.max(scrollWidth,this.getViewportWidth());},getDocumentHeight:function(){var scrollHeight=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;return Math.max(scrollHeight,this.getViewportHeight());},getViewportWidth:function(){if(this.isIE){return this.isStrict?document.documentElement.clientWidth:document.body.clientWidth;}else{return self.innerWidth;}},getViewportHeight:function(){if(this.isIE){return this.isStrict?document.documentElement.clientHeight:document.body.clientHeight;}else{return self.innerHeight;}},getUA:function(){return ua;},isStrict:isStrict,isNotStrict:!isStrict,isWindows:isWindows,isLinux:isLinux,isMac:isMac,isAir:isAir,isFirefox:isFirefox,isGecko:isGecko,isOpera:isOpera,isIE:isIE,isIE7:isIE7,isIE8:isIE8,isIEold:isIEold,isWebkit:isWebkit,isSafari:isWebkit,isSafari3:isSafari3,isSecure:isSecure,isGoogle:isGoogle};}();Jelo.Env=Jelo.Environment;
Jelo.Valid=function(){Array.prototype.isArray=true;Function.prototype.isFunction=true;Number.prototype.isNumber=true;String.prototype.isString=true;return{is:function(i){return((typeof i==="undefined")||(i===null));},isArray:function(a){return(a instanceof Array||a.item);},isElement:function(e){return!!e&&!!e.tagName;},isFunction:function(f){return f instanceof Function;},isEmail:function(){var regex=/^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$/;return regex.test(arguments[0]);}};}();
Jelo.Format=function(){return{hyphenatedToCamelCase:function(str){return str.replace(/-(.)/g,function(m,l){return l.toUpperCase();});},cutHexHash:function(h){return(h.charAt(0)=="#")?h.substring(1,7):h;},hexToR:function(h){return parseInt(Jelo.Format.cutHexHash(h).substring(0,2),16);},hexToG:function(h){return parseInt(Jelo.Format.cutHexHash(h).substring(2,4),16);},hexToB:function(h){return parseInt(Jelo.Format.cutHexHash(h).substring(4,6),16);},hexToRGB:function(h){var r=this.hexToR(h);var g=this.hexToG(h);var b=this.hexToB(h);return[r,g,b];},rgbStringToArray:function(s){if(s.isString){try{var sub=s.split(/\D/g);var sub2=[];for(var i=0;i<sub.length;i++){if(sub[i]){sub2[sub2.length]=parseInt(sub[i],10);}}
return sub2;}catch(e){throw new Error("Jelo.Format.rgbStringToArray: Invalid input "+s);}}else{return[];}},urlDecode:function(s){var r=s;r=r.replace(/\+/g,'%20');r=decodeURIComponent(r);r=r.toString();return r;},urlEncode:function(s){var r=s;r=r.toString();r=encodeURIComponent(r);r=r.replace(/\%20/g,'+');return r;}};}();
Jelo.CSS=function(){var clearOpacity=function(el){if(Jelo.Env.isIE){if(typeof el.style.filter==="string"&&(/alpha/i).test(el.style.filter)){el.style.filter="";}}else{el.style.opacity="";el.style["-moz-opacity"]="";el.style["-khtml-opacity"]="";}};var toCamel=Jelo.Format.hyphenatedToCamelCase;return{clearOpacity:clearOpacity,addClass:function(e,c){var curr=e.className;if(!new RegExp(c,"i").test(curr)){e.className=curr+(curr.length?" ":"")+c;}},hasClass:function(e,c){air.trace("old: ",e.className);return c&&(' '+e.className+' ').indexOf(' '+c+' ')!=-1;},removeClass:function(e,c){e.className=e.className.replace(new RegExp(c+"\s?","i"),"").replace(/^\s?|\s?$/g,"");},getStyle:function(){var view=document.defaultView;return(view&&view.getComputedStyle)?function(el,p){if(!el||!p){return null;}
var v;if(typeof el==="string"){el=document.getElementById(el);}
if(typeof p==="string"){p=p.toLowerCase();}
if(p==="float"){p="cssFloat";}
if(v=el.style[p]){return v.toString();}
if(v=view.getComputedStyle(el,"")[toCamel(p)]){return v.toString();}
return null;}:function(el,p){var v;if(!el||!p){return null;}
if(typeof el==="string"){el=document.getElementById(el);}
if(p==="opacity"){if(typeof el.style.filter=='string'){var m=el.style.filter.match(/alpha\(opacity=(.*)\)/i);if(m){var fv=parseFloat(m[1]);if(!isNaN(fv)){return fv?fv/100:0;}}}
return 1;}
if(p==="float"){p="styleFloat";}
p=toCamel(p);if(v=el.style[p]){return v.toString();}
if(el.currentStyle&&(v=el.currentStyle[p])){return v.toString();}
return null;};}(),setStyle:function(el,p,v){if(typeof el==="string"){el=document.getElementById(el);}
p=toCamel(p);var s=el.style;if(p==="opacity"){if(Jelo.Env.isIE){s.zoom=1;s.filter=(s.filter||'').replace(/alpha\([^\)]*\)/gi,"")+(v==1?"":" alpha(opacity="+v*100+")");}else{s.opacity=parseFloat(v);}}else{s[p]=v;}}};}();Jelo.css=function(){if(arguments.length==2){return Jelo.CSS.getStyle(arguments[0],arguments[1]);}
if(arguments.length==3){return Jelo.CSS.setStyle(arguments[0],arguments[1],arguments[2]);}
throw new Error("Jelo.css: Syntax should be (element, property) for get, and (element, property, value) for set.");};
Jelo.Dom=function(){var cache={},simpleCache={},valueCache={};var nonSpace=/\S/;var trimRe=/^\s+|\s+$/g;var tplRe=/\{(\d+)\}/g;var modeRe=/^(\s?[\/>+~]\s?|\s|$)/;var tagTokenRe=/^(#)?([\w-\*]+)/;var nthRe=/(\d*)n\+?(\d*)/,nthRe2=/\D/;function child(p,index){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==index){return n;}}
n=n.nextSibling;}
return null;}
function next(n){while((n=n.nextSibling)&&n.nodeType!=1){}
return n;}
function prev(n){while((n=n.previousSibling)&&n.nodeType!=1){}
return n;}
function children(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!nonSpace.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}
n=nx;}
return this;}
function byClassName(c,a,v){if(!v){return c;}
var r=[],ri=-1,cn;for(var i=0,ci;ci=c[i];i++){if((' '+ci.className+' ').indexOf(v)!=-1){r[++ri]=ci;}}
return r;}
function attrValue(n,attr){if(!n.tagName&&typeof n.length!="undefined"){n=n[0];}
if(!n){return null;}
if(attr=="for"){return n.htmlFor;}
if(attr=="class"||attr=="className"){return n.className;}
return n.getAttribute(attr)||n[attr];}
function getNodes(ns,mode,tagName){var result=[],ri=-1,cs;if(!ns){return result;}
tagName=tagName||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns];}
if(!mode){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(tagName);for(var j=0,ci;ci=cs[j];j++){result[++ri]=ci;}}}else if(mode=="/"||mode==">"){var utag=tagName.toUpperCase();for(var i=0,ni,cn;ni=ns[i];i++){cn=ni.children||ni.childNodes;for(var j=0,cj;cj=cn[j];j++){if(cj.nodeName==utag||cj.nodeName==tagName||tagName=='*'){result[++ri]=cj;}}}}else if(mode=="+"){var utag=tagName.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}
if(n&&(n.nodeName==utag||n.nodeName==tagName||tagName=='*')){result[++ri]=n;}}}else if(mode=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(tagName=='*'||n.tagName.toLowerCase()!=tagName))){}
if(n){result[++ri]=n;}}}
return result;}
function concat(a,b){if(b.slice){return a.concat(b);}
for(var i=0,l=b.length;i<l;i++){a[a.length]=b[i];}
return a;}
function byTag(cs,tagName){if(cs.tagName||cs==document){cs=[cs];}
if(!tagName){return cs;}
var r=[],ri=-1;tagName=tagName.toLowerCase();for(var i=0,ci;ci=cs[i];i++){if(ci.nodeType==1&&ci.tagName.toLowerCase()==tagName){r[++ri]=ci;}}
return r;}
function byId(cs,attr,id){if(cs.tagName||cs==document){cs=[cs];}
if(!id){return cs;}
var r=[],ri=-1;for(var i=0,ci;ci=cs[i];i++){if(ci&&ci.id==id){r[++ri]=ci;return r;}}
return r;}
function byAttribute(cs,attr,value,op,custom){var r=[],ri=-1,st=custom=="{";var f=Jelo.Dom.operators[op];for(var i=0,ci;ci=cs[i];i++){var a;if(st){a=Jelo.Dom.getStyle(ci,attr);}else if(attr=="class"||attr=="className"){a=ci.className;}else if(attr=="for"){a=ci.htmlFor;}else if(attr=="href"){a=ci.getAttribute("href",2);}else{a=ci.getAttribute(attr);}
if((f&&f(a,value))||(!f&&a)){r[++ri]=ci;}}
return r;}
function byPseudo(cs,name,value){return Jelo.Dom.pseudos[name](cs,value);}
var isIE=window.ActiveXObject?true:false;eval("var batch = 30803;");var key=30803;function nodupIEXml(cs){var d=++key;cs[0].setAttribute("_nodup",d);var r=[cs[0]];for(var i=1,len=cs.length;i<len;i++){var c=cs[i];if(!c.getAttribute("_nodup")!=d){c.setAttribute("_nodup",d);r[r.length]=c;}}
for(var i=0,len=cs.length;i<len;i++){cs[i].removeAttribute("_nodup");}
return r;}
function nodup(cs){if(!cs){return[];}
var len=cs.length,c,i,r=cs,cj,ri=-1;if(!len||typeof cs.nodeType!="undefined"||len==1){return cs;}
if(isIE&&typeof cs[0].selectSingleNode!="undefined"){return nodupIEXml(cs);}
var d=++key;cs[0]._nodup=d;for(i=1;c=cs[i];i++){if(c._nodup!=d){c._nodup=d;}else{r=[];for(var j=0;j<i;j++){r[++ri]=cs[j];}
for(j=i+1;cj=cs[j];j++){if(cj._nodup!=d){cj._nodup=d;r[++ri]=cj;}}
return r;}}
return r;}
function quickDiffIEXml(c1,c2){var d=++key;for(var i=0,len=c1.length;i<len;i++){c1[i].setAttribute("_qdiff",d);}
var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i].getAttribute("_qdiff")!=d){r[r.length]=c2[i];}}
for(var i=0,len=c1.length;i<len;i++){c1[i].removeAttribute("_qdiff");}
return r;}
function quickDiff(c1,c2){var len1=c1.length;if(!len1){return c2;}
if(isIE&&c1[0].selectSingleNode){return quickDiffIEXml(c1,c2);}
var d=++key;for(var i=0;i<len1;i++){c1[i]._qdiff=d;}
var r=[];for(var i=0,len=c2.length;i<len;i++){if(c2[i]._qdiff!=d){r[r.length]=c2[i];}}
return r;}
function quickId(ns,mode,root,id){if(ns==root){var d=root.ownerDocument||root;return d.getElementById(id);}
ns=getNodes(ns,mode,"*");return byId(ns,null,id);}
return{getStyle:function(el,name){return Jelo.CSS.getStyle(el,name);},compile:function(path,type){type=type||"select";var fn=["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];var q=path,mode,lq;var tk=Jelo.Dom.matchers;var tklen=tk.length;var mm;var lmode=q.match(modeRe);if(lmode&&lmode[1]){fn[fn.length]='mode="'+lmode[1].replace(trimRe,"")+'";';q=q.replace(lmode[1],"");}
while(path.substr(0,1)=="/"){path=path.substr(1);}
while(q&&lq!=q){lq=q;var tm=q.match(tagTokenRe);if(type=="select"){if(tm){if(tm[1]=="#"){fn[fn.length]='n = quickId(n, mode, root, "'+tm[2]+'");';}else{fn[fn.length]='n = getNodes(n, mode, "'+tm[2]+'");';}
q=q.replace(tm[0],"");}else if(q.substr(0,1)!='@'){fn[fn.length]='n = getNodes(n, mode, "*");';}}else{if(tm){if(tm[1]=="#"){fn[fn.length]='n = byId(n, null, "'+tm[2]+'");';}else{fn[fn.length]='n = byTag(n, "'+tm[2]+'");';}
q=q.replace(tm[0],"");}}
while(!(mm=q.match(modeRe))){var matched=false;for(var j=0;j<tklen;j++){var t=tk[j];var m=q.match(t.re);if(m){fn[fn.length]=t.select.replace(tplRe,function(x,i){return m[i];});q=q.replace(m[0],"");matched=true;break;}}
if(!matched){throw'Error parsing selector, parsing failed at "'+q+'"';}}
if(mm[1]){fn[fn.length]='mode="'+mm[1].replace(trimRe,"")+'";';q=q.replace(mm[1],"");}}
fn[fn.length]="return nodup(n);\n}";eval(fn.join(""));return f;},select:function(path,root,type){if(!root||root==document){root=document;}
if(typeof root=="string"){root=document.getElementById(root);}
var paths=path.split(",");var results=[];for(var i=0,len=paths.length;i<len;i++){var p=paths[i].replace(trimRe,"");if(!cache[p]){cache[p]=Jelo.Dom.compile(p);if(!cache[p]){throw p+" is not a valid selector";}}
var result=cache[p](root);if(result&&result!=document){results=results.concat(result);}}
if(paths.length>1){return nodup(results);}
return results;},selectNode:function(path,root){return Jelo.Dom.select(path,root)[0];},selectValue:function(path,root,defaultValue){path=path.replace(trimRe,"");if(!valueCache[path]){valueCache[path]=Jelo.Dom.compile(path,"select");}
var n=valueCache[path](root);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return((v===null||v===undefined||v==='')?defaultValue:v);},selectNumber:function(path,root,defaultValue){var v=Jelo.Dom.selectValue(path,root,defaultValue||0);return parseFloat(v);},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el);}
var isArray=Jelo.Valid.isArray(el);var result=Jelo.Dom.filter(isArray?el:[el],ss);return isArray?(result.length==el.length):(result.length>0);},filter:function(els,ss,nonMatches){ss=ss.replace(trimRe,"");if(!simpleCache[ss]){simpleCache[ss]=Jelo.Dom.compile(ss,"simple");}
var result=simpleCache[ss](els);return nonMatches?quickDiff(result,els):result;},matchers:[{re:/^\.([\w-]+)/,select:'n = byClassName(n, null, " {1} ");'},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:'n = byPseudo(n, "{1}", "{2}");'},{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'},{re:/^#([\w-]+)/,select:'n = byId(n, null, "{1}");'},{re:/^@([\w-]+)/,select:'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'}],operators:{"=":function(a,v){return a==v;},"!=":function(a,v){return a!=v;},"^=":function(a,v){return a&&a.substr(0,v.length)==v;},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v;},"*=":function(a,v){return a&&a.indexOf(v)!==-1;},"%=":function(a,v){return(a%v)==0;},"|=":function(a,v){return a&&(a==v||a.substr(0,v.length+1)==v+'-');},"~=":function(a,v){return a&&(' '+a+' ').indexOf(' '+v+' ')!=-1;}},pseudos:{"first-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1){}
if(!n){r[++ri]=ci;}}
return r;},"last-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1);if(!n){r[++ri]=ci;}}
return r;},"nth-child":function(c,a){var r=[],ri=-1;var m=nthRe.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!nthRe2.test(a)&&"n+"+a||a);var f=(m[1]||1)-0,l=m[2]-0;for(var i=0,n;n=c[i];i++){var pn=n.parentNode;if(batch!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j;}}
pn._batch=batch;}
if(f==1){if(l==0||n.nodeIndex==l){r[++ri]=n;}}else if((n.nodeIndex+l)%f==0){r[++ri]=n;}}
return r;},"only-child":function(c){var r=[],ri=-1;;for(var i=0,ci;ci=c[i];i++){if(!prev(ci)&&!next(ci)){r[++ri]=ci;}}
return r;},"empty":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,empty=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){empty=false;break;}}
if(empty){r[++ri]=ci;}}
return r;},"contains":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if((ci.textContent||ci.innerText||'').indexOf(v)!=-1){r[++ri]=ci;}}
return r;},"nodeValue":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[++ri]=ci;}}
return r;},"checked":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[++ri]=ci;}}
return r;},"not":function(c,ss){return Jelo.Dom.filter(c,ss,true);},"any":function(c,selectors){var ss=selectors.split('|');var r=[],ri=-1,s;for(var i=0,ci;ci=c[i];i++){for(var j=0;s=ss[j];j++){if(Jelo.Dom.is(ci,s)){r[++ri]=ci;break;}}}
return r;},"odd":function(c){return this["nth-child"](c,"odd");},"even":function(c){return this["nth-child"](c,"even");},"nth":function(c,a){return c[a-1]||[];},"first":function(c){return c[0]||[];},"last":function(c){return c[c.length-1]||[];},"has":function(c,ss){var s=Jelo.Dom.select;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[++ri]=ci;}}
return r;},"next":function(c,ss){var is=Jelo.Dom.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=next(ci);if(n&&is(n,ss)){r[++ri]=ci;}}
return r;},"prev":function(c,ss){var is=Jelo.Dom.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=prev(ci);if(n&&is(n,ss)){r[++ri]=ci;}}
return r;}}};}();if(typeof window.$=="undefined"){window.$=Jelo.Dom.selectNode;}
if(typeof window.$$=="undefined"){window.$$=Jelo.Dom.select;}
Jelo.Event=function(){var isDomReady=false;var domFunctions=[];var fireDomReady=function(){isDomReady=true;for(var i=0;i<domFunctions.length;i++){var fn=domFunctions[i];try{fn();}catch(e){}}
domFunctions=[];};var init=function(){if(document.addEventListener){document.addEventListener("DOMContentLoaded",fireDomReady,false);}else if(Jelo.Env.isIE&&document.getElementById){document.write("<script id='ieDomReady' defer "+"src=//:><\/script>");var ieReady=document.getElementById("ieDomReady");ieReady.onreadystatechange=function(){if(ieReady.readyState==="complete"){fireDomReady();}};}
if(Jelo.Env.isWebkit){var timerDomReady=setInterval(function(){if(/loaded|complete/i.test(document.readyState)){fireDomReady.call(this);clearInterval(timerDomReady);}},10);}else{var oldOnload=(typeof window.onload=="function")?window.onload:function(){};window.onload=function(){oldOnload();fireDomReady();};}}();var handlers=[];return{onReady:function(fn){if(typeof fn==="function"){if(isDomReady){fn();}else{domFunctions.push(fn);}}},add:function(el,ev,fn){if(!!el&&ev.isString&&!!fn){var handler=function(event){event=event||window.event;target=event.target?event.target:event.srcElement;if(target.nodeType===3){target=target.parentNode;}
event.preventDefault=event.preventDefault||function(){this.returnValue=false;};event.stopPropagation=event.stopPropagation||function(){this.cancelBubble=true;};fn.call(target,target,event);};if(el.addEventListener){el.addEventListener(ev,handler,false);}else if(el.attachEvent){el.attachEvent("on"+ev,handler);}else{throw("Jelo.Event.add: Could not observe "+ev+" on "+el);}
var newEvent={target:el,event:ev,handler:handler,fn:fn};handlers.push(newEvent);}else{throw("Syntax Error. Jelo.Event.add(DOMElement, Event:String, Function");}},remove:function(el,ev,fn){if(!!el&&ev.isString&&!!fn){for(var i=0;i<handlers.length;i++){var jeh=handlers[i];var ml=el===jeh.target;var mv=ev===jeh.event;var mf=fn===jeh.fn;if(ml&&mv&&mf){if(el.removeEventListener){el.removeEventListener(ev,jeh.handler,false);}else if(el.detachEvent){el.detachEvent("on"+ev,jeh.handler);}else{throw("Jelo.Event.remove: Could not remove "+ev+" from "+el);}
handlers.splice(i,1);break;}}}else{throw("Syntax Error. Jelo.Event.remove(DOMElement, Event:String, Function");}}};}();Jelo.on=Jelo.Event.add;Jelo.un=Jelo.Event.remove;Jelo.onReady=Jelo.Event.onReady;
Jelo.Ajax=function(){var Status={OK:200,Created:201,Accepted:202,NoContent:204,BadRequest:400,Forbidden:403,NotFound:404,Gone:410,ServerError:500};var cache={};var getFromCache=function(url,callback,config){var r=cache[url]||false;if(r){var h={status:Status.OK,readyState:4,responseText:r};if(callback.isFunction){callback.apply(h,[h,config]);}
return true;}
return false;};var http=function(){try{return new XMLHttpRequest();}catch(e){}
try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){}
try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}
return null;}();return{isBusy:function(){return((http.readyState!==0)&&(http.readyState!==4));},jdomp:function(){var config=arguments[0]||false;if(!config||!config.url){return;}
var cache=config.cache||false;var now=new Date().getTime();var params=config.params||null;var url=config.url;url+=(cache)?"?jdompCache=true":"?jdompCache="+now;for(var p in params){if(params.hasOwnProperty(p)){url+="&"+escape(p)+"="+escape(params[p]);}}
var h=document.getElementsByTagName("head")[0]||false;var e=document.getElementById("script-jdomp")||false;if(e){h.removeChild(e);}
var s=document.createElement("script");s.id="script-jdomp";s.type="text/javascript";s.src=url;var alreadyExists=false;if(cache){s.id+="-"+config.url.replace(/[^a-z]/gi,"");alreadyExists=document.getElementById(s.id)||false;if(alreadyExists){h.removeChild(alreadyExists);}}
h.appendChild(s);if(typeof config.callback==="function"){var c=document.createElement("script");c.type="text/javascript";c.id=s.id+"-callback";c.text="new "+config.callback;alreadyExists=document.getElementById(c.id)||false;if(alreadyExists){h.removeChild(alreadyExists);}
h.appendChild(c);}},request:function(){var config=arguments[0]||{};if(!config||!config.url){throw new Error("Jelo.Ajax.request: Required configuration option missing: url");}
if(!http){throw new Error("Jelo.Ajax.request: XMLHttpRequest not supported.");}
var u=config.url;var p=config.params||config.data||{};var pStr="";var f=config.fromCache||false;var s=config.store||false;var m=config.method||"GET";var cs=config.success||false;var cf=config.failure||false;var cc=config.callback||false;var a=(config.args&&config.args.isArray)?config.args:[];var e=(/\?/).test(u);m=m.toUpperCase();if((m!=="GET")&&(m!=="POST")&&(m!=="PUT")&&(m!=="DELETE")){throw new Error("Jelo.Ajax.request: Method must be one of GET, POST, PUT, DELETE");}
for(var param in p){if(p.hasOwnProperty(param)){pStr+=(pStr.indexOf('?')!==-1?'&':'?')+Jelo.Format.urlEncode(param)
+"="+Jelo.Format.urlEncode(p[param]);}}
if(f){var inCache=getFromCache(u,c,config);if(!!inCache){return;}}
var uCache=u+pStr;pStr+=(pStr.indexOf('?')!==-1?'&':'?')+'_nocache='+new Date().getTime();if((http.readyState!==0)&&(http.readyState!==4)){http.abort();}
http.onreadystatechange=function(){if(http.readyState!==4){return;}
if(http.status===Status.OK){if(s){cache[uCache]=http.responseText;}
if(cs.isFunction){cs.apply(http,[http,config]);}}else{if(cf.isFunction){cf.apply(http,[http,config]);}}
if(cc.isFunction){cc.apply(http,[http,config]);}};switch(m){case"GET":http.open(m,u+pStr,true);http.setRequestHeader("User-Agent","Jelo.Ajax.request() http://arguments.callee.info/");http.send(null);break;case"POST":var query=pStr.split("?",2)[1];http.open(m,(m==="POST")?u:u+pStr,true);http.setRequestHeader("User-Agent","Jelo.Ajax.request() http://arguments.callee.info/");http.setRequestHeader("Content-type","application/x-www-form-urlencoded");http.setRequestHeader("Content-length",query.length);http.setRequestHeader("Connection","close");http.send(query);break;default:throw new Error("Jelo.Ajax.request(): Method "+m+" not yet implemented.");}}};}();
Jelo.Anim=function(){var _={defaultDuration:0.5,tasks:[],removeQueue:[],now:function(){return new Date().getTime();},timer:null,interval:10};var Strategies=function(){var percentComplete=function(){var delta=this.endTime-this.startTime;var ratio=1-((this.endTime-_.now())/delta);var p=this.easing(ratio);return Math.round(p*1000)/1000;};return{Border:function(){},Color:function(){var p=percentComplete.call(this);var f=this.startVal;var t=this.endVal;f=(f.substring(0,3)==="rgb")?Jelo.Format.rgbStringToArray(f):Jelo.Format.hexToRGB(f);t=(t.substring(0,3)==="rgb")?Jelo.Format.rgbStringToArray(t):Jelo.Format.hexToRGB(t);var v=[];for(var i=0;i<3;i++){var delta=Math.floor(t[i]-f[i]);var current=Math.floor(p*delta);v[i]=current+f[i];}
v="rgb("+v[0]+","+v[1]+","+v[2]+")";Jelo.CSS.setStyle(this.element,this.property,v);},ComboPx:function(){switch(this.property){case"backgroundPosition":var rx=/[0-9]{1,3}px [0-9]{1,3}px/;if(rx.test(this.startVal)&&rx.test(this.endVal)){var getVal=function(val,index){return val.split(" ")[index].replace(/[^0-9]/g,"");};var p=percentComplete.call(this);var x=[getVal(this.startVal,0),getVal(this.endVal,0)];var y=[getVal(this.startVal,1),getVal(this.endVal,1)];var deltaValue=[parseInt(x[1],10)-parseInt(x[0],10),parseInt(y[1],10)-parseInt(y[0],10)];var currDelta=[Math.floor(p*deltaValue[0]),Math.floor(p*deltaValue[1])];var v=[currDelta[0]+parseInt(x[0],10),currDelta[1]+parseInt(y[0],10)];Jelo.CSS.setStyle(this.element,this.property,v[0]+"px "+v[1]+"px");}
break;default:var rx=/[0-9]{1,3}px [0-9]{1,3}px [0-9]{1,3}px [0-9]{1,3}px/;if(rx.test(this.startVal)&&rx.test(this.endVal)){var getVal=function(val,index){return val.split(" ")[index].replace(/[^0-9]/g,"");};var p=percentComplete.call(this);var top=[getVal(this.startVal,0),getVal(this.endVal,0)];var right=[getVal(this.startVal,1),getVal(this.endVal,1)];var bottom=[getVal(this.startVal,2),getVal(this.endVal,2)];var left=[getVal(this.startVal,3),getVal(this.endVal,3)];var deltaValue=[parseInt(top[1],10)-parseInt(top[0],10),parseInt(right[1],10)-parseInt(right[0],10),parseInt(bottom[1],10)-parseInt(bottom[0],10),parseInt(left[1],10)-parseInt(left[0],10)];var currDelta=[];for(var i in[0,1,2,3]){currDelta[i]=Math.floor(p*deltaValue[i]);}
var v=[currDelta[0]+parseInt(top[0],10),currDelta[1]+parseInt(right[0],10),currDelta[2]+parseInt(bottom[0],10),currDelta[3]+parseInt(left[0],10)];Jelo.CSS.setStyle(this.element,this.property,v[0]+"px "+v[1]+"px "+v[2]+"px "+v[3]+"px");}}},Numerical:function(){var p=percentComplete.call(this);var deltaValue=parseFloat(this.endVal,10)-parseFloat(this.startVal,10);var currDelta=p*deltaValue;var v=currDelta+parseFloat(this.startVal,10);switch(this.property){case"opacity":v=parseFloat(v);if(v<0){v=0;}
if(v>1){v=1;}
break;case"zIndex":v=parseInt(v,10);break;}
Jelo.CSS.setStyle(this.element,this.property,v);},NumericalPx:function(){var p=percentComplete.call(this);var deltaValue=parseInt(this.endVal,10)-parseInt(this.startVal,10);var currDelta=Math.floor(p*deltaValue);var v=currDelta+parseInt(this.startVal,10);Jelo.CSS.setStyle(this.element,this.property,v+"px");}};}();var Easing={IN:function(x){return Math.pow(x,3);},LINEAR:function(x){return x;},OUT:function(x){return 1-Math.pow(1-x,3);},SPRING:function(x){return 1-(Math.cos(x*4.5*Math.PI)*Math.exp(-x*6));},OVERSHOOT:function(x){var s=1.70158;return(x-=1)*x*((s+1)*x+s)+1;},SMOOTH:function(x){return x<0.5?2*x*x:-2*Math.pow(x-1,2)+1;},WOBBLE:function(x){return(-Math.cos(3*x*Math.PI)/2)+.5;}};var animate=function(config){if(!config){return;}
var m=config.me||false;if(!m){throw new Error('Jelo.Anim.ate() Missing required configuration option me:HTMLElement|String');}else if(m.isArray){m=m[0];}else if(typeof m==="string"){m=Jelo.Dom.selectNode(m);}
if(!m){throw new Error('Jelo.Anim.ate() Missing required configuration option me:HTMLElement|String');}
var css=config.css||false;if(!css||(typeof css!=="string")){throw new Error('Jelo.Anim.ate() Missing required configuration option css:String');}
var c=Jelo.Format.hyphenatedToCamelCase(css);var f=config.from;if(!f&&typeof f!=="number"){f=Jelo.CSS.getStyle(m,c);if(!f&&typeof f!=="number"){f=Jelo.CSS.getStyle(m,css);}
if(!f&&typeof f!=="number"){throw new Error("Jelo.Anim.ate("+m.tagName+c+") Cannot detect starting value, please supply configuration option from:String|Number");}}
if(f==="auto"){throw new Error("Jelo.Anim.ate("+m.tagName+c+") Starting value 'auto' detected, please supply configuration option from:String|Number");}
var t=config.to;if(!t&&typeof t!=="number"){throw new Error('Jelo.Anim.ate() Missing required configuration option to:String|Number');}
var b=(typeof config.before==="function")?config.before:Jelo.emptyFn;var a=(typeof config.after==="function")?config.after:Jelo.emptyFn;var d=parseFloat(config.duration);if(isNaN(d)){d=_.defaultDuration;}
d=Math.floor(Math.abs(d*1000));var e=config.easing||Jelo.Anim.Easing.LINEAR;if((typeof e==="string")&&e.length){e=Jelo.Anim.Easing[e.toUpperCase()]||Jelo.Anim.Easing.LINEAR;}
for(var i=0;i<_.tasks.length;i++){var ti=_.tasks[i];if((ti.element==m)&&(ti.property==c)){_.tasks.splice(i,1);break;}}
var animFn=function(c){switch(c){case"border":case"borderBottom":case"borderLeft":case"borderRight":case"borderTop":return Strategies.Border;case"backgroundColor":case"color":return Strategies.Color;case"backgroundPosition":case"margin":case"padding":return Strategies.ComboPx;case"opacity":case"zIndex":return Strategies.Numerical;case"backgroundPositionX":case"backgroundPositionY":case"bottom":case"height":case"left":case"marginBottom":case"marginLeft":case"marginRight":case"marginTop":case"paddingBottom":case"paddingLeft":case"paddingRight":case"paddingTop":case"right":case"top":case"width":return Strategies.NumericalPx;default:return Jelo.emptyFn;}}(c);var animObj={element:m,property:c,callback:a,startTime:_.now(),endTime:_.now()+d,startVal:f,endVal:t,fn:animFn,easing:e};_.tasks.push(animObj);if((c==="opacity")&&!f){if(Jelo.CSS.getStyle(m,"display")==="none"){m.style.display="block";}
if(Jelo.CSS.getStyle(m,"visibility")==="hidden"){m.style.visibility="visible";}}
b.call(animObj);run();};var run=function(){if(!_.timer){_.timer=setInterval(function(){if(_.removeQueue.length){var callbacks=[];for(var i=_.removeQueue.length-1;i>=0;i--){var ri=_.removeQueue[i];var ti=_.tasks[ri];var v=null;switch(ti.fn){case Strategies.Border:v=ti.endVal;break;case Strategies.ComboPx:v=ti.endVal;break;case Strategies.Color:v="#"+ti.endVal.replace(/#/,"");break;case Strategies.NumericalPx:v=parseFloat(ti.endVal)+"px";break;case Strategies.Numerical:v=ti.endVal;break;default:v=ti.endVal;}
Jelo.CSS.setStyle(ti.element,ti.property,v);callbacks.push(ti);_.tasks.splice(ri,1);}
_.removeQueue=[];for(var i=0;i<callbacks.length;i++){var ti=callbacks[i];ti.callback.call(ti);}}
if(_.tasks.length){for(var i=0;i<_.tasks.length;i++){var t=_.tasks[i];if(_.now()<t.endTime){t.fn.call(t);}else{_.removeQueue.push(i);}}}},_.interval);}};return{Easing:Easing,ate:animate,stopAll:function(){_.removeQueue=[];_.tasks=[];if(_.timer){clearTimeout(_.timer);_.timer=null;}}};}();
