var SJEL=function(){var pr={cl:{},dbg:null,Pass:function(){}}
var pro={pxs:{"width":0,"height":0,"top":0,"left":0,"bottom":0,"right":0,"marginLeft":0,"marginRight":0,"marginTop":0,"marginBottom":0,"paddingLeft":0,"paddingRight":0,"paddingTop":0,"paddingBottom":0,"lineHeight":0,"fontSize":0,"borderWidth":0},msg:function(_msg){alert("SJEL error: "+_msg);},pxo:function(_e){return(pro.pxs[_e]!=undefined)?true:false;}}
var pu={ie:0,dbg:function(_d){if(pr.dbg!=null)
pr.dbg.innerHTML=_d;},InitDbg:function(){pr.dbg=document.getElementById("debug");},Init:function(){var r=/^.*Microsoft.*$/;if(r.test(navigator.appName))
pu.ie=1;r=/^.*MSIE 6.*$/;var v=navigator.appVersion;if(r.test(v))
pu.ie=6;r=/^.*MSIE 7.*$/;if(r.test(v))
pu.ie=7;r=/^.*MSIE 8.*$/;if(r.test(v))
pu.ie=8;},$:function(_id){el=document.getElementById(_id);if(el!=null)
return el;else{pro.msg("bad id '"+_id+"'");return null;}},$T:function(_e,_t){if(_e!=undefined)
return _e.getElementsByTagName(_t);else
return document.getElementsByTagName(_t);},$A:function(_e,_a,_av,_tn){var e=pu.$T(_e,(_tn!=undefined)?_tn:"*");var e2=new Array();var i=0,ta,idx,a;for(i=0;i<e.length;i++){if(pu.ie&&(_a=="class"))
a=e[i].className;else
a=e[i].getAttribute(_a)
if(a!=null){if((_av!=undefined)||(_av=='')){ta=a.split(' ');idx=pu.InArray(_av,ta);if(idx!=-1)
e2.push(e[i]);}else
e2.push(e[i]);}}
return e2;},GEStyle:function(_e){if(!pu.ie)
return document.defaultView.getComputedStyle(_e,"");else
return _e.currentStyle;},GStyle:function(_e,_s){if((_e.style[_s]!="")&&(_e.style[_s]!=undefined))
return _e.style[_s];else{var es=pu.GEStyle(_e);if((es[_s]!="")&&(es[_s]!=undefined))
return es[_s];}
return 0;},SStyle:function(_e,_s){var es=_e.style,s;for(s in _s){if(es==undefined)
continue;if(pro.pxo(s))
es[s]=parseInt(_s[s])+"px";else if((s=="opacity")&&pu.ie){es.zoom=1;es.filter="alpha(opacity = "+Math.round(100*_s[s])+")";es.opacity=_s[s];}else{es[s]=_s[s];}}},ParseRGB:function(_c){var r=0;var g=0;var b=0;var col=pu.SP(_c,"#fff","str");var m=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.exec(col);if((m!=null)&&(m.length>1)){r=m[1];g=m[2];b=m[3];}else{m=/#(\w{2})(\w{2})(\w{2})/i.exec(col);if((m!=null)&&(m.length>1)){r=parseInt(m[1],16);g=parseInt(m[2],16);b=parseInt(m[3],16);}else{m=/#(\w{1})(\w{1})(\w{1})/i.exec(col);if((m!=null)&&(m.length>1)){r=parseInt(m[1]+m[1],16);g=parseInt(m[2]+m[2],16);b=parseInt(m[3]+m[3],16);}}}
return[r,g,b];},RGBToString:function(_r,_g,_b,_h){if(_h==undefined)
return"rgb("+_r+","+_g+","+_b+")";else{var r=_r.toString(16);var g=_g.toString(16);var b=_b.toString(16);if(r=='0')
r+='0';if(g=='0')
g+='0';if(b=='0')
b+='0';return"#"+r+g+b;}},Color:function(_r,_g,_b){this.r=0;this.g=0;this.b=0;this.Set=function(_r,_g,_b){this.r=pu.SP(_r,0,"num");this.g=pu.SP(_g,0,"num");this.b=pu.SP(_b,0,"num");}
this.Set(_r,_g,_b);this.FromString=function(_c){var c=SJEL.ParseRGB(_c);this.Set(parseInt(c[0]),parseInt(c[1]),parseInt(c[2]));}
this.ToString=function(_h){return SJEL.RGBToString(this.r,this.g,this.b,_h);}},RegisterClass:function(_c,_n){pr.cl[_c]=_n;},New:function(_c){if(pr.cl[_c]!=undefined)
return new pr.cl[_c](pro);else{pro.msg("New: class code '"+_c+"' doesn't exists.");return null;}},ForIn:function(_a,_f,_p1,_p2,_p3){for(i in _a)
if(!_f(_a[i],_p1,_p2,_p3))
break;},ForI:function(_a,_f,_p1,_p2,_p3){var i=0;for(i=0;i<_a.length;i++)
if(!_f(_a[i],_p1,_p2,_p3))
break;},GScrollXY:function(){var x=0;var y=0;if(typeof(window.pageYOffset)=='number'){x=window.pageXOffset;y=window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){x=document.body.scrollLeft;y=document.body.scrollTop;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){x=document.documentElement.scrollLeft;y=document.documentElement.scrollTop;}
return[x,y];},GWindowWH:function(){var w=0;var h=0;if(typeof(window.innerWidth)=='number'){w=window.innerWidth;h=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){w=document.body.clientWidth;h=document.body.clientHeight;}
return[w,h];},Lerp:function(_a,_b,_t){return((1.0-_t)*_a+_t*_b);},EasyIn:function(_a,_b,_t){var c=(1.0-Math.cos(Math.PI/2.0*_t));return((1.0-c)*_a+c*_b);},EasyOut:function(_a,_b,_t){var c=(1.0-Math.cos(Math.PI/2.0*(1.0-_t)));return(c*_a+(1.0-c)*_b);},EasyBoth:function(_a,_b,_t){var c=(1.0-Math.cos(Math.PI*_t))*0.5;return((1.0-c)*_a+c*_b);},CE:function(_e){return document.createElement(_e);},InArray:function(_i,_a){var i=0,f=-1;for(i=0;i<_a.length;i++)
if(_i==_a[i]){f=i;break;}
return f;},AddClass:function(_el,_cl){if(_el!=null)
_el.className+=" "+_cl;},RemoveClass:function(_el,_cl){if(_el==null)return;var ta=_el.className.split(' ');var idx=pu.InArray(_cl,ta);if(idx!=-1){ta.splice(idx,1);_el.className=ta.join(' ');}},SP:function(_p,_d,_t){if(_p==undefined)
_p=_d;if((_t!=undefined)&&(_p!=undefined)){var s="SP: parameter is not a ";switch(_t){case"num":if(typeof(_p)!="number")
pro.msg(s+"number");break;case"str":if(typeof(_p)!="string")
pro.msg(s+"string");break;case"bool":if(typeof(_p)!="boolean")
pro.msg(s+"boolean");break;case"func":if(typeof(_p)!="function")
pro.msg(s+"function");break;}}
return _p;},Timer:function(_f,_d,_s,_o){var id=0;var f=pu.SP(_f,null,"func");var fs=p1=p2=p3=p4=null;var d=pu.SP(_d,0,"num");var s=pu.SP(_s,10,"num");var t=0.0;var tp=0.0;var o=pu.SP(_o,false,"bool");var dt=0.0;var ti=0.0;var r=false;this.Start=function(){if(f==null)
return false;if(id!=0)
this.Stop(true);r=true;t=0.0;if(d!=0)
tp=s/d;if(o)
id=setTimeout(f,s);else
id=setInterval(f,s);}
this.Stop=function(_nc){if(id!=0){if(o)
clearTimeout(id);else
clearInterval(id);id=0;r=false;}
if(fs!=null)
fs(p1,p2,p3,p4);}
this.SetOneShot=function(_o){o=pu.SP(_o,false);}
this.SetDuration=function(_d){d=pu.SP(_d,0,"num");}
this.SetSpeed=function(_s){s=pu.SP(_s,10,"num");}
this.SetFunc=function(_f){f=pu.SP(_f,null,"func");}
this.IsRunning=function(){return r;}
this.OnStop=function(_f,_p1,_p2,_p3,_p4){p1=_p1;p2=_p2;p3=_p3;p4=_p4;fs=pu.SP(_f,null,"func");}
this.GetT=function(){t+=tp;if(t>1.0){t=1.0;this.Stop();}
return t;}
this.GetDt=function(){return dt;}},GetOpacity:function(_v){if(_v<0.0)
_v=0.0;else if(_v>1.0)
_v=1.0;if(!pu.ie)
return{opacity:_v.toString()};else{var op="alpha(opacity = "+Math.round(100*_v)+")";return{filter:op};}},Morph:function(_ifu){var e=null,es=null,st=null,d=1000,ti=new pu.Timer(OnMorph),ft=new Array(),ifu="",c=new pu.Color();if(_ifu!=undefined)
ifu=_ifu;function FT(){this.fr=0;this.to=0;}
function PS(_s,_f){var s=0;if(pro.pxo(_s))
s=parseInt(_f);else{switch(_s){case"backgroundColor":case"color":c.FromString(_f);s=c;break;default:s=_f;}}
return s;}
this.Init=function(_id,_s,_d){if(typeof(_id)=="object")
e=_id;else{var id=pu.SP(_id,"","str");if(id=="")
return;e=SJEL.$(id);}
es=pu.GEStyle(e);st=pu.SP(_s,null);if(st==null)
return;d=pu.SP(_d,500,"num");for(s in st){ft[s]=new FT();ft[s].fr=pu.GStyle(e,s);if(pu.ie&&(ft[s].fr=="auto"))
ft[s].fr=0;ft[s].fr=PS(s,ft[s].fr);ft[s].to=PS(s,st[s]);}}
function Inte(_a,_b,_x,_t){var fu=null;if((_t==undefined)||(_t==""))
fu=pu.Lerp;else if(_t=="lerp")
fu=pu.Lerp;else if(_t=="easyin")
fu=pu.EasyIn;else if(_t=="easyout")
fu=pu.EasyOut;else if(_t=="easyboth")
fu=pu.EasyBoth;return fu(_a,_b,_x)}
function OnMorph(){var t={},tm=ti.GetT();for(f in ft){switch(f){case"backgroundColor":case"color":c.r=Math.round(Inte(ft[f].fr.r,ft[f].to.r,tm,ifu));c.g=Math.round(Inte(ft[f].fr.g,ft[f].to.g,tm,ifu));c.b=Math.round(Inte(ft[f].fr.b,ft[f].to.b,tm,ifu));t[f]=c.ToString();break;case"opacity":t[f]=Inte(ft[f].fr,ft[f].to,tm,ifu);break;default:t[f]=Math.round(Inte(ft[f].fr,ft[f].to,tm,ifu));}}
pu.SStyle(e,t);}
this.Morph=function(){if(ti.IsRunning())
ti.Stop();if(st==null)
return;ti.SetDuration(d);ti.Start();}
this.OnMorphFinished=function(_f,_p1,_p2,_p3,_p4){var f=pu.SP(_f,null,"func");ti.OnStop(f,_p1,_p2,_p3,_p4);}}}
return pu;}();SJEL.Init();