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 !');}};window.$lang=function(k){var k1=String(k),k2=k1.toLower();return(JSIR.Lang&&(k2 in JSIR.Lang))?JSIR.Lang[k2]:k1.replace('_',' ').capitalize();};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=(typeof args!='undefined')?!(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;},empty:function(){return!(this.length>0);},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]=String(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&&('scrollTop'in documentElement))
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];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+this.getScroll()[1])+'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(el.nodeType==1&&['object','embed'].contains(el.tagName.toLower()))return el;JSIR.Util.extend(el,JSIR.Element.Extends);el.htmlElement=_F_;return el;};JSIR.Element.Extends={parent:function(tag){var el=this;if(!tag)return $(el.parentNode);do{if(el&&el.nodeName&&el.nodeName.toUpper()==tag.toUpper()){return $(el);}
el=el.parentNode;}while(el);return false;},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.split(/\s+/).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+=(this.className.empty()?'':' ')+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;},setInner:function(v){switch(this.nodeName.toLower()){case'select':for(var i=0,l=this.options.length;i<l;i++)if(this.options[i].value==v){this.options[i].selected=true;break;};break;case'input':if(['checkbox','radio'].contains(this.type)){if(this.value==v)this.checked=true;break;}
case'textarea':default:this.value=v;}
return this;},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;},removeChildNodes:function(){while(this.childNodes.length>0)this.removeChild(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){ev=ev||window.event;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);};var tmpIsEnable;var attchRemoveEvent=function(){if(isEnable()){if(!tmpIsEnable){tmpIsEnable=true;for(var e in documentEventFunc)JSIR.Events.add(document,e,documentEventFunc[e]);}}else{for(var e in documentEventFunc)JSIR.Events.remove(document,e,documentEventFunc[e]);tmpIsEnable=false;}}
self.offset={x:0,y:0};var documentEventFunc={'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();}},'mouseup':function(ev){if(self.status=='idle'&&!active)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';},'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();}};__('util').extend(JSIR.Dragables,JSIR.Class.Event);self.addEvent('onAdd',attchRemoveEvent);self.addEvent('onDestroy',attchRemoveEvent);};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));this.fireEvent('onAdd');};JSIR.Dragables.destroy=function(obj){var i=this.objects.indexOf(obj);if(i!=-1){obj.removeAttribute('dragid');this.objects[i]=null;}
this.fireEvent('onDestroy');};JSIR.Dragables.destroyAll=function(){this.objects.each(function(obj){obj.removeAttribute('dragid');}).clear();this.fireEvent('onDestroy');};JSIR.Util.extend(Array.prototype,{rgbToHex:function(array){if(this.length<3)return false;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);}
return array?hex:'#'+hex.join('');},hexToRgb:function(array){if(this.length!=3)return false;var rgb=[];for(var i=0;i<3;i++){rgb.push(parseInt((this[i].length==1)?this[i]+this[i]:this[i],16));}
return array?rgb:'rgb('+rgb.join(',')+')';},rgbToHsb:function(){var red=this[0],green=this[1],blue=this[2];var hue,saturation,brightness;var max=Math.max(red,green,blue),min=Math.min(red,green,blue);var delta=max-min;brightness=max/255;saturation=(max!=0)?delta/max:0;if(saturation==0){hue=0;}else{var rr=(max-red)/delta;var gr=(max-green)/delta;var br=(max-blue)/delta;if(red==max)hue=br-gr;else if(green==max)hue=2+rr-br;else hue=4+gr-rr;hue/=6;if(hue<0)hue++;}
return[Math.round(hue*360),Math.round(saturation*100),Math.round(brightness*100)];},hsbToRgb:function(){var br=Math.round(this[2]/100*255);if(this[1]==0){return[br,br,br];}else{var hue=this[0]%360;var f=hue%60;var p=Math.round((this[2]*(100-this[1]))/10000*255);var q=Math.round((this[2]*(6000-this[1]*f))/600000*255);var t=Math.round((this[2]*(6000-this[1]*(60-f)))/600000*255);switch(Math.floor(hue/60)){case 0:return[br,t,p];case 1:return[q,br,p];case 2:return[p,br,t];case 3:return[p,q,br];case 4:return[t,p,br];case 5:return[br,p,q];}}
return false;},copy:function(start,length){start=start||0;if(start<0)start=this.length+start;length=length||(this.length-start);var newArray=[];for(var i=0;i<length;i++)newArray[i]=this[start++];return newArray;}});JSIR.Util.extend(String.prototype,{rgbToHex:function(array){var rgb=this.match(/\d{1,3}/g);return(rgb)?rgb.rgbToHex(array):false;},hexToRgb:function(array){var hex=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(hex)?hex.slice(1).hexToRgb(array):false;}});JSIR.Plugins.Color=JSIR.Class.create({construct:function(color,type){type=type||(color.push?'rgb':'hex');var rgb,hsb;switch(type){case'rgb':rgb=color;hsb=rgb.rgbToHsb();break;case'hsb':rgb=color.hsbToRgb();hsb=color;break;default:rgb=color.hexToRgb(true);hsb=rgb.rgbToHsb();}
rgb.hsb=hsb;rgb.hex=rgb.rgbToHex();return JSIR.Util.extend(rgb,JSIR.Plugins.Color.prototype);},mix:function(){var colors=$A(arguments);var alpha=(JSIR.Util.gettype(colors[colors.length-1])=='number')?colors.pop():50;var rgb=this.copy();colors.each(function(color){color=new JSIR.Plugins.Color(color);for(var i=0;i<3;i++)rgb[i]=Math.round((rgb[i]/100*(100-alpha))+(color[i]/100*alpha));});return new JSIR.Plugins.Color(rgb,'rgb');},invert:function(){return new JSIR.Plugins.Color(this.map(function(value){return 255-value;}));},setHue:function(value){return new JSIR.Plugins.Color([value,this.hsb[1],this.hsb[2]],'hsb');},setSaturation:function(percent){return new JSIR.Plugins.Color([this.hsb[0],percent,this.hsb[2]],'hsb');},setBrightness:function(percent){return new JSIR.Plugins.Color([this.hsb[0],this.hsb[1],percent],'hsb');}});JSIR.Plugins.form=JSIR.Class.create({construct:function(form){this.form=(typeof form=='string')?$(form):form;},updateFields:function(params){for(var n in params)this.updateField(n,params[n]);},updateField:function(n,v){var f=this.form[n];if(!f)return;if(!f.length){$(f).setInner(v);}else{if(f[0].nodeName=='OPTION'){$(f[0].parentNode).setInner(v);}else for(var i=0;i<f.length;i++)$(f[i]).setInner(v);}
return f;},toSerialize:function(){return this.form.toSerialize();},toQueryString:function(){return this.form.toQueryString();}});JSIR.FX=JSIR.Class.extend(JSIR.Effect.Base,{construct:function(el,prop,to,options){this.el=$(el);this.prop=JSIR.Element.Util.safeCss(prop);var f=this.el.getStyle(prop),px='px',c;switch(this.prop){case'color':case'backgroundColor':case'borderColor':with(f)f=match(/\d{1,3}/g)?rgbToHex():f;if(!__('util').issetPlugin('color'))return alert('Color plugin not loaded');c=function(p){var color=new JSIR.Plugins.Color(f).mix(to,p*100);this.el.setStyle(this.prop,color.rgbToHex());};break;case'opacity':case'alpha':if(f.indexOf('.')!=-1)f=f*100;to=(to<=1)?to*100:to;f=f.toInt();c=function(p){var t2=f+((to-f)*p);this.el.alpha(t2);};break;default:f=f.toInt();c=function(p){var t2=f+((to-f)*p);this.el.setStyle(this.prop,t2+px);};}
this.parent(options);this.addEvent('onUpdate',c.bind(this)).start(0,1);}});JSIR.Plugins.Jdate=new Object();JSIR.Plugins.Jdate.gMonthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);JSIR.Plugins.Jdate.jMonthDays=new Array(31,31,31,31,31,31,30,30,30,30,30,29);JSIR.Util.extend(JSIR.Plugins.Jdate,{mod:function(a,b){return Math.floor(a/b);},g2J:function(g){var gy,gm,gd;var jy,jm,jd;var g_day_no,j_day_no;var j_np;var i;gy=g[0]-1600;gm=g[1]-1;gd=g[2]-1;g_day_no=365*gy+this.mod((gy+3),4)-this.mod((gy+99),100)+this.mod((gy+399),400);for(i=0;i<gm;++i)
g_day_no+=this.gMonthDays[i];if(gm>1&&((gy%4==0&&gy%100!=0)||(gy%400==0)))++g_day_no;g_day_no+=gd;j_day_no=g_day_no-79;j_np=this.mod(j_day_no,12053);j_day_no%=12053;jy=979+33*j_np+4*this.mod(j_day_no,1461);j_day_no%=1461;if(j_day_no>=366){jy+=this.mod((j_day_no-1),365);j_day_no=(j_day_no-1)%365;}
for(i=0;i<11&&j_day_no>=this.jMonthDays[i];++i){j_day_no-=this.jMonthDays[i];}
jm=i+1;jd=j_day_no+1;return new Array(jy,jm,jd);},j2G:function(j){var gy,gm,gd;var jy,jm,jd;var g_day_no,j_day_no;var leap;var i;jy=j[0]-979;jm=j[1]-1;jd=j[2]-1;j_day_no=365*jy+this.mod(jy,33)*8+this.mod((jy%33+3),4);for(i=0;i<jm;++i)
j_day_no+=this.jMonthDays[i];j_day_no+=jd;g_day_no=j_day_no+79;gy=1600+400*this.mod(g_day_no,146097);g_day_no=g_day_no%146097;leap=1;if(g_day_no>=36525)
{g_day_no--;gy+=100*this.mod(g_day_no,36524);g_day_no=g_day_no%36524;if(g_day_no>=365)
g_day_no++;else
leap=0;}
gy+=4*this.mod(g_day_no,1461);g_day_no%=1461;if(g_day_no>=366){leap=0;g_day_no--;gy+=this.mod(g_day_no,365);g_day_no=g_day_no%365;}
for(i=0;g_day_no>=this.gMonthDays[i]+(i==1&&leap);i++)
g_day_no-=this.gMonthDays[i]+(i==1&&leap);gm=i+1;gd=g_day_no+1;return new Array(gy,gm,gd);},jLeap:function(year){return((((((year-((year>0)?474:473))%2820)+474)+38)*682)%2816)<682;},gLeap:function(year){return((year%4)==0)&&(!(((year%100)==0)&&((year%400)!=0)));}});JSIR.Plugins.Png=function(root){if(!JSIR.Browser.ie6)return;var s=new Image;s.src=(window.host||'')+'images/s.gif';JSIR.Dom.getByTag('img',root).each(function(img){with(img){if(!/\.png$/.test(src))return;style.width=offsetWidth+"px";style.height=offsetHeight+"px";style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='scale')";src=s.src;}});};var Shadows=function(){var p=[];var markup=JSIR.Browser.ie?'<div class="x-ie-shadow"></div>':'<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';return{pull:function(){var sh=p.shift();if(!sh)sh=$($(':div').setHTML(markup).firstChild).append();return sh;},push:function(sh){p.push(sh);}};}();JSIR.Plugins.Shadow=function(config){for(var c in config)this[c]=config[c];if(typeof this.mode!="string"){this.mode=this.defaultMode;}
var o=this.offset,rad=Math.floor(this.offset/2),a={h:0};switch(this.mode.toLowerCase()){case"drop":a.w=0;a.l=a.t=o;a.t-=1;if(JSIR.Browser.ie){a.l-=this.offset+rad;a.t-=this.offset+rad;a.w-=rad;a.h-=rad;a.t+=1;}
break;case"sides":a.w=(o*2);a.l=-o;a.t=o-1;if(JSIR.Browser.ie){a.l-=(this.offset-rad);a.t-=this.offset+rad;a.l+=1;a.w-=(this.offset-rad)*2;a.w-=rad+1;a.h-=1;}
break;case"frame":a.w=a.h=(o*2);a.l=a.t=-o;a.t+=1;a.h-=2;if(JSIR.Browser.ie){a.l-=(this.offset-rad);a.t-=(this.offset-rad);a.l+=1;a.w-=(this.offset+rad+1);a.h-=(this.offset+rad);a.h+=1;}
break;};this.adjusts=a;};JSIR.Plugins.Shadow.prototype={offset:4,defaultMode:"drop",show:function(target,loc){if(!this.el){this.el=Shadows.pull();if(this.el.next()!=target.dom)this.el.iBefore(target);}
var z=(this.zIndex||target.style.zIndex.toInt());this.el.style.zIndex=(z>0?z-1:-1);if(JSIR.Browser.ie){this.el.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=60) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";}
this.realign(loc?loc.x:target.style.left.toInt(),loc?loc.y:target.style.top.toInt(),target.offsetWidth,target.offsetHeight);this.el.style.display="block";return this;},realign:function(l,t,w,h){if(!this.el)return;var a=this.adjusts,d=this.el,s=d.style;var iea=0;s.left=(l+a.l)+"px";s.top=(t+a.t)+"px";var sw=(w+a.w),sh=(h+a.h),sws=sw+"px",shs=sh+"px";if(s.width!=sws||s.height!=shs){s.width=sws;s.height=shs;if(!JSIR.Browser.ie){var cn=d.childNodes;var sww=Math.max(0,(sw-12))+"px";cn[0].childNodes[1].style.width=sww;cn[1].childNodes[1].style.width=sww;cn[2].childNodes[1].style.width=sww;cn[1].style.height=Math.max(0,(sh-12))+"px";}}},hide:function(){if(this.el){this.el.style.display="none";Shadows.push(this.el);delete this.el;}},destroy:function(){if(this.el){this.el.remove();delete this.el;}else this.destroy.delay(10,this);},setZIndex:function(z){this.zIndex=z;if(this.el)this.el.setStyle({"z-index":z});}};JSIR.Plugins.Tabs=JSIR.Class.create({options:{dir:'ltr'},construct:function(el,options){this.setOptions(options);this.el=$(el);this.current=null;this.tabs=[];},init:function(){if(!this.tabsCon){this.tabsCon=$(':div').append(this.el).addClass('tabs '+this.options.dir);this.tabsUL=$(':ul').append(this.tabsCon);this.tabsLay=$(':div').append(this.el).addClass('panel_wrapper');}},add:function(title,html){this.init();var tab_id=this.tabs.length;var cn=(is_element(html)?html:$(':div').append(this.tabsLay).setHTML(html)).addClass('panel');var li=$(':li').setAttr('_tab',tab_id).setAttr('title',title);li.append(this.tabsUL).setHTML('<span>'+title+'</span>')
.addEvent('mouseover',function(){li.addClass('hover');}).addEvent('mouseout',function(){li.removeClass('hover');}).addEvent('click',this.active.bind(this,li));this.tabs.push({'id':tab_id,'li':li,'content':cn});return this;},active:function(li){var cn,i=li.addClass('active').getAttr('_tab');this.tabs.each(function(t){if(t.id==i){cn=t.content;return true;}
t.content.removeClass('current');t.li.removeClass('active');});cn.addClass('current');if(this.current!=null&&this.current!=i)this.fireEvent('onSelect',this.tabs[i]);this.current=i;return cn;},next:function(){if(this.current+1<this.tabs.length){this.active(this.tabs[this.current+1].li);}else this.fireEvent('onEnd');},back:function(){if(this.current>0){this.active(this.tabs[this.current-1].li);}else this.fireEvent('onFirst');},touch:function(i){if(!i.between(0,this.tabs.length))return;return this.active(this.tabs[i].li);},render:function(){var items=JSIR.Dom.getByTag('div',this.el);this.init();items.each(function(c){if(c.parentNode!=this.el)return;this.add($(c).append(this.tabsLay).title,c);c.removeAttribute('title');},this);this.active.delay(100,this,this.tabs[0].li);this.fireEvent('onRender');}},JSIR.Class.Options,JSIR.Class.Event);JSIR.Plugins.Tooltip=JSIR.Class.create({options:{onShow:function(tip){tip.show(true);},onHide:function(tip){tip.hide(true);},showDelay:100,hideDelay:100,className:'tool',offsets:{'x':16,'y':16},fixed:true},construct:function(options){this.setOptions(options);this.actions=[this.onStart];this.toolTip=$(':div').addClass('tool-tip '+this.options.className+'-tip')
.setStyle({'position':'absolute'}).hide(true).append();this.wrapper=$(':div').addClass('tip-wrapper').append(this.toolTip);},build:function(el,action){if(is_array(el))el.each(function(elm){this._build(elm,action);},this);else this._build(el,action);},_build:function(el,func){if(el.title){el.$text=el.title;el.removeAttribute('title');}else el.$text=false;if(func){this.actions.push(func);el.setAttribute('_tool_act',this.actions.length-1);}
el.addEvent('mouseover',function(event){this.start(el);if(!this.options.fixed)this.locate(event);else this.position(el);}.bind(this));if(!this.options.fixed)el.addEvent('mousemove',this.locate.bind(this,null,true));el.addEvent('mouseout',this.end.bind(this));},start:function(el){var act=el.getAttribute('_tool_act');if(act==null||!this.actions[act])act=0;this.actions[act].bind(this)(el);clearTimeout(this.timer);this.timer=this.show.delay(this.options.showDelay,this);},onStart:function(el){this.wrapper.setHTML('');if(el.$text){$(':span').append($(':div').addClass(this.options.className+'-text').append(this.wrapper)).setHTML(el.$tmp.myText);}},end:function(event){clearTimeout(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this);},position:function(element){var pos=element.getPosition();this.toolTip.setStyle({'left':pos.x+this.options.offsets.x+'px','top':pos.y+this.options.offsets.y+'px'});},locate:function(event){var evn=new JSIR.Event(event);var wpt=JSIR.Dom.getViewport();var win={'x':wpt[0],'y':wpt[1]};var scroll={'x':document.body.scrollLeft,'y':document.body.scrollTop};var tip={'x':this.toolTip.offsetWidth,'y':this.toolTip.offsetHeight};var prop={'x':'left','y':'top'};for(var z in prop){var pos=evn.pointer[z]+this.options.offsets[z];if((pos+tip[z]-scroll[z])>win[z])pos=evn.pointer[z]-this.options.offsets[z]-tip[z];if(prop[z]=='left')this.toolTip.setStyle({left:pos+'px'});else this.toolTip.setStyle({top:pos+'px'});};},show:function(){if(this.options.timeout)this.timer=this.hide.delay(this.options.timeout,this);this.fireEvent('onShow',[this.toolTip]);},hide:function(){this.fireEvent('onHide',[this.toolTip]);}},JSIR.Class.Event,JSIR.Class.Options);JSIR.Plugins.AjaxUpload=function(){var Instance=new Array();return{add:function(el,options){var id=Instance.length;Instance.push(new ajaxUpload(el,__('util').merge({params:{'uploadid':id}},options||{})));},finish:function(id){var arg=$A(arguments).slice(1);Instance[id].finish.bind(Instance[id],arg)();}};}();var ajaxUpload=JSIR.Class.create({options:{action:null,downOptions:{active:false,icon:'images/down.png',preview:false,previewUrl:'',url:''},params:{}},construct:function(el,options){this.setOptions(options);this.elm=$(el).addEvent('change',this.upload.bind(this));this.options.params['name']=el.name.replace(/\[\]$/,'');if(this.options.downOptions.active){var dl=$(':a',{'href':this.options.downOptions.url,'target':'_blank'})
.setHTML('<img src="'+this.options.downOptions.icon+'" align=absmiddle alt=download border=0 />')
.iAfter(el);if(this.options.downOptions.preview){var tip=new JSIR.Plugins.Tooltip({fixed:false});tip.build(dl,function(el){tip.wrapper.setHTML('<img src="'+this.options.downOptions.previewUrl+'" />');}.bind(this));}}},upload:function(){var form,target,action;form=$(':form',{'method':"post",'enctype':"multipart/form-data"}).append(this.elm.parent()).iAfter(this.elm);action=this.options.action;action+=(action.indexOf('?')!=-1?'&':'?')+__('util').toQuery(this.options.params);this.elm.append(form);this.progress=$progress(null,{lang:{'LOADING':'Uploading...'}});target='frame_'+__('util').time();$(':iframe',{'src':"about:blank",'name':target}).hide().append();form.setAttr('action',action).setAttr('target',target).submit();this.form=form;},finish:function(status,name){this.progress.close();this.elm.iBefore(this.form);if(!status){$alert('Uploading error...');return false;}
if(!this.hidden){this.hidden=$(':input',{'type':'hidden','name':this.elm.name}).append(this.elm.parent()).iAfter(this.elm);}
this.hidden.value=name;this.form.remove();}},JSIR.Class.Options);window.$alert=function(text,onclose,options){var w=__('p:windows').message('alert',text,options);w.element.getElement('.win-button input.ok').hoverSetClass('win-btn-over').addEvent('click',function(){(onclose||_F_)();this.close();}.bind(w));return w;};window.$progress=function(onclose,options){return __('p:windows').message('progress',null,options).addEvent('onClose',function(){(onclose||_F_)();});};window.$prompt=function(text,onaccept,oncancel,options){var w=__('p:windows').message('prompt',text,options).addEvent('onClose',function(){(oncancel||_F_)();});var i=w.element.getElement('.win-button input.text');if(options&&options.inputDir){i.style.direction=options.inputDir;delete options.inputDir;}
w.element.getElement('.win-button input.ok').hoverSetClass('win-btn-over').addEvent('click',function(){(onaccept||_F_)(i.value);this.close();}.bind(w));return w;};window.$confirm=function(text,onaccept,oncancel,options){var closed=false,w=__('p:windows').message('confirm',text,options).addEvent('onClose',function(){if(!closed)(oncancel||_F_)();});w.element.getElement('.win-button input.yes').hoverSetClass('win-btn-over').addEvent('click',function(){closed=true;(onaccept||_F_)();this.close();}.bind(w));w.element.getElement('.win-button input.no').hoverSetClass('win-btn-over').addEvent('click',function(){closed=true;(oncancel||_F_)();this.close();}.bind(w));return w;};JSIR.Plugins.Windows=function(){var zIndex=1000;var instance=[];var template='<table win:id="[wid]" class="win-[direction]" border=0 cellpadding="0" cellspacing="0" onclick="JSIR.Plugins.Windows.focus([wid]);">'+'<tr><td><div class="win-mt win-[direction]">'+'<div class=win-close title="close" onclick="JSIR.Plugins.Windows.close([wid]);" onmouseover="$(this).addClass(\'win-close-over\');" onmouseout="$(this).removeClass(\'win-close-over\');"></div>'+'<div class=win-title>[title]</div>'+'<div class=win-mtl><div class="win-mtc"></div></div>'+'<div class=win-mtr></div>'+'</div></td></tr>'+'<tr><td style="border:1px solid #000;border-width: 0pt 1px;">'+'<div class=win-content dir=[direction]>[html]</div>'+'</td></tr>'+'<tr><td><div class=win-mb>'+'<div class=win-mbl><div class="win-mbc"></div></div>'+'<div class=win-mbr></div>'+'</div></td></tr>'+'</table>';var message_tpl={'alert':'<span>[val]</span><div class="win-button"><input type=button value=[OK] class="win-btn ok" /></div>','confirm':'<span>[val]</span><div class="win-button"><input type=button value=[YES] class="win-btn yes" /><input type=button value=[NO] class="win-btn no" /></div>','prompt':'<span>[val]</span><div class="win-button"><input class=text type=text size=40 /><input class="win-btn ok" type=button value=[OK] /></div>','progress':'<span>[val]</span>'};var b_sh;var b_check=function(){return instance.filter(function(w){return(w&&w.options.backShadow&&w.status=='show');}).length>0;};var b_show=function(){if(b_sh&&b_check())return;if(!b_sh)b_sh=$(':div').setStyle({position:'absolute',left:'0px',top:'0px',zIndex:998,backgroundColor:'#000'}).append();if(JSIR.Browser.ie6)$$('select','iframe').hide(true);var ds=JSIR.Dom.getDocumentSize();b_sh.setStyle({width:ds[0]+'px',height:ds[1]+'px'}).alpha(70).show();};var b_hide=function(){if(!b_sh||b_check())return;if(JSIR.Browser.ie6)$$('select','iframe').show(true);b_sh.hide();};return{get:function(w){return is_object(w)?w:instance[w];},create:function(title,content,options){options=options||{};var z=zIndex,wid=instance.length,html=new JSIR.Template().assign({'wid':String(wid),'title':(title||'&nbsp;'),'html':content,'direction':(options.direction||'rtl')}).fetch(template);options.shadowZindex=z+1;var w=new Window($($(':div').setHTML(html).childNodes[0]).addClass('win-m').setStyle('zIndex',z+2).hide(true).append(),options);if(w.options.backShadow){if(w.options.showOnCreate)b_show();w.addEvent('onShow',b_show);}
w.$id=wid;instance.push(w);zIndex+=2;return w;},message:function(type,content,options){options=options||{};var t=type.toLower(),lang=JSIR.Util.merge({'ALERT':$lang('Alert'),'PROGRESS':$lang('Progress'),'CONFIRM':$lang('Confirm'),'PROMPT':$lang('Prompt'),'LOADING':$lang('Loading')+'...','OK':$lang('Ok'),'YES':$lang('Yes'),'NO':$lang('No')},options.lang||{});delete options.lang;options.closeConfirm=false;options.destroyOnClose=true;options.ghost=false;if(t=='progress')content=lang['LOADING'];content=new JSIR.Template().assign(lang).assign('val',content).fetch('<div class="win-'+t+'">'+message_tpl[t]+'</div>');return this.create(lang[type.toUpper()],content,options);},focus:function(w){var z=zIndex;try{with(this.get(w)){if(options.shadow)shadow.el.style.zIndex=z+1;element.style.zIndex=z+2;}
zIndex+=2;}catch(e){}},close:function(w){w=this.get(w);if(w.options.closeConfirm&&!confirm($lang('close_confirm')))return;if(w.options.destroyOnClose){w.fireEvent('onClose');if(w.options.shadow)w.shadow.destroy();w.element.remove();instance[w.$id]=null;delete w;}else{w.fireEvent('onHide');if(w.options.shadow)w.shadow.hide();w.element.hide(true);w.status='hide';}
b_hide();},closeAll:function(){instance.each(function(w){if(!w)return;w.close();});},find:function(elm){var wid;do{elm=elm.parentNode;if((wid=elm.getAttribute('win:id'))!=null)break;}while(elm.nodeName&&elm.nodeName!='TABLE');return wid?this.get(wid):null;}};}();var Window=JSIR.Class.create({options:{minWidth:200,backShadow:true,shadow:'sides',drag:true,ghost:true,closeConfirm:true,destroyOnClose:true,showOnCreate:true},construct:function(el,options){this.setOptions(options);var o=this.options,self=this,shadow,tmp;with(el){if(offsetWidth<o.minWidth)setStyle('width',o.minWidth+'px');toCenter();}
if(o.shadow)shadow=new JSIR.Plugins.Shadow({mode:o.shadow,offset:5});if(o.drag)JSIR.Dragables.add(el,'.win-mtc',{'start':function(){if(shadow&&!o.ghost)shadow.hide();if(o.ghost){tmp=el;JSIR.Dragables.curElement=$(':div').appendChild($(':div').setStyle({'left':el.style.left,'top':el.style.top,'backgroundColor':'#666','width':tmp.offsetWidth+'px','height':tmp.offsetHeight+'px','opacity':.4})).setStyle({'border':'1px solid #000'}).setAttr('dragid',tmp.getAttr('dragid')).append();}},'end':function(){if(o.ghost){if(tmp&&tmp!=JSIR.Dragables.curElement){with(tmp.style){position='absolute';left=JSIR.Dragables.curElement.style.left.toInt()+'px';top=JSIR.Dragables.curElement.style.top.toInt()+'px';}
JSIR.Dragables.curElement.remove()
JSIR.Dragables.curElement=tmp;tmp=null;}}
if(shadow)shadow.show(el);JSIR.Plugins.Windows.focus(self);}});this.status='idle';this.addEvent('onClose',function(){if(shadow)shadow.destroy();if(o.drag)JSIR.Dragables.destroy(el);});this.addEvent('onChange',function(){if(shadow)shadow.show(el);});this.element=el;this.shadow=shadow;if(o.showOnCreate)this.show();},close:function(){__('p:windows').close(this);},show:function(){if(this.status=='show')return;this.element.show(true);if(this.shadow)this.shadow.show(this.element);this.status='show';this.fireEvent('onShow');},repos:function(){var args=$A(arguments);this.element.setStyle({'left':args[0]+'px','top':(args[1]||0)+'px'});if(this.shadow)this.shadow.show(this.element);}},JSIR.Class.Options,JSIR.Class.Event);
