/* MCW Framework
 * released under the terms of the GNU Public License.
 * see the GPL for details.
 *
 * @package: javascript
 * @version: 1.0.1
 */
window.JSIR=new Object();JSIR['Version']='1.0';JSIR['Plugins']=new Object();var _A_=navigator.userAgent.toLowerCase();var _F_=function(){};var _B_=new Object();window.__=function(n){try{n=n.replace('p:','plugins.');return eval('JSIR.'+n.replace(/\b([a-z])/ig,function(B,C){return C.toUpperCase();}));}catch(e){alert('JsIr: '+n+' not found !');}};JSIR.Browser={safari:/webkit/.test(_A_),opera:!!window.opera,ie:!!window.ActiveXObject,mozilla:/mozilla/.test(_A_)&&!/(compatible|webkit)/.test(_A_),xpath:!!document.evaluate};if(JSIR.Browser.ie)JSIR.Browser[window.XMLHttpRequest?'ie7':'ie6']=true;JSIR.Util=new Object();JSIR.Util.gettype=function(obj){if(!obj&&obj!==0&&obj!=='')return'null';if(obj.htmlElement)return'element';var type=typeof obj;if(['object','function'].contains(type)){if(obj.nodeName&&obj.nodeType==1)return'element';if(obj.constructor==Array)return'array';}
return type;};JSIR.Util.merge=function(){var r={},a,m,p;for(var i=0;i<arguments.length;i++){for(p in arguments[i]){a=arguments[i][p];m=r[p];r[p]=(m&&is_object(a)&&is_object(m))?JSIR.Util.merge(m,a):a;}}
return r;};JSIR.Util.extend=function(dest,src){for(var property in src)
if(src.constructor.prototype[property]!==src[property]){dest[property]=(src[property]instanceof Array)?JSIR.Util.clone(src[property]):src[property];}
return dest;};JSIR.Util.clone=function(obj){return JSIR.Util.extend(is_array(obj)?[]:{},obj);};JSIR.Util.batch=function(method,scope,args,ev){return function(e){var param=args?!(args instanceof Array)?[args]:args:[];if(ev)param=[e||window.event].concat(param);else param=param.merge(arguments);return method.apply(scope||window,param);};};JSIR.Util.random=function(min,max){return Math.floor(Math.random()*(max-min+1)+min);};JSIR.Util.time=function(){return(new Date()).getTime();};JSIR.Util.clearTimer=function(timer){if(timer){clearTimeout(timer);clearInterval(timer);}
return null;};JSIR.Util.toQuery=function(obj,sep){var o=[];for(var p in obj){if(is_array(obj[p])){obj[p].each(function(v){o.push(p+'[]='+String(v).encodeUrl());});continue;}
o.push(p+'='+String(obj[p]).encodeUrl());}
return o.join(sep||'&');};JSIR.Util.globalEval=function(scr){(window.execScript)?execScript(scr):setTimeout(scr,0);};JSIR.Util.evalScript=function(txt){var script,scripts=[];var regexp=/<script[^>]*>([\s\S]*?)<\/script>/gi;while((script=regexp.exec(txt)))scripts.push(script[1]);scripts=scripts.join('\n');if(scripts)JSIR.Util.globalEval(scripts);};JSIR.Util.issetPlugin=function(name){for(var p in JSIR.Plugins){if(p==name.capitalize())return true;}};JSIR.Class=new Object();JSIR.Class.create=function(prop){prop=prop||{};var klass=function(){if(arguments[0]===null)return this;if(prop.construct&&is_function(prop.construct))
return prop.construct.apply(this,arguments);return this;};klass.prototype=prop;var imps=$A(arguments).slice(1);if(imps.length>0){for(var i=0;i<imps.length;i++)JSIR.Util.extend(klass.prototype,imps[i]);}
return klass;};JSIR.Class.extend=function(klass,prop){var nk=new klass(null);for(var p in prop)nk[p]=function(p,c){switch(JSIR.Util.gettype(c)){case'function':var fn=function(){this.parent=arguments.callee.parent;return c.apply(this,arguments);};fn.parent=p;return fn;case'object':return JSIR.Util.merge(p,c);}
return c;}(nk[p],prop[p]);return JSIR.Class.create(nk);};JSIR.Class.Options={setOptions:function(options){var o=JSIR.Util.clone(this.options);this.options=JSIR.Util.merge(o,options||{});if(this.addEvent)
for(var opt in this.options)if(/on[A-Z]/.test(opt))this.addEvent(opt,this.options[opt]);return this;}};JSIR.Class.Event={addEvent:function(type,func){this.eventList=this.eventList||{};this.eventList[type]=this.eventList[type]||[];this.eventList[type].push(func||_F_);return this;},fireEvent:function(type,args){if(this.eventList&&this.eventList[type]){for(var i=0,l=this.eventList[type].length;i<l;i++)this.eventList[type][i].bind(this,args)();}
return this;}};JSIR.Util.extend(Function.prototype,{bind:function(bind,args,evt){return JSIR.Util.batch(this,bind,args,!!evt);},delay:function(delay,bind,args){return setTimeout(JSIR.Util.batch(this,bind,args),delay);},period:function(interval,bind,args){return setInterval(JSIR.Util.batch(this,bind,args),interval);}});JSIR.Util.extend(Array.prototype,{each:function(fn,bind){try{for(var i=0,l=this.length;i<l;i++)
if(JSIR.Util.batch(fn,bind,[this[i],i])()==_B_)break;}catch(e){}
return this;},filter:function(fn,bind){var results=[];for(var i=0,j=this.length;i<j;i++){if(fn.call(bind,this[i],i,this))results.push(this[i]);}
return results;},remove:function(item){var i=0,len=this.length;while(i<len){if(this[i]===item){this.splice(i,1);len--;}else i++;}
return this;},map:function(fn,bind){var results=[];for(var i=0,j=this.length;i<j;i++)results[i]=fn.call(bind,this[i],i,this);return results;},merge:function(array,noOnce){for(var i=0,l=array.length;i<l;i++){if(!noOnce&&this.contains(array[i]))continue;this.push(array[i]);}
return this;},indexOf:function(item,from){var len=this.length;for(var i=(from<0)?Math.max(0,len+from):from||0;i<len;i++){if(this[i]===item)return i;}
return-1;},contains:function(item,from){return this.indexOf(item,from)!=-1;},toArray:function(){return[].concat(this);},flatten:function(once){var r=[];for(var i=0,l=this.length;i<l;i++){if(is_array(this[i]))r.merge(this[i].flatten(),!once);else r.push(this[i]);}
return r;},fill:function(c,f){for(var i=0;i<c;i++)this.push(f?f(i):i);return this;},first:function(){return this.length>0?this[0]:null;},end:function(){return this.length>0?this[this.length-1]:null;},clear:function(){this.length=0;return this;}});JSIR.Util.extend(String.prototype,{trim:function(){return this.replace(/^ *(.*?) *$/,'$1');},toInt:function(){var n=parseInt(this,10);return isNaN(n)?0:n;},toUpper:function(){return this.toUpperCase();},toLower:function(){return this.toLowerCase();},empty:function(){return this.trim().length<1;},capitalize:function(){return this.replace(/\b[a-z]/g,function(match){return match.toUpperCase();});},decodeUrl:function(){return decodeURIComponent(this);},encodeUrl:function(){return encodeURIComponent(this);}});JSIR.Util.extend(Number.prototype,{between:function(a,b){return(this>=a&&this<=b);},toInt:function(){var n=parseInt(this,10);return isNaN(n)?0:n;}});function $A(arg){for(var i=0,r=[],l=arg.length;i<l;i++)r.push(arg[i]);return r;}
['null','object','number','string','array','function','element'].each(function(t){window['is_'+t]=function(obj){return JSIR.Util.gettype(obj)==t;}});JSIR.Ajax=function(){var r,s,o;r=function(){if(JSIR.Browser.ie)return new ActiveXObject('Microsoft.XMLHTTP');else if(window.XMLHttpRequest)return new XMLHttpRequest();return null;};s=function(tsp,done,error){if(tsp.readyState!=4)return;if(tsp.status>=200&&tsp.status<300){done();}else error();tsp.onreadystatechange=_F_;};o=function(options){return JSIR.Util.merge({'done':_F_,'error':_F_,'async':true,'method':'post','output':'text','timeout':-1,'update':null,'evalscript':false},options||{});};return{get:function(url,options){JSIR.Ajax.post(url,null,JSIR.Util.merge(options||{},{'method':'get'}));},post:function(url,data,options){var tsp=r(),timer,opt=o(options),m=opt.method.toUpper(),gs=['.rnd='+JSIR.Util.time()];if(opt.timeout>0)timer=(function(){tsp.abort();tsp.onreadystatechange=_F_;tsp=r();}).delay(opt.timeout*1000);if(data){if(is_object(data))data=JSIR.Util.toQuery(data);if(m=='GET'){gs.push(data);data=null;}}
url+=(url.indexOf('?')!==-1?'&':'?')+gs.join('&');var done=function(){timer=JSIR.Util.clearTimer(timer);var rs=tsp.responseText;if(tsp.getResponseHeader('Content-Type').match('javascript')){JSIR.Util.globalEval(rs);opt.done.delay(100,null,rs);}else switch(opt.output){case'xml':return opt.done(tsp.responseXML);case'json':return opt.done(eval('('+rs+')'));case'text':default:if(opt.update)$(opt.update).setHTML(rs);if(opt.evalscript)JSIR.Util.evalScript(rs);return opt.done(rs);}};tsp.open(m,url,opt.async);tsp.onreadystatechange=function(){s(tsp,done,opt.error);};try{if(m=='POST'){if(tsp.overrideMimeType)tsp.setRequestHeader('Connection','close');tsp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');}
tsp.setRequestHeader('X-Requested-With','XMLHttpRequest');tsp.setRequestHeader('Accept','text/javascript, text/html, application/xml, text/xml, */*');}catch(e){}
tsp.send(data);}}}();JSIR.Cookie=new Object();JSIR.Cookie._vars={};new function(){with(document)if(cookie&&cookie!=''){var cookies=cookie.split(';');for(var i=cookies.length-1;i>=0;i--){var c=cookies[i].split('=');JSIR.Cookie._vars[c[0].trim()]=c[1].decodeUrl();}}};JSIR.Cookie.set=function(n,v,expire,path,domain,secure){var direct={expires:0,path:path||'/',domain:domain||''};if(expire){var time=new Date();time.setTime(time.getTime()+(expire*86400000));direct.expires=time.toGMTString();}else delete direct.expires;var result=[n+'='+v.encodeUrl()];for(var param in direct)if(direct[param])result.push(param+'='+direct[param]);document.cookie=result.join('; ')+(secure?'; secure':'');JSIR.Cookie._vars[n]=v;};JSIR.Cookie.get=function(n){return(n in JSIR.Cookie._vars)?JSIR.Cookie._vars[n]:null;};JSIR.Cookie.remove=function(n){JSIR.Cookie.set(n,null,{expires:-1});delete JSIR.Cookie._vars[n];};JSIR.Template=function(ld,rd,ignore){this.ld=ld||'[';this.rd=rd||']';this.ig=!!ignore;this._var={};};JSIR.Template.prototype.assign=function(n,v){if(is_object(n))for(var n2 in n)this._var[n2]=n[n2];else this._var[n]=v;return this;};JSIR.Template.prototype.clear=function(){this._var={};return this;};JSIR.Template.prototype.fetch=function(tpl){if(!tpl||!is_string(tpl))return;var fr=function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,'\\$1');};var ld=this.ld,rd=this.rd,i=this.ig,self=this;return tpl.split(new RegExp(fr(rd),'g')).map(function(p){var reg=new RegExp(fr(ld)+'([a-z0-9-_]+)$','ig');return p.match(reg)?p.replace(reg,self._var[RegExp.$1]||(i?'':ld+RegExp.$1+rd)):p;}).join('');};JSIR.Template.prototype.display=function(tpl,elm){$(elm).setHTML(this.fetch(tpl));};JSIR.Dom=new Object();JSIR.Dom.getByMethod=function(method,tag,root){root=root?root:document.body;var n=[];if(is_array(tag)){for(var i=0,l=tag.length;i<l;i++)n=n.merge($A(root.getElementsByTagName(tag[i])),true);}else{n=$A(root.getElementsByTagName((tag&&is_string(tag))?tag:'*'));}
return method?n.flatten().filter(function(i){return method(i);}):n.flatten();};JSIR.Dom.getByClass=function(klass,root,tag){var method=function(el){return(el.className.indexOf(klass)!=-1);};return JSIR.Dom.getByMethod(method,tag,root);};document.getElementsByClassName=JSIR.Dom.getByClass;JSIR.Dom.getByTag=function(tag,root){return JSIR.Dom.getByMethod(null,tag,root);};JSIR.Dom.getViewport=function(){var r=[self.innerWidth,self.innerHeight],m=document.compatMode;if(m||JSIR.Browser.ie){with(document){r[0]=(m=='CSS1Compat')?documentElement.clientWidth:body.clientWidth;if(!JSIR.Browser.opera)
r[1]=(m=='CSS1Compat')?documentElement.clientHeight:body.clientHeight;}}
return r;};JSIR.Dom.getDocumentSize=function(){var s,vp;with(document)s=[(compatMode!='CSS1Compat')?body.scrollWidth:documentElement.scrollWidth,(compatMode!='CSS1Compat')?body.scrollHeight:documentElement.scrollHeight];vp=JSIR.Dom.getViewport();return[Math.max(s[0],vp[0]),Math.max(s[1],vp[1])];};JSIR.Dom.getScroll=function(){with(document){if(documentElement&&documentElement.scrollTop)
return[documentElement.scrollLeft,documentElement.scrollTop];else
return[body.scrollLeft,body.scrollTop];}};JSIR.Dom.makeCenter=function(el){var v=this.getViewport(),o=[el.offsetWidth,el.offsetHeight];v[1]+=document.body.scrollTop||document.documentElement.scrollTop;var pos={x:Math.max(0,(v[0]/2)-(o[0]/2)),y:Math.max(0,(v[1]/2)-(o[1]/2))};el.setStyle({left:pos.x+'px',top:pos.y+'px'});};JSIR.Element=new Object();JSIR.Element.Util={sibling:function(el,type,c){var result=[],i=0;while(el=el[type]){if(c&&c<=result.length)break;if(el.nodeType==1)result.push(el);}
return result;},safeCss:function(css){return css.replace(/\-(.)/ig,function(B,C){return C.toUpperCase();});},create:function(tagName,attr){var n=document.createElement(tagName.toUpperCase());if(attr)for(var a in attr)n.setAttribute(a,attr[a]);return n;}};JSIR.Element.Util.$=$=function(el,attr){if(!el||el.htmlElement)return el;if([window,document].contains(el))return el;if(typeof el=='string'){if(/^:/.test(el))el=JSIR.Element.Util.create(el.replace(':',''),attr);else el=document.getElementById(el);if(!el)return null;}
if(el.htmlElement)return el;if(['object','embed'].contains(el.tagName.toLowerCase()))return el;JSIR.Util.extend(el,JSIR.Element.Extends);el.htmlElement=_F_;return el;};JSIR.Element.Extends={parent:function(tag){if(tag){var el=this;do{el=el.parentNode;}while(el.nodeName!=tag.toUpper());return el;}
return $(this.parentNode||null);},append:function(r){(r||document.body).appendChild(this);return this;},clone:function(r,c){var n=this.cloneNode(c!==false);if(r)r.appendChild(n);return $(n);},remove:function(){this.parentNode.removeChild(this);},next:function(){return $(JSIR.Element.Util.sibling(this,'nextSibling',1)[0]);},prev:function(){return $(JSIR.Element.Util.sibling(this,'previousSibling',1)[0]);},iTop:function(e){var f=e.firstChild;return f?this.iBefore(f):this.append(e);},iAfter:function(e){var n=$(e).next();n?this.iBefore(n):this.append(e.parentNode);return this;},iBefore:function(e){if(!this.parentNode)this.append(e.parentNode);e.parentNode.insertBefore(this,e);return this;},hasClass:function(cls){return this.className.indexOf(cls)!=-1;},removeClass:function(cls){with(this)className=className.replace(new RegExp(' *'+cls),'');return this;},addClass:function(cls){if(this.hasClass(cls))return this;this.className+=' '+cls;return this;},replaceClass:function(c1,c2){with(this)className=className.replace(c1,' '+c2);return this;},toggleClass:function(c){return this[(this.hasClass(c)?'remove':'add')+'Class'](c);},hoverSetClass:function(cls){var op={};op[cls]=['mouseover','mouseout'];return this.eventClass(op);},eventClass:function(op){for(var cls in op){var e=[op[cls]].flatten();this.addEvent(e[0],this.addClass.bind(this,cls));if(e[1])this.addEvent(e[1],this.removeClass.bind(this,cls));}
return this;},addEvent:function(e,f){var bf=f.bind(this);if(JSIR.Browser.ie){this.$events=this.$events||{};this.$events[e]=this.$events[e]||{'f':[],'bf':[]};this.$events[e]['f'].push(f);this.$events[e]['bf'].push(bf);}
JSIR.Events.add(this,e,bf);return this;},removeEvent:function(e,f){var i,bf;if(JSIR.Browser.ie){this.$events=this.$events||{};this.$events[e]=this.$events[e]||{'f':[],'bf':[]};if((i=this.$events[e]['f'].indexOf(f))==-1)return;bf=this.$events[e]['bf'][i];this.$events[e]['f'].splice(i,1);this.$events[e]['bf'].splice(i,1);}else bf=f.bind(this);JSIR.Events.remove(this,e,bf);return this;},setStyle:function(p,v){if(is_object(p)){for(var p2 in p)this.setStyle(p2,p[p2]);return this;}
p=JSIR.Element.Util.safeCss(p);switch(p){case'float':this.style['cssFloat']=this.style['styleFloat']=v;break;case'opacity':this.style.opacity=v;this.style.filter="alpha(opacity="+Math.round(v*100)+")";break;default:if(document.compatMode||p!="cursor")this.style[p]=v;}
return this;},getStyle:function(p){if(JSIR.Browser.ie)p=JSIR.Element.Util.safeCss(p);var d=document.defaultView;return(d&&d.getComputedStyle)?d.getComputedStyle(this,'').getPropertyValue(p):this.currentStyle[p];},setHTML:function(s,a){this.innerHTML=a?(this.innerHTML||'')+s:s;return this;},getInner:function(){switch(this.nodeName.toLower()){case'select':var values=[];for(var i=0,l=this.options.length;i<l;i++)if(this.options[i].selected){values.push(this.options[i].value);if(!this.multiple)return values[0];};return values;case'input':if(!(this.checked&&['checkbox','radio'].contains(this.type))&&!['hidden','text','password'].contains(this.type))break;case'textarea':return this.value;}
return this.innerHTML||null;},getElements:function(q){var r=new JSIR.Selector.getQuery(q,this);JSIR.Util.extend(r,JSIR.Elements);return r;},getElement:function(q){return $(new JSIR.Selector.getQuery(q,this)[0]);},moveChildTo:function(e){while(this.childNodes.length>0){e.appendChild(this.childNodes[0]);}
return this;},toCenter:function(){JSIR.Dom.makeCenter(this);return this;},toSerialize:function(){var r={};this.getElements('input,select,textarea').each(function(el){var name=el.name,value=$(el).getInner();if(value===null||!name||el.disabled)return;if(name.match('(.+)\\[\\]$')){name=RegExp.$1;if(!r[name])r[name]=new Array();r[name].push(value);}else r[name]=value;});return r;},toQueryString:function(sep){return JSIR.Util.toQuery(this.toSerialize(),sep);},setAttr:function(n,v){this.setAttribute(n,v);return this;},getAttr:function(n){return this.getAttribute(n);},removeAttr:function(n){return this.removeAttribute(n);},getPosition:function(overflown){var el=this,x=0,y=0;do{x+=el.offsetLeft||0;y+=el.offsetTop||0;el=el.offsetParent;}while(el);(overflown||[]).each(function(elm){x-=elm.scrollLeft||0;t-=elm.scrollTop||0;});return{'x':x,'y':y};},show:function(v){var p=v?{'visibility':'visible'}:{'display':'block'};return this.setStyle(p);},hide:function(v){var p=v?{'visibility':'hidden'}:{'display':'none'};return this.setStyle(p);},alpha:function(c){return this.setStyle({opacity:c<=1?c:c/100});}};JSIR.Elements=new Object();JSIR.Elements.execOn=function(method,args){for(var i=0,l=this.length;i<l;i++)JSIR.Element.Extends[method].bind($(this[i]),args)();};new function(){['remove','removeClass','addClass','replaceClass','hoverSetClass','addEvent','removeEvent','setStyle','getStyle','setHTML','alpha','setAttr','removeAttr','show','hide','eventClass'].each
(function(M){eval('JSIR.Elements["'+M+'"] = function(){return this.execOn("'+M+'", $A(arguments));}');});};JSIR.Selector=new Object();JSIR.Selector.Result=[];JSIR.Selector.AttrReg=/^([^=]+)([=~\|\^\$\*]?)=?['"]?([^\]'"]*)['"]?$/;JSIR.Selector.getQuery=function(q,root){JSIR.Selector.Result.clear();if(q.indexOf(',')!=-1){var r=[];q.split(',').each(function(q){JSIR.Selector.Result=[root||document];JSIR.Selector._getQuery(q.trim());r.merge(JSIR.Selector.Result);},this);JSIR.Selector.Result=r;}else{JSIR.Selector.Result=[root||document];JSIR.Selector._getQuery(q);}
return JSIR.Selector.Result;};JSIR.Selector._getQuery=function(query){query=query.split(/\s+/);SPC:for(var z=0,q,l=query.length;z<l;z++){q=query[z].trim();switch(true){case q.indexOf('#')!==-1:var part=q.split('#'),el;if(!(el=$(part[1]))){JSIR.Selector.Result=[];break SPC;}
JSIR.Selector.Result=[el];continue SPC;break;case q.indexOf('.')!==-1:var part=q.split('.'),result=[];if(!part[0])part=[null,part[1]];for(var i=0;i<JSIR.Selector.Result.length;i++){result.merge(JSIR.Dom.getByClass(part[1],JSIR.Selector.Result[i],part[0]));}
break;case!!q.match(/^(\w*)\[([^\]]+)\]$/):var part=[RegExp.$1,RegExp.$2],result=[];for(var i=0;i<JSIR.Selector.Result.length;i++){result.merge(JSIR.Dom.getByMethod(function(el){if(!part[1].match(JSIR.Selector.AttrReg))return false;var a=RegExp.$1,v=RegExp.$3,atr=el.getAttribute(a);if(!atr)return false;switch(RegExp.$2){case'=':return atr==v;case'~':return atr.match(new RegExp('(^|\\s)'+v+'(\\s|$)'));case'|':return atr.match(new RegExp('^'+v+'-?'));case'^':return atr.indexOf(v)==0;case'$':return atr.lastIndexOf(v)==atr.length-v.length;case'*':return atr.indexOf(v)+1;default:false;}},part[0],JSIR.Selector.Result[i]));}
break;default:var result=[];for(var i=0;i<JSIR.Selector.Result.length;i++){result.merge($A(JSIR.Selector.Result[i].getElementsByTagName(q)));}}
JSIR.Selector.Result=result;}};function $$(){var al=arguments.length,at,result=[];at=function(arg){switch(JSIR.Util.gettype(arg)){case'array':return result.merge(arg);case'object':return result.merge($A(arg));case'string':return result.merge(JSIR.Selector.getQuery(arg));case'element':return result.push(arg);}};if(al>1)for(var i=0;i<al;i++)at(arguments[i]);else at(arguments[0]);JSIR.Util.extend(result,JSIR.Elements);return result;};JSIR.Url=new Object();JSIR.Url.getLink=function(path){return $(':a',{'href':path}).href;};JSIR.Url.Hash={'timer':null,'actions':new Object,'content':''};JSIR.Url.enable=function(interval){JSIR.Util.clearTimer(this.Hash['timer']);this.Hash['timer']=this.checkHash.period((interval||100),this);};JSIR.Url.disable=function(){JSIR.Util.clearTimer(this.Hash['timer']);};JSIR.Url.checkHash=function(){with(window.location)
if(hash.empty()&&!this.Hash['content'].empty()){}else if(hash!=this.Hash['content']){this.Hash['content']=hash;var h=hash.replace('#','');for(var a in this.Hash['actions'])if(h.match(new RegExp(a,'i'))){var r=[].fill(this.Hash['actions'][a][1],function(i){return RegExp['$'+(i+1)];});this.Hash['actions'][a][0].delay(50,null,r);break;}}};JSIR.Url.addAction=function(act,func){var r,c=0;while(r=/:([^\/])?/.exec(act)){var s='';c++;switch(r[1]){case'd':s='(\\d+)';break;case's':s='(\\w+)';break;default:c--;}
act=act.replace(r[0],s);}
this.Hash['actions'][act]=[func,c];return this;};JSIR.Event=function(ev){ev=ev||window.event;var b=document.body;this.pointer=(ev.pageX||ev.pageY)?{x:ev.pageX,y:ev.pageY}:{x:ev.clientX+b.scrollLeft-b.clientLeft,y:ev.clientY+b.scrollTop-b.clientTop};this.target=ev.target||ev.srcElement;this.keyCode=ev.keyCode||ev.charCode;this.which=ev.which||ev.button;if(this.target.nodeType==3)this.target=this.target.parentNode;this.event=ev;};JSIR.Event.prototype.stop=function(){JSIR.Events.stop(this.event);};JSIR.Events=new Object();JSIR.Events.domReady={'Status':'idle','Functions':[]};JSIR.Events.ready=JSIR.onReady=function(f){if(JSIR.Events.domReady.Status!='idle')return f();JSIR.Events.domReady.Functions.push(f);};new function(){var callReady=function(){if(JSIR.Events.domReady.Status=='loaded')return;JSIR.Events.domReady.Status='loaded';JSIR.Events.domReady.Functions.each(function(f){try{f();}catch(e){};});};if(document.addEventListener){document.addEventListener("DOMContentLoaded",callReady,null);}else if(JSIR.Browser.ie){document.write("<scr "+"ipt id=__ie_onload defer "+((location.protocol=="https:")?"src='javascript:void(0)'":"src=//0")+"><\/scr "+"ipt>");document.getElementById("__ie_onload").onreadystatechange=function(){if(this.readyState=="complete")callReady();}}
window.onload=callReady;};JSIR.Events.add=function(elm,type,func){if(elm.addEventListener){elm.addEventListener(type,func,false);}else{elm.attachEvent('on'+type,func);}};JSIR.Events.remove=function(elm,type,func){if(elm.removeEventListener){elm.removeEventListener(type,func,false);}else{elm.detachEvent('on'+type,func);}};JSIR.Events.stop=function(ev){if(ev.preventDefault){ev.preventDefault();ev.stopPropagation();}else ev.returnValue=false;};JSIR.Effect=new Object();JSIR.Effect.Base=JSIR.Class.create({options:{transition:function(p){return-(Math.cos(Math.PI*p)-1)/2;},dur:500,fps:50},construct:function(o){this.setOptions(o);},step:function(){var t=JSIR.Util.time(),o=this.options;if(t<this.s+o.dur){var d=o.transition((t-this.s)/o.dur);this.set((this.t-this.f)*d+this.f);}else this.set(this.t).fireEvent('onFinish').stop(true);},set:function(to){this.now=to;return this.fireEvent('onUpdate',this.now);},start:function(from,to){if(this.timer)return this;var o=this.options;this.f=from;this.t=to;this.s=JSIR.Util.time();this.timer=this.step.period(Math.round(1000/o.fps),this);this.fireEvent('onStart');return this;},stop:function(end){if(!this.timer)return this;this.timer=JSIR.Util.clearTimer(this.timer);if(!end)this.fireEvent('onCancel');return this;}},JSIR.Class.Event,JSIR.Class.Options);JSIR.Dragables=new Object();JSIR.Dragables.status='idle';JSIR.Dragables.curElement=null;JSIR.Dragables.objects=[];JSIR.Dragables.handles=[];JSIR.Dragables.events=[];JSIR.Dragables.resetOptions=function(){this.options={skipLeft:false,skipTop:false};};new function(){var active,draging,lastOffset,moved;var self=JSIR.Dragables;var isEnable=function(){return(self.objects.length>0);};self.offset={x:0,y:0};JSIR.Events.add(document,'mousedown',function(ev){var evn=new JSIR.Event(ev);if(!isEnable()||evn.which!=1)return false;var i,check,target=evn.target,objects=self.objects,handles=self.handles;do{if((i=objects.indexOf($(evn.target)))!=-1){var dragid=objects[i].getAttr('dragid');if(handles[dragid]&&!objects[i].getElements(handles[dragid]).contains(target))break;check=true;break;}}while(evn.target=evn.target.parentNode);active=check;if(active){self.curElement=evn.target;evn.stop();}});JSIR.Events.add(document,'mouseup',function(ev){if(self.status=='idle')return;active=draging=false;var elm=self.curElement;if(elm){moved=false;elm.setStyle('zIndex',elm.getAttr('tmpzindex'));self.events[elm.getAttr('dragid')]['end'](ev);}
self.status='idle';});JSIR.Events.add(document,'mousemove',function(ev){if(!active)return;var evn=new JSIR.Event(ev);if(!draging){draging=true;self.resetOptions();var d=self.curElement.getPosition();lastOffset=evn.pointer;with(self.offset){x=evn.pointer.x-d.x;y=evn.pointer.y-d.y;}
self.events[self.curElement.getAttr('dragid')]['start'](ev);if(JSIR.Browser.ie){var ds=JSIR.Dom.getScroll();self.offset.x-=ds[0];self.offset.y-=ds[1];}
self.curElement.setAttr('tmpzindex',self.curElement.getStyle('z-index'));self.curElement.setStyle({'position':'absolute','zIndex':2000});}
if(!self.options.skipLeft&&!self.options.skipTop){if(!moved&&Math.abs(evn.pointer.x-lastOffset.x)<20&&Math.abs(evn.pointer.y-lastOffset.y)<20)
return false;}
moved=true;if(self.curElement){var l=(evn.pointer.x-self.offset.x),t=(evn.pointer.y-self.offset.y);with(self.curElement.style){if(!self.options.skipLeft)left=l+"px";if(!self.options.skipTop)top=t+"px";}
self.events[self.curElement.getAttr('dragid')]['move'](ev);}
self.status='drag';if(navigator.appVersion.indexOf('AppleWebKit')>0)window.scrollBy(0,0);evn.stop();});};JSIR.Dragables.add=function(obj,handle,events){var dragid=this.objects.length;this.handles.push(handle);this.events.push(JSIR.Util.merge({'start':_F_,'move':_F_,'end':_F_},events||{}));this.objects.push($(obj).setAttr('dragid',dragid));};JSIR.Dragables.destroy=function(obj){var i=this.objects.indexOf(obj);if(i!=-1){obj.removeAttribute('dragid');this.objects[i]=null;}};JSIR.Dragables.destroyAll=function(){this.objects.each(function(obj){obj.removeAttribute('dragid');}).clear();};