var AI={BASEPATH:'/js/ai/',GLOBALS:{},i18n:{},l10n:function(k){if(typeof AI.i18n[k]=='string'){return AI.i18n[k];}return k;},title:function(){var def='';return{get:function(){return document.title;},set:function(t){if(typeof t=='string'&&t!='undefined'){document.title=t;}},reset:function(){AI.title.set(def);},init:function(){def=AI.title.get();}};}(),alertOn:true,alert:function(T){if(AI.alertOn){AI.alertOn=window.confirm(T);}},setAlert:function(S){AI.alertOn=S;},requireDatas:{},requireDatasId:0,require:function(U,F,C,A){var src=U.charAt(0)==="/"||U.substr(0,5)=="http:"||U.substr(0,6)=="https:"?U:AI.BASEPATH+U,id='AIrequiredJS'+(AI.requireDatasId++),e=AI.DOM.createElement("SCRIPT",{id:id,type:"text/javascript",src:src});if(F){AI.requireDatas[id]=[F,C,A];e.onload=e.onreadystatechange=function(E){var w,d=AI.requireDatas[this.id];if(!E&&(w=window.event)&&(w=w.srcElement)&&!/loaded|complete/.test(w.readyState)){return;}d[0].call(d[1]?d[1]:this,d[2]);delete AI.requireDatas[this.id];this.onload=this.onreadystatechange=null;};}(AI.head||(AI.head=AI.DOM.getByTag('head'))).appendChild(e);},getSimilarParentObject:function(O){var i,c,w=window,a=['top','parent','opener'];for(i=0;i<a.length;i++){c=w[a[i]];try{if(c&&c!==w.self&&typeof c!=='undefined'&&c!==null&&c.location&&w.location&&c.location.hostname===w.location.hostname&&c.AI&&typeof c.AI[O]!=='undefined'){return c.AI[O];}}catch(x){}}return false;},isWindowed:function(){return top&&typeof top.isMainWidget!=='undefined'&&top.isMainWidget;}};AI.title.init();var alerter=AI.alert;AI.global=this;AI.requireOLD=function(U,F,C,A){var src=U.charAt(0)==="/"||U.substr(0,5)=="http:"||U.substr(0,6)=="https:"?U:AI.BASEPATH+U,listener=AI.BROWSER.IE?"onreadystatechange":"onload",e=AI.DOM.createElement("SCRIPT",{type:"text/javascript",src:src});AI.console.error('Require:'+U);if(F){e[listener]=function(){if(AI.BROWSER.IE&&!/loaded|complete/.test(window.event.srcElement.readyState)){return;}F.call(C?C:this,A);this[listener]=null;AI.console.warning('EndRequire/'+U+'/'+listener+'/');};}AI.DOM.getByTag('head').appendChild(e);};AI.startingTime=new Date().valueOf();AI.DEPRECATED=function(f){if(AI.console){AI.console.warning('DEPRECATED:'+f);}};AI.isInsideFenetre=AI.isWindowed;AI.fixIESelect=function(){};AI.bench=function(){var H=0,T='',E=0;return{init:function(t){T=t||'';H=new Date().valueOf();},end:function(){E=new Date().valueOf()-H;return E;},setText:function(t){T=t;},getText:function(){return T;},getTime:function(){return E;}};}();
AI.features=function(){var E,T,D=document,F={rgba:false,canvas:false,strict:D.compatMode==='CSS1Compat',quirks:D.compatMode!=='CSS1Compat',SVG:!!(D&&(T=D.implementation)&&typeof T.hasFeature=='function'&&T.hasFeature("http://www.w3.org/TR/SVG11/feature#CoreAttribute",'1.1')),isObjectProperty:function(O,P){var t;if(O&&P in O){t=typeof O[P];return!!(((t==='function'||t==='object')&&O[P])||t==='unknown');}return false;},isGlobalProperty:function(M){var t,o,w=window;if(M in w){o=w[M];t=typeof o;return!!(o&&(t==='function'||t==='object'));}return false;}},IS=F.isObjectProperty;if(IS(D,'createElement')){E=D.createElement('P');T=/^rgba/;if(E&&E.style&&typeof T.test=="function"){try{E.style.color='rgba(1,1,1,0.5)';F.rgba=T.test(E.style.color);}catch(e){}}E=D.createElement('CANVAS');F.canvas=!!(E&&E.getContext&&E.getContext("2d"));}E=T=D=IS=null;F.isGlobalMethod=F.isGlobalProperty;return F;}();
AI.utils={isObjectEmpty:function(O){for(var k in O){if(AI.utils.hasOwnProp(O,k)){return false;}}return true;},getObjectLength:function(O){var r=0;AI.utils.forOwn(O,function(){r++;});return r;},isValidNumber:function(V){return typeof V==='number'&&!isNaN(V);},isValidString:function(V){return typeof V==='string'&&V!=='';},isValidArray:function(V){return typeof V==='object'&&V!==null&&V instanceof Array;},isArray:function(V){return Object.prototype.toString.call(V)==='[object Array]';},isValidObject:function(V){return typeof V==='object'&&V!==null&&!(V instanceof Array);},isValidElement:function(V){return typeof V==='object'&&V!==null||V.nodeType!==document.ELEMENT_NODE;},uniqid:function(P){return(P?P:'')+parseInt(Math.random()*1000,10)+(new Date().valueOf())+parseInt(Math.random()*1000,10);},Cookies:{enabled:function(){var R,d=document,s='AItestcookie=test';d.cookie=s;R=(d.cookie.indexOf(s)!==-1);if(R){d.cookie=s+';expires=Fri,02-Jan-1970 00:00:00 GMT';}AI.utils.Cookies.enabled=R?function(){return true;}:function(){return false;};return R;},set:function(N,V,D){var d=new Date();D=D||30;d.setTime(d.getTime()+(D*24*60*60*1000));document.cookie=N+"="+V+";expires="+d.toGMTString()+";path=/";},get:function(N){var i,c,s=document.cookie.split(';');N+='=';for(i=0;i<s.length;i++){c=s[i];while(c.charAt(0)===' '){c=c.substring(1,c.length);}if(c.indexOf(N)===0){return c.substring(N.length,c.length);}}return null;}},escapeHTML:function(V){function rc(c){switch(c){case "<":return "&lt;";case ">":return "&gt;";case "&":return "&amp;";case "'":return "&#39;";case '"':return "&quot;";}return "?";}return String(V).replace(/[<>&"']/g,rc);},unescapeHTML:function(V){return(''+V).replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<");},forceArray:function(){var a,i,I=arguments.length,j,J,r=[];for(i=0;i<I;i++){a=arguments[i];if(a){J=a.length;if(J&&J>0){for(j=0;j<J;j++){r.push(a[j]);}}else{r.push(a);}}}return r;},hasOwnProp:function(O,P){var fn;if(AI.features.isObjectProperty(O,'hasOwnProperty')){fn=function(o,p){return o.hasOwnProperty(p);};}else{fn=function(o,p){var k=o.constructor.prototype[p];return typeof k=='undefined'||k!==o[p];};}return(AI.utils.hasOwnProp=fn)(O,P);},forOwn:function(O,F,C,A){var k,i=0;AI.utils.forOwnStopped=false;for(k in O){if(AI.utils.forOwnStopped){break;}if(k&&AI.utils.hasOwnProp(O,k)){F.call(C||O,O,k,O[k],i++,A);}}},injectObject:function(S,C){for(var k in S){if(k&&AI.utils.hasOwnProp(S,k)){C[k]=S[k];}}return C;}};AI.utils.DEPRECATED=function(msg,delay){if(AI.console&&AI.console.error){if(delay){msg='(delayé)-'+msg;}AI.console.error(msg);}else{window.setTimeout(function(){AI.utils.DEPRECATED(msg,true);},1000);}};AI.utils.regFeature=/^(object|function|unknown)$/i;AI.utils.isObjectProperty=function(O,P){var t;AI.utils.DEPRECATED('AI.utils.isObjectProperty est DEPRECATED,utiliser AI.features.isObjectProperty');if(O){t=typeof O[P];return!!((t=='object'||t=='function')&&O[P]);}return false;};AI.utils.isMethod=function(M){var o=window[M],t=typeof o;AI.utils.DEPRECATED('AI.utils.isMethod est DEPRECATED,utiliser AI.features.isGlobalProperty');return!!(o&&AI.utils.regFeature.test(t));};AI.utils.areFeatured=function(O){var a,i,l=arguments.length,r=AI.utils.regFeature;AI.utils.DEPRECATED('AI.utils.areFeatured est DEPRECATED,utiliser AI.features.isGlobalProperty ou AI.features.isObjectProperty');O=window[O];if(!O||l<2||typeof O=='undefined'||O===null){return false;}for(i=1;i<l;i++){a=O[arguments[i]];if(!(r.test(typeof a)&&a)){return false;}}return true;};AI.utils.isValid=function(v){var T=typeof v;AI.utils.DEPRECATED('AI.utils.isValid est DEPRECATED,lui préférer une version courte adaptée au contexte');if(T=='string'){return v!=='';}else if(T=='number'){return AI.utils.isValidNumber(v);}else if(T=='boolean'||T=='function'){return true;}else if(T=='object'){return v!==null;}return false;};AI.utils.encoder=function(C,U){var f=encodeURIComponent;AI.utils.DEPRECATED('AI.utils.encoder est DEPRECATED.');if(typeof f=='function'){return U?encodeURI(C):f(C);}return window.escape(C);};AI.utils.decoder=function(C){var f=decodeURIComponent;AI.utils.DEPRECATED('AI.utils.decoder est DEPRECATED.');return typeof f=='function'?f(C):window.unescape(C);};AI.utils.returnTrue=function(){AI.utils.DEPRECATED('AI.utils.returnTrue est DEPRECATED. Lui préférer une version courte.');return true;};AI.utils.returnFalse=function(){AI.utils.DEPRECATED('AI.utils.returnFalse est DEPRECATED. Lui préférer une version courte.');return false;};AI.utils.isEmail=function(M){AI.utils.DEPRECATED('AI.utils.isEmail est DEPRECATED.');return!M.search(/^[\w\-][\w\-\.]+@[\w\-]+\.[a-zA-Z]{2,6}$/);};
AI.consts={INTERNAL_TARGET:'AIcontenu',SHOW_NONE:0,SHOW_LABEL:1,SHOW_ICON:2,SHOW_BOTH:3,BLANK_URL:'/blank.html',BASE_DIR:'http://images.internet-ai.com',BASE_PICTO:'/pictos',BASE_WIDGET:'/widgets',BLANK_IMG:'/blank.gif',SILENT:'SILENT',FRAME:'FRAME',OPAQUE:'OPAQUE',COPIE:'COPIE',TRANSLUCIDE:'TRANSLUCIDE',MINIMIZED:0,MAXIMIZED:1,FIT:1,RESIZE:2,POS_SAVE:1,POS_REMOVE:2,DRAG_WAIT:1,DRAG_LISTEN:2,DRAG_MOVE:3,HORIZONTAL:0,VERTICAL:1,WINDOW_CONTENEUR_BUTTONS:'100px',TEXT_BR:'[BR]',DATE_FORMAT_FR:'d/m/Y',DATE_FORMAT_US:'m/d/Y',DATE_FORMAT:'d/m/Y'};var CR="\n";(function(){var i,m,d=document,t=['ELEMENT_NODE','ATTRIBUTE_NODE','TEXT_NODE','CDATA_SECTION_NODE','ENTITY_REFERENCE_NODE','ENTITY_NODE','PROCESSING_INSTRUCTION_NODE','COMMENT_NODE','DOCUMENT_NODE','DOCUMENT_TYPE_NODE','DOCUMENT_FRAGMENT_NODE','DOCUMENT_NOTATION_MODE'];for(i=0,m=t.length;i<m;i++){if(typeof d[t[i]]=='undefined'||d[t[i]]===null){d[t[i]]=1+i;}}}());AI.consts.UNDEF=0;AI.consts.LOADING=1;AI.consts.LOADED=2;AI.consts.ERR=3;
AI.config=function(){var O=AI.getSimilarParentObject('config');if(O){return O;}O={WINDOW_MOVE:AI.consts.FRAME,WINDOW_MOVE_ANIMATED:false,WINDOW_MAXIMIZE_ANIMATED:false,WINDOW_RESIZE:AI.consts.FRAME,WINDOW_RESIZE_ANIMATED:false,BUREAU_MOVE:AI.consts.OPAQUE,MENU_CLOSE_TIME:5000,BUREAU_FOND_POSITION:'top_left',BUREAU_FOND_REPEAT:true,BUREAU_FOND_COULEUR:'white',BUREAU_FOND_COULEUR_CUSTOM:'',BUREAU_FOND_URL:'',BUTTON_BUREAU_COULEUR:'#000000',BUTTON_BUREAU_SHADOW:'#FFFFFF',BUTTON_BUREAU_CLICK_OPEN:'double',BUTTON_BUREAU_MODIFIER:'CTRL',icons32:[]};if(typeof AICONFIG!=='undefined'){AI.utils.forOwn(AICONFIG,function(o,k,v){this[k]=v;},O);}return O;}();
if(![].indexOf){Array.prototype.indexOf=function(S,F){var i,m=this.length;if(!F){F=0;}else if(F<0){F=Math.max(0,this.length+F);}for(i=F;i<m;i++){if(this[i]===S){return i;}}return-1;};}if(![].lastIndexOf){Array.prototype.lastIndexOf=function(S,F){var i;if(!F){F=this.length-1;}else{if(F<0){F=this.length+F;}if(F<0){F=-1;}else if(F>=this.length){F=this.length-1;}}for(i=F;i>=0;i--){if(this[i]===S){return i;}}return-1;};}if(![].forEach){Array.prototype.forEach=function(F,C){var i,m=this.length;for(i=0;i<m;i++){if(i in this){F.call(C,this[i],i,this);}}};}if(!Array.prototype.forEachObject){Array.prototype.forEachObject=function(F){var i,m=this.length;for(i=0;i<m;i++){if(i in this){F.call(this[i],this,i);}}};}if(![].filter){Array.prototype.filter=function(F,C){var i,r=[],m=this.length;for(i=0;i<m;i++){if((i in this)&&F.call(C,this[i],i,this)){r.push(this[i]);}}return r;};}if(![].map){Array.prototype.map=function(F,C){var i,r=[],m=this.length;for(i=0;i<m;i++){r.push(F.call(C,this[i],i,this));}return r;};}if(![].some){Array.prototype.some=function(F,C){var i,m=this.length;for(i=0;i<m;i++){if((i in this)&&F.call(C,this[i],i,this)){return true;}}return false;};}if(![].every){Array.prototype.every=function(F,C){var i,m=this.length;for(i=0;i<m;i++){if((i in this)&&!F.call(C,this[i],i,this)){return false;}}return true;};}Array.prototype.contains=function(O){return this.indexOf(O)!=-1;};Array.prototype.insertAt=function(O,I){this.splice(I,0,O);};Array.prototype.insertBefore=function(N,R){var i=this.indexOf(R);if(i==-1){this.push(N);}else{this.splice(i,0,N);}};Array.prototype.insertAfter=function(N,R){var i=this.indexOf(R);if(i==-1||i==(this.length-1)){this.push(N);}else{this.splice(i+1,0,N);}};Array.prototype.removeAt=function(I){return this.splice(I,1);};Array.prototype.remove=function(E){var i=this.indexOf(E);if(i!=-1){return this.removeAt(i);}return null;};Array.prototype.removeAll=function(){return this.splice(0,this.length);};Array.prototype.getLast=function(){if(this.length>0){return this[this.length-1];}return null;};Array.prototype.getFirst=function(){if(this.length>0){return this[0];}return null;};Array.prototype.in_array=Array.prototype.inArray=function(E){return this.indexOf(E)!=-1;};if(!Array.prototype.push){Array.prototype.push=function(){var i,m=arguments.length,b=this.length;for(i=0;i<m;i++){this[b+i]=arguments[i];}return this.length;};}
String.prototype.contains=function(s){return this.indexOf(s)!=-1;};if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};}if(!String.prototype.ltrim){String.prototype.ltrim=function(){return this.replace(/^\s+/,"");};}if(!String.prototype.trim){String.prototype.rtrim=function(){return this.replace(/\s+$/,"");};}String.prototype.add=function(v,S){var a;if(this==v){return this;}else if(this===''){return v;}if(!AI.utils.isValidString(S)){S=",";}a=this.split(S);if(a.indexOf(v)!==-1){return this;}a.push(v);return a.join(S);};String.prototype.remove=function(v,S){var a,p;if(this==v||this===''){return '';}if(!AI.utils.isValidString(S)){S=",";}a=this.split(S);p=a.indexOf(v);if(p==-1){return this;}do{a.splice(p,1);}while((p=a.indexOf(v))!=-1);return a.join(S);};String.prototype.ellipsis=function(M){if(this.length>M&&M>4){return this.substr(0,M-3)+'...';}return this;};AI.camelStr=AI.hyphenStr={};String.toCamel=function(T){var i,m,a,r;if(AI.camelStr[T]){return AI.camelStr[T];}a=T.split("-");m=a.length;if(m==1){return a[0];}r=T.indexOf("-")===0?a[0].charAt(0).toUpperCase()+a[0].substring(1):a[0];for(i=1;i<m;i++){r+=a[i].charAt(0).toUpperCase()+a[i].substring(1);}AI.camelStr[T]=r;AI.hyphenStr[r]=T;return r;};String.toHyphen=function(T){var i,m,r='';if(AI.hyphenStr[T]){return AI.hyphenStr[T];}for(i=0,m=T.length;i<m;++i){if(T.charAt(i)==T.charAt(i).toUpperCase()){r+='-'+T.charAt(i).toLowerCase();}else{r+=T.charAt(i);}}AI.hyphenStr[T]=r;AI.camelStr[r]=T;return r;};String.prototype.toFirstUp=function(){return this.charAt(0).toUpperCase()+this.substr(1);};String.prototype.ellipse=String.prototype.ellipsis;String.prototype.encodeRE=function(){return this.replace(/([.*+?\^${}()|\[\]\/\\])/g,'\\$1');};String.prototype.stripTags=function(){return this.replace(/<\/?[^>]+>/gi,"");};
Number.prototype.limit=function(m,M){if(M!==null&&typeof M=="number"&&this>M){return M;}else if(m!==null&&typeof m=="number"&&this<m){return m;}return+this;};function intval(i){var r=parseInt(i,10)||0;r=isNaN(r)?0:r;return r;}AI.utils.toCurrency=function(S){var r=/^(.*\s)?([\-+\u00A3\u20AC]?\d+)(\d{3}\b)/;S=''+S;return S==(S=S.replace(r,"$1$2 $3"))?S:AI.utils.toCurrency(S);};AI.utils.numberToFixed=(function(){function P(I,S,C){var r=""+I;while(r.length<S){r=C+r;}return r;}function U(N,D){var t,s=""+Math.round(N*Math.pow(10,D)),d,f;if(/\D/.test(s)){return ""+N;}s=P(s,1+D,"0");d=s.substring(0,t=(s.length-D));f=s.substring(t);if(f){f="."+f;}return d+f;}return function(N,D,C){var u=U(Math.abs(N),D);u=(N<0?"-":"")+u;if(C===true){return AI.utils.toCurrency(u);}return Number(u);};})();Number.prototype.inRange=function(m,M){return this>=m&&this<=M;};Number.prototype.betweenRange=function(m,M){return this>m&&this<M;};function floatval(val,D,C){var R,F=parseFloat(val.toString().replace(',','.').replace(/\s/g,''))||0;D=D||2;R=F.toFixed(D);if(C===true){return AI.utils.toCurrency(R);}return Number(R);}
if(!Function.prototype.apply){Function.prototype.apply=function(C,A){var i,m,r,a=[];C=C||window;A=A||[];for(i=0,m=A.length;i<m;i++){a[i]='A['+i+']';}C.$apply=this;r=eval('C.$apply('+a.join(',')+');');delete C.$apply;return r;};}
AI.BROWSER=function(){var V,W=window,D=document,C=D.createElement('canvas'),N=W.navigator,uA=N.userAgent,R={engine:null,version:0,major:0,minor:0,revision:0,build:0,mshtml:false,gecko:false,opera:false,khtml:false,safari3:false,IE:false,IE6:false,IE7:false,strict:D.compatMode==='CSS1Compat',quirks:D.compatMode!=='CSS1Compat',runLocally:W.location.protocol==='file:',SVG:!!D.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#CoreAttribute",'1.1'),canvas:!!C.getContext,VML:false,XPath:!!D.evaluate};/*@cc_on R.IE=true;R.VML=true;if(@_jscript_version==5.6){R.IE6=true;try{D.execCommand("BackgroundImageCache",false,true);}catch(e){}}else if(@_jscript_version==5.7)R.IE7=true;@*/if(W.opera){R.engine='opera';if(/Opera[\s\/]([0-9\.]*)/.test(uA)){V=RegExp.$1;V=V.substring(0,3)+'.'+V.substring(3);}}else if(typeof N.vendor==='string'&&N.vendor==='KDE'){R.engine='khtml';if(/KHTML\/([0-9-\.]*)/.test(uA)){V=RegExp.$1;}}else if(W.controllers&&typeof N.product==='string'&&N.product==='Gecko'){R.engine='gecko';if(/rv\:([^\);]+)(\)|;)/.test(uA)){V=RegExp.$1;}}else if(W.devicePixelRatio&&W.getMatchedCSSRules){R.engine='safari3';V='3';}else if(R.IE){R.engine='mshtml';if(/MSIE\s+([^\);]+)(\)|;)/.test(uA)){V=RegExp.$1;}}if(R.engine){R[R.engine]=true;}if(V){V=V.split('.');R.major=V[0]||0;R.minor=V[1]||0;R.revision=V[2]||0;R.build=V[3]||0;R.version=V;}return R;}();
AI.getElementDocument=function(E){var f;if(E.ownerDocument){f=function(e){return e.ownerDocument;};}else{f=function(e){if(e.parentNode){while(e.parentNode){e=e.parentNode;}}return e.nodeType==9||(!e.nodeType&&!e.tagName)?e:null;};}return(AI.getElementDocument=f)(E);};AI.getDocumentWindow=function(D){var f=function(){return null;};if(D.defaultView){f=function(d){return d.defaultView;};}else if(D.parentWindow){f=function(d){return d.parentWindow;};}return(AI.getDocumentWindow=f)(D);};AI.getElementWindow=function(E){var d=AI.getElementDocument(E);return d?AI.getDocumentWindow(d):null;};AI.dCTN=function(T){return document.createTextNode(T);};AI.dCE=function(E,N){var d=document,i='AIfoobar',f=d.createElement('IFRAME');f.name=i;f.style.display='none';d.body.appendChild(f);if(!window.frames[i]){AI.dCE=function(e,n){return document.createElement(n?'<'+e+' name="'+n+'">':e);};}else{AI.dCE=function(e,n){var E=document.createElement(e);if(n){E.name=n;}return E;};}d.body.removeChild(f);return AI.dCE(E,N);};if(!AI.features.isObjectProperty(document,'importNode')){document.importNode=function(E,D){var n,i,m,t,a,A,r=null,d=document;switch(E.nodeType){case 1:n=d.createElement(E.nodeName);A=E.attributes;if(A&&A.length>0){for(i=0,m=A.length;i<m;i++){a=A[i].nodeName;n.setAttribute(a,E.getAttribute(a));}}if(D&&E.childNodes&&E.childNodes.length>0){for(i=0,m=E.childNodes.length;i<m;i++){t=d.importNode(E.childNodes[i],D);if(t){n.appendChild(t);}}}r=n;break;case 3:case 4:r=d.createTextNode(E.nodeValue);break;case 8:r=d.createComment(E.nodeValue);break;}return r;};}var $dce=AI.dCE,$dct=AI.dCTN;
AI.DOM={getById:function(I,d){d=d||document;return typeof I=='string'?d.getElementById(I):I;},insertFirst:function(id,pere){var node=AI.DOM.getById(id),P=pere?AI.DOM.getById(pere):node?node.parentNode:null;if(node&&P){if(P.childNodes.length===0&&P.firstChild){return P.appendChild(node);}else{return P.insertBefore(node,P.firstChild);}}return null;},insertAfter:function(source,cible){var S=AI.DOM.getById(source),C=AI.DOM.getById(cible);if(C.nextSibling){return C.parentNode.insertBefore(S,C.nextSibling);}return C.parentNode.appendChild(S);},moveBefore:function(source,cible){var S=AI.DOM.getById(source),C=AI.DOM.getById(cible),P;if(C&&S&&S.parentNode){P=S.parentNode;P.removeChild(S);return P.insertBefore(S,C);}return null;},moveAfter:function(source,cible){var S=AI.DOM.getById(source),C=AI.DOM.getById(cible),P;if(S&&S.parentNode){P=S.parentNode;P.removeChild(S);return P.insertBefore(S,C?C.nextSibling:null);}return null;},emptyTextNode:function(){return AI.dCTN('\u00a0');},getInnerText:function(id){var node=AI.DOM.getById(id),R=[],i=0;if(!node){return '';}if(node.data&&node.nodeType==document.TEXT_NODE){return node.data;}if(node.textContent){return node.textContent;}if(node.innerText){return node.innerText;}while(node.childNodes[i]){R.push(AI.DOM.getInnerText(node.childNodes[i]));i++;}return R.join('');},flush:function(id,props){var node=AI.DOM.getById(id),i;if(!node){return null;}while(node.firstChild){if(props){for(i=props.length;i--;){node.firstChild[props]=null;}}node.removeChild(node.firstChild);}return node;},flushQuick:function(id){var node=AI.DOM.getById(id),C;if(!node){return null;}C=node.cloneNode(false);node.parentNode.insertBefore(C,node);node.parentNode.removeChild(node);return node;},nodeChecker:function(node,css){return css&&node?function(e,n,c){return e&&e.nodeName&&e.nodeName.toUpperCase()==n&&AI.DOM.CSS.has(c,e);}:css?function(e,n,c){return AI.DOM.CSS.has(c,e);}:function(e,n,c){return e&&e.nodeName&&e.nodeName.toUpperCase()==n;};},suivant:function(id,nodeName,cName){var sibling,check=AI.DOM.nodeChecker(nodeName,cName),node=AI.DOM.getById(id);if(node){nodeName=nodeName.toUpperCase();sibling=node.nextSibling;while(sibling){if(check(sibling,nodeName,cName)){return sibling;}sibling=sibling.nextSibling;}}return null;},precedent:function(id,nodeName,cName){var sibling,check=AI.DOM.nodeChecker(nodeName,cName),node=AI.DOM.getById(id);if(node){nodeName=nodeName.toUpperCase();sibling=node.previousSibling;while(sibling){if(check(sibling,nodeName,cName)){return sibling;}sibling=sibling.previousSibling;}}return null;},parent:function(id,nodeName,cName){var check=AI.DOM.nodeChecker(nodeName,cName),node=AI.DOM.getById(id);if(node){nodeName=nodeName.toUpperCase();while(node&&node.parentNode){if(check(node,nodeName,cName)){return node;}node=node.parentNode;}}return null;},pix:function(){var p=0,i;for(i=arguments.length;i--;){p+=parseInt(arguments[i],10);}return p+'px';},hide:function(){for(var i=arguments.length;i--;){AI.DOM.CSS.add('cacher',arguments[i]);}},show:function(){for(var i=arguments.length;i--;){AI.DOM.CSS.remove('cacher',arguments[i]);}},isHide:function(id){return AI.DOM.CSS.has('cacher',id);},isShown:function(id){return!AI.DOM.isHide(id);},toggle:function(){var i,node;for(i=arguments.length;i--;){node=AI.DOM.getById(arguments[i]);if(!AI.DOM.CSS.has('ne_pas_cacher',node)){AI.DOM[AI.DOM.isHide(node)?'show':'hide'](node);}}},toggleChilds:function(id){var node=AI.DOM.getById(id),i;if(node&&node.childNodes){for(i=0;i<node.childNodes.length;i++){AI.DOM.toggle(node.childNodes[i]);}}},fixedTableHeader:function(table,height){var thead=AI.DOM.getByTag('thead',0,table),tbody=AI.DOM.getByTag('tbody',0,table);height=height?height:table.parentNode.offsetHeight-2;height=parseInt(height,10)-parseInt(thead.offsetHeight,10);height=parseInt(height,10).limit(0,null);AI.DOM.CSS.setStyle(tbody,{overflow:'hidden',overflowX:'hidden',overflowY:'auto',height:height+'px'});},getViewportHeight:function(){var h=-1;if((document.compatMode||AI.BROWSER.IE)&&!AI.BROWSER.opera){if(AI.BROWSER.strict){h=document.documentElement.clientHeight;}else{h=document.body.clientHeight;}}else{h=window.innerHeight;}return h;},getViewportWidth:function(){var w=-1;if(document.compatMode||AI.BROWSER.IE){if(AI.BROWSER.strict){w=document.documentElement.clientWidth;}else{w=document.body.clientWidth;}}else{w=window.innerWidth;}return w;},centerToParentHorizontal:function(id){window.setTimeout(function(){var node=AI.DOM.getById(id),P,W;if(node){P=node.parentNode;W=P&&P.nodeName&&P.nodeName.toUpperCase()==='BODY'?AI.DOM.getViewportWidth():P.offsetWidth;node.style.left=parseInt((W-node.offsetWidth)/2,10)+'px';}},1);},centerToParentVertical:function(id){window.setTimeout(function(){var node=AI.DOM.getById(id),P,W;if(node){P=node.parentNode;W=P&&P.nodeName&&P.nodeName.toUpperCase()==='BODY'?AI.DOM.getViewportHeight():P.offsetHeight;node.style.top=parseInt((W-node.offsetHeight)/2,10)+'px';}},1);},centerToParent:function(id){var node=AI.DOM.getById(id);if(!node){return null;}AI.DOM.centerToParentHorizontal(node);AI.DOM.centerToParentVertical(node);return node;},getByTags:function(n,d){d=d||document;return d.getElementsByTagName(n);},getByTag:function(n,i,d){return AI.DOM.getByTags(n,d)[i||0];},createElement:function(nodeName,attributs,style,childs,type,node){var i,m,name=attributs&&attributs.name?attributs.name:null,element=AI.dCE(nodeName,name);function cb(o,k,v){if(k=='cls'||k=='cname'||k=='classname'){this.className=v;}else if(k=='html'){this.innerHTML=v;}else if(k=='noselection'||k=='disableSelection'){if(v!==false){AI.HTML.noSelection(this,typeof v=='boolean'?'default':v);}}else if(k=='autocomplete'){AI.HTML.setAutocomplete(this,v);}else if(k=='childs'){childs=AI.utils.forceArray(v);}else{this[k]=v;}}if(attributs){AI.utils.forOwn(attributs,cb,element);}m=childs&&childs.length?childs.length:0;if(m>0){for(i=0;i<m;i++){element.appendChild(childs[i]);}}if(AI.utils.isValidString(type)&&AI.utils.isValidElement(node)){type=type.toLowerCase();if(['ib','before','insertbefore'].contains(type)){node.parentNode.insertBefore(element,node);}else if(['if','first','insertfirst'].contains(type)){AI.DOM.insertFirst(element,node);}else if(['rc','replace','replacechild'].contains(type)){node.parentNode.replaceChild(element,node);}else{node.appendChild(element);}}return AI.DOM.CSS.setStyle(element,style);},getScrollLeftSum:function(el){var sum=0,p=el.parentNode;while(p&&p.nodeType&&p.nodeType==document.ELEMENT_NODE){sum+=p.scrollLeft;p=p.parentNode;}return sum;},getScrollTopSum:function(el){var sum=0,p=el.parentNode;while(p&&p.nodeType&&p.nodeType==document.ELEMENT_NODE){sum+=p.scrollTop;p=p.parentNode;}return sum;}};if(AI.BROWSER.IE){AI.DOM.fixedTableHeader=function(table,height){var div=AI.DOM.createElement('div'),P=table.parentNode,tr=AI.DOM.getByTags('tr',AI.DOM.getByTag('thead',0,table)),i;height=height?height:table.parentNode.offsetHeight-2;for(i=tr.length;i--;){tr[i].style.position='relative';tr[i].style.setExpression('top','this.offsetParent.scrollTop');}height=parseInt(height,10).limit(0,null);AI.DOM.CSS.setStyle(div,{height:height+'px',overflow:'auto'});P.insertBefore(div,table);div.appendChild(table);table.style.width=(table.offsetWidth-16)+'px';};if(AI.BROWSER.IE6){AI.DOM.getById=function(id,doc){doc=doc||document;return typeof id=='string'?doc.all[id]:id;};}}AI.DOM.getMarginLeft=function(id){return AI.DOM.CSS.getStyleInt(id,'marginLeft');};AI.DOM.getMarginTop=function(id){return AI.DOM.CSS.getStyleInt(id,'marginTop');};AI.DOM.getMarginRight=function(id){return AI.DOM.CSS.getStyleInt(id,'marginRight');};AI.DOM.getMarginBottom=function(id){return AI.DOM.CSS.getStyleInt(id,'marginBottom');};AI.DOM.getPaddingLeft=function(id){return AI.DOM.CSS.getStyleInt(id,'paddingLeft');};AI.DOM.getPaddingTop=function(id){return AI.DOM.CSS.getStyleInt(id,'paddingTop');};AI.DOM.getPaddingRight=function(id){return AI.DOM.CSS.getStyleInt(id,'paddingRight');};AI.DOM.getPaddingBottom=function(id){return AI.DOM.CSS.getStyleInt(id,'paddingBottom');};AI.DOM.getBorderLeft=function(id){return AI.DOM.CSS.getStyle(id,"borderLeftStyle")=='none'?0:AI.DOM.CSS.getStyleInt(id,"borderLeftWidth");};AI.DOM.getBorderTop=function(id){return AI.DOM.CSS.getStyle(id,"borderTopStyle")=='none'?0:AI.DOM.CSS.getStyleInt(id,"borderTopWidth");};AI.DOM.getBorderRight=function(id){return AI.DOM.CSS.getStyle(id,"borderRightStyle")=='none'?0:AI.DOM.CSS.getStyleInt(id,"borderRightWidth");};AI.DOM.getBorderBottom=function(id){return AI.DOM.CSS.getStyle(id,"borderBottomStyle")=='none'?0:AI.DOM.CSS.getStyleInt(id,"borderBottomWidth");};AI.DOM.bodyElement=(function(d){if(AI.features.isObjectProperty(d,'body')){return d.body;}return AI.DOM.getByTag('BODY',0,d)||null;})(document);AI.DOM.documentElement=(function(d){return AI.features.strict&&AI.features.isObjectProperty(d,'documentElement')?d.documentElement:AI.DOM.bodyElement;})(document);var $=AI.DOM.getById,$E=AI.DOM.createElement,$tags=AI.DOM.getByTags,$tag=AI.DOM.getByTag,DOM=AI.DOM;DOM.getX=function(id){var node=AI.DOM.getById(id),C=0;if(!node){return 0;}if(node.offsetParent){while(node.offsetParent){C+=node.offsetLeft;node=node.offsetParent;}}return C;};DOM.getY=function(id){var node=AI.DOM.getById(id),C=0;if(!node){return 0;}if(node.offsetParent){while(node.offsetParent){C+=node.offsetTop;node=node.offsetParent;}}return C;};AI.gBI=AI.DOM.getById;DOM.head=AI.DOM.getByTag('head');
AI.DOM.whitespace=function(){function isAll(node){return!(/[^\t\n\r]/.test(node.data));}function isIgnorable(node){return(node.nodeType==document.COMMENT_NODE)||((node.nodeType==document.TEXT_NODE)&&isAll(node));}function nodeBefore(sib){while((sib=sib.previousSibling)){if(!isIgnorable(sib)){return sib;}}return null;}function nodeAfter(sib){while((sib=sib.nextSibling)){if(!isIgnorable(sib)){return sib;}}return null;}function lastChild(par){var res=par.lastChild;while(res){if(!isIgnorable(res)){return res;}res=res.previousSibling;}return null;}function firstChild(par){var res=par.firstChild;while(res){if(!isIgnorable(res)){return res;}res=res.nextSibling;}return null;}function dataOf(txt){var data=txt.data.replace(/[\t\n\r]+/g,' ');if(data.charAt(0)===' '){data=data.substring(1,data.length);}if(data.charAt(data.length-1)===' '){data=data.substring(0,data.length-1);}return data;}function clean(id,recursif){var E=AI.DOM.getById(id),i,node;if(E&&E.childNodes){for(i=E.childNodes.length-1;i>=0;i--){node=E.childNodes[i];if(node.nodeType==document.TEXT_NODE){if(isIgnorable(node)){E.removeChild(node);}}else if(node.nodeType==document.ELEMENT_NODE&&recursif){clean(node,recursif);}}}}return{nodeBefore:nodeBefore,nodeAfter:nodeAfter,lastChild:lastChild,firstChild:firstChild,isIgnorable:isIgnorable,dataOf:dataOf,clean:clean};}();DOM.cleanWhitespace=AI.DOM.whitespace.clean;
AI.DOM.CSS=function(){var loaded={},uid=0;function rgb2hex(rgbString){var result,rgb,hex='',digits='0123456789abcdef';if(typeof rgbString!='string'||typeof rgbString.match=='undefined'){return null;}result=rgbString.match(/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*/);if(result===null){return rgbString;}rgb=+result[1]<<16|+result[2]<<8|+result[3];while(rgb!==0){hex=digits.charAt(rgb&0xf)+hex;rgb>>>=4;}while(hex.length<6){hex='0'+hex;}return "#"+hex;}function _has_(cName,id){var node=AI.DOM.getById(id),c;if(!node||!node.className){return false;}c=node.className.split(' ');return c.contains(cName);}function _set_(cName){var node,i;for(i=1;i<arguments.length;i++){node=AI.DOM.getById(arguments[i]);if(node){node.className=cName;}}}function _add_(cName){var node,i,c;for(i=1;i<arguments.length;i++){node=AI.DOM.getById(arguments[i]);if(!node){continue;}if(!node.className){node.className=cName;}else{c=node.className.split(' ');if(!c.contains(cName)){c.push(cName);node.className=c.join(' ');}}}}function _remove_(cName){var node,i,c;for(i=1;i<arguments.length;i++){node=AI.DOM.getById(arguments[i]);if(!node||!node.className){continue;}c=node.className.split(' ');if(c.contains(cName)){c.remove(cName);node.className=c.join(' ');}}}function _getStyle_(id,prop){var dV,hyphen,val=null,node=AI.DOM.getById(id);if(!node){return null;}dV=(node.ownerDocument||document).defaultView;if(prop=='opacity'&&node.filters){try{return node.filters.item('DXImageTransform.Microsoft.Alpha').opacity/100;}catch(x){try{return node.filters.item('alpha').opacity/100;}catch(e){}}return '1';}else if(node.style[prop]){val=node.style[prop];}else if(node.currentStyle&&node.currentStyle[prop]){val=node.currentStyle[prop];}else if(dV&&dV.getComputedStyle){hyphen=String.toHyphen(prop);if((dV=dV.getComputedStyle(node,''))&&dV.getPropertyValue(hyphen)){val=dV.getPropertyValue(hyphen);}}if(val!==null){if(/^\s*rgb\s*\(/.test(val)){val=rgb2hex(val);}if(/^#/.test(val)){val=val.toLowerCase();}}return val;}function _getStyleInt_(id,prop){return parseInt(_getStyle_(id,prop),10);}return{has:_has_,set:_set_,add:_add_,remove:_remove_,getPropertyName:function(prop){var fn=function(p){return p;};if(document&&document.body&&document.body.style&&typeof document.body.style.styleFloat=='string'){fn=function(p){return p=='cssFloat'?'styleFloat':p;};}AI.DOM.CSS.getPropertyName=fn;return fn(prop);},setStyle:function(id,properties){var node=AI.DOM.getById(id);if(properties&&node){AI.utils.forOwn(properties,function(o,k,v){if(k=='opacity'){AI.DOM.CSS.setOpacity(this,v);}else{this.style[AI.DOM.CSS.getPropertyName(k)]=v;}},node);}return node;},getStyle:_getStyle_,getStyleInt:_getStyleInt_,setOpacity:function(eId,val){var elt=AI.DOM.getById(eId),fn=function(){};if(elt&&elt.style){if(typeof elt.style.opacity=='string'){fn=function(id,v){var e=AI.DOM.getById(id);if(e){e.style.opacity=v;}};}else if(typeof elt.style.MozOpacity=='string'){fn=function(id,v){var e=AI.DOM.getById(id);if(e){e.style.MozOpacity=v;}};}else if(typeof elt.style.KhtmlOpacity=='string'){fn=function(id,v){var e=AI.DOM.getById(id);if(e){e.style.KhtmlOpacity=v;}};}else if(typeof elt.style.filter=='string'){fn=function(id,v){var e=AI.DOM.getById(id);if(e){if(e.currentStyle&&!e.currentStyle.hasLayout){e.style.zoom=1;}if(e.style.filter.indexOf('alpha(opacity=')==-1){e.style.filter+=' alpha(opacity='+Math.round(v*100)+')';}else{e.style.filter=e.style.filter.replace(new RegExp('alpha\\(opacity=[^\\)]+\\)','i'),(v>=0.9999)?'':'alpha(opacity='+Math.round(v*100)+')');}}};}}AI.DOM.CSS.setOpacity=fn;return fn(elt,val);},removeOpacity:function(id){AI.DOM.CSS.setOpacity(id,1);},loadLink:function(url,id){var link;if(!loaded[url]){if(!AI.utils.isValidString(id)){id=String.toCamel(url.replace(/[^\w]/g,'-'))+uid++;}link=AI.DOM.createElement("LINK",{id:id,rel:'stylesheet',href:url});AI.DOM.getByTag('head').appendChild(link);loaded[url]=id;}},removeLink:function(url){var link;if(loaded[url]){link=AI.DOM.getById(loaded[url]);if(link&&link.parentNode){link.parentNode.removeChild(link);}delete loaded[url];}}};}();var $style=AI.DOM.CSS.setStyle;DOM.hasCSS=function(e,C){return AI.DOM.CSS.has(C,e);};DOM.setCSS=function(e,C){return AI.DOM.CSS.set(C,e);};DOM.addCSS=function(e,C){return AI.DOM.CSS.add(C,e);};DOM.removeCSS=function(e,C){return AI.DOM.CSS.remove(C,e);};DOM.setOpacity=AI.DOM.CSS.setOpacity;DOM.removeOpacity=AI.DOM.CSS.removeOpacity;DOM.getStyle=AI.DOM.CSS.getStyle;DOM.getStyleInt=AI.DOM.CSS.getStyleInt;
AI.DOM.position={get:function(E){var n=AI.DOM.getById(E),p={left:0,top:0,width:0,height:0,offsetWidth:0,offsetHeight:0,clientWidth:0,clientHeight:0,scrollTop:0,scrollWidth:0,scrollHeight:0};if(n){AI.utils.forOwn(p,function(o,k,v,i,a){if(!(['left','top','width','height'].contains(k))&&k in a){this[k]=intval(a[k]);}},p,n);p.width=p.offsetWidth;p.height=p.offsetHeight;if(n.offsetParent){do{p.left+=n.offsetLeft;p.top+=n.offsetTop;}while((n=n.offsetParent));}}return p;},set:function(E,L,T){var n=AI.DOM.getById(E);if(!n){return null;}if(typeof L=='object'){T=L.top;L=L.left;}if(AI.DOM.CSS.getStyle(n,'position')!='absolute'){n.style.position='absolute';}n.style.top=intval(T)+'px';n.style.left=intval(L)+'px';return n;},getCenter:function(E){var c=AI.DOM.position.get(E);c.left=c.left+(c.width/2);c.top=c.top+(c.height/2);return c;}};
AI.HTML=function(){function sel(E,T){var n=AI.DOM.getById(E);if(n&&(n=n.options)){T=T=='text'?'text':'value';if(n.selectedIndex!=-1){return n[n.selectedIndex][T];}}return '';}function sGIB(E,V,T){var i,m,n=AI.DOM.getById(E);if(n&&(n=n.options)){T=T=='text'?'text':'value';for(i=0,m=n.length;i<m;i++){if(n[i][T]==V){return i;}}}return-1;}function sSIB(E,V,T){var n=AI.DOM.getById(E);if(n){n.selectedIndex=sGIB(n,V,T);}}return{setAutocomplete:function(E,S){var n=AI.DOM.getById(E);S=S=='on'||S===true?'on':'off';try{n.setAttribute('autocomplete',S);}catch(x){}n.autocomplete=S;},safeFocus:function(E){var n=AI.DOM.getById(E);if(n&&AI.features.isObjectProperty(n,'focus')){n.focus();}},safeSelect:function(E){var n=AI.DOM.getById(E);if(n&&AI.features.isObjectProperty(n,'select')){n.select();}},noSelection:function(E,C){var n=AI.DOM.getById(E);if(n){n.onselectstart=function(){return false;};n.unselectable='on';n.style.MozUserSelect='none';n.style.cursor=C||'default';}},checkedRadio:function(F,N){var i,m,f=AI.DOM.getById(F);if(f&&(f=f.elements)){for(i=0,m=f.length;i<m;i++){if(f[i].name==N&&f[i].checked===true){return f[i].value;}}}return '';},getValue:function(E){var n,f,i,m,e=AI.DOM.getById(E);if(e&&e.nodeName){n=e.nodeName.toUpperCase();if(n=="INPUT"){if(e.type=="text"||e.type=="hidden"){return e.value;}else if(e.type=="checkbox"){if(e.checked){return e.value;}}else if(e.type=="radio"){if(e.checked){return e.value;}else{if((f=e.form)&&(f=f.elements)){for(i=0,m=f.length;i<m;i++){if(f[i].type=="radio"&&f[i].name==e.name&&f[i].checked===true){return f[i].value;}}}}return null;}}else if(n=="SELECT"){return AI.HTML.select.value(e);}else if(n=="TEXTAREA"){return e.value;}AI.console.error("AI.HTML.getValue()type élément non géré:"+e.nodeName+"/"+n+'/'+e.name+'/'+e.id);}return null;},select:{vider:function(E){var i,n=AI.DOM.getById(E);if(n&&n.nodeName==='SELECT'&&(n=n.options)){n.selectedIndex=-1;for(i=n.length;i--;){n[i]=null;}n.length=0;}},remplir:function(E,O,S){var n=AI.DOM.getById(E);if(!n||n.nodeName!=='SELECT'){return null;}AI.HTML.select.vider(n);AI.utils.forOwn(O,function(o,k,v,i){this.options[this.options.length]=AI.DOM.createElement('OPTION',{value:v,childs:[AI.dCTN(k)]});if(typeof S=='string'&&k==S){S=i;}},n);if(S){n.selectedIndex=S;}return n;},value:function(E){return sel(E,'value');},text:function(E){return sel(E,'text');},getIndexByValue:function(E,V){return sGIB(E,V,'value');},getIndexByText:function(E,T){return sGIB(E,T,'text');},setIndexByValue:function(E,V){sSIB(E,V,'value');},setIndexByText:function(E,T){sSIB(E,T,'text');}}};}();var selectedValue=AI.HTML.select.value;
Error.prototype.toString=function(){return this.message;};if(typeof Error.prototype.lineNumber!=='undefined'&&typeof Error.prototype.fileName!=='undefined'){Error.prototype.toString=function(){var X=this.fileName.split('/');return '#'+this.lineNumber+':'+X[X.length-1]+' "'+this.message+'"';};}AI.console=AI.getSimilarParentObject('console')||function(){var dragged=false,dragX=0,dragY=0,actif=true,cE=AI.DOM.createElement,log=cE('ul',{id:'console_main'}),label=cE('h1',{noselection:'pointer',title:"Cliquez pour activer/désactiver les rapports d'erreurs dans la console"},{},[AI.dCTN('Console activée')]),container=cE('DIV',{id:'console_container',cls:'cacher'},{},[cE('DIV',{id:'console_boutons'},{},[cE('span',{cls:'actif',noselection:'pointer',title:'Activer/Désactiver',onclick:function(){AI.console.setActif(!actif);AI.DOM.CSS[actif?"remove":"add"]("inactif",this);return false;}}),cE('span',{cls:'fermer',noselection:'pointer',title:'Fermer',onclick:function(){AI.console.fermer();return false;}}),cE('span',{cls:'vider',noselection:'pointer',title:'Vider',onclick:function(){AI.console.vider();return false;}}),label]),log]);function onLabelMouseMove(e){var E=AI.EVT.fix(e);AI.DOM.CSS.setStyle(container,{top:(AI.EVT.getY(E)+dragY)+'px',left:(AI.EVT.getX(E)+dragX)+'px'});dragged=true;}function onLabelMouseUp(e){AI.EVT.remove(document,"mousemove",onLabelMouseMove);AI.EVT.remove(document,"mouseup",onLabelMouseUp);}function insertContainer(){if(!container.parentNode||container.parentNode.nodeType!=1){AI.DOM.CSS.loadLink('/js/ai/css/console.css','console');document.body.appendChild(container);label.onmousedown=function(e){var E=AI.EVT.fix(e);dragged=false;dragX=AI.DOM.getX(container)-AI.EVT.getX(E);dragY=AI.DOM.getY(container)-AI.EVT.getY(E);AI.EVT.add(document,"mousemove",onLabelMouseMove);AI.EVT.add(document,"mouseup",onLabelMouseUp);return AI.EVT.preventDefault(E);};}}function message(mode,msg){var i,li,tmp=(''+msg).split(AI.consts.TEXT_BR),cE=AI.DOM.createElement;if(actif&&typeof msg=='string'&&msg!==''){insertContainer();if(typeof mode!='string'||mode===''){mode='info';}li=cE('LI',{className:'console-'+mode});for(i=0;i<tmp.length;i++){if(i>0){li.appendChild(cE('BR'));}li.appendChild(AI.dCTN(tmp[i]));}AI.DOM.insertFirst(li,log);if(mode!='info'){AI.DOM.show(container);}}return AI.console;}function messageHTML(html){if(actif&&typeof html=='string'&&html!==''){insertContainer();AI.DOM.createElement('LI',{innerHTML:html,cls:'console-html'},{},[],'if',log);}return AI.console;}function appendText(obj,tbl){tbl.push(AI.utils.escapeHTML(obj));}function appendNull(obj,tbl){tbl.push('<span class="console-null">',AI.utils.escapeHTML(obj),'</span>');}function appendBoolean(obj,tbl){tbl.push('<span class="console-boolean">',AI.utils.escapeHTML(obj),'</span>');}function appendString(obj,tbl){tbl.push('<span class="console-string">&quot;',AI.utils.escapeHTML(obj),'&quot;</span>');}function appendNumber(obj,tbl){tbl.push('<span class="console-number">',AI.utils.escapeHTML(obj),'</span>');}function appendFunction(obj,tbl){var r=/function?(.*?)\(/,m=r.exec(obj),n=m?m[1]:"function";if(n.trim()===''){n='function';}tbl.push('<span class="console-function">',AI.utils.escapeHTML(n),'()</span>');}function appendObjectFormatted(obj,tbl){var r=/\[object(.*?)\]/,m=r.exec(obj);tbl.push('<span class="console-object">',m?m[1]:obj,'</span>');if(typeof obj.length==='number'){tbl.push('['+obj.length+']');}}function appendSelector(obj,tbl){tbl.push('<span class="console-selectorTag">',AI.utils.escapeHTML(obj.nodeName.toLowerCase()),'</span>');if(obj.id){tbl.push('<span class="console-selectorId">#',AI.utils.escapeHTML(obj.id),'</span>');}if(obj.className){tbl.push('<span class="console-selectorClass">.',AI.utils.escapeHTML(obj.className),'</span>');}}function appendObject(obj,tbl){if(obj===undefined||typeof obj==='undefined'){appendNull("undefined",tbl);}else if(obj===null){appendNull("null",tbl);}else if(typeof obj=="string"){appendString(obj,tbl);}else if(typeof obj=="boolean"){appendBoolean(obj,tbl);}else if(typeof obj=="number"){appendNumber(obj,tbl);}else if(typeof obj=="function"){appendFunction(obj,tbl);}else if(obj.nodeType&&obj.nodeType==1){appendSelector(obj,tbl);}else if(typeof obj=="object"){appendObjectFormatted(obj,tbl);}else{appendText(obj,tbl);}}function appendNode(node,tbl){var i,attr,child,val;if(node.nodeType==1){tbl.push('<div class="console-element">','&lt;<span class="console-nodeTag">',node.nodeName.toLowerCase(),'</span>');for(i=0;i<node.attributes.length;i++){attr=node.attributes[i];if(!attr.specified){continue;}tbl.push('&nbsp;<span class="console-nodeName">',attr.nodeName.toLowerCase(),'</span>=&quot;<span class="console-nodeValue">',AI.utils.escapeHTML(attr.nodeValue),'</span>&quot;');}if(node.firstChild){tbl.push('&gt;</div><div class="console-nodeChildren">');for(child=node.firstChild;child;child=child.nextSibling){appendNode(child,tbl);}tbl.push('</div><div class="console-element">&lt;/<span class="console-nodeTag">',node.nodeName.toLowerCase(),'&gt;</span></div>');}else{tbl.push('/&gt;</div>');}}else if(node.nodeType==document.TEXT_NODE){val=node.nodeValue.trim();if(!(val===''||val=='\n'||val=='\t'||val=='\r'||val=='\r\n'||val=='\n\r')){tbl.push('<div class="console-nodeText">',AI.utils.escapeHTML(node.nodeValue),'</div>');}}}return{assert:function(truth,msg){if(!truth){message('error',msg);}return AI.console;},error:function(msg){return message('error',msg);},explore:function(obj){var i,name,value,shortName,html=[],pairs=[];AI.utils.forOwn(obj,function(o,k,v){pairs.push([k,v]);});if(pairs.length>0){if(typeof obj=="string"||AI.utils.isValidArray(obj)){pairs.sort(function(a,b){return parseInt(a[0],10)<parseInt(b[0],10)?-1:1;});}else{pairs.sort(function(a,b){return a[0]<b[0]?-1:1;});}}html.push('<table>');for(i=0;i<pairs.length;i++){name=pairs[i][0];value=pairs[i][1];shortName=name.substr(0,20);if(shortName!=name){shortName=shortName+'...';}html.push('<tr><td class="console-propertyNameCell" title="',AI.utils.escapeHTML(name),'"><span class="console-propertyName">',AI.utils.escapeHTML(shortName),'</span></td><td>');appendObject(value,html);html.push('</span></td></tr>');}html.push('</table>');messageHTML(html.join(''));return AI.console;},exploreNode:function(node,showNode){var html=[];appendSelector(node,html);if(showNode){appendNode(node,html);}messageHTML(html.join(''));return AI.console;},fermer:function(){AI.DOM.hide(container);return AI.console;},hide:function(){AI.DOM.hide(container);return AI.console;},html:function(html){return messageHTML(html);},info:function(msg){return message('info',msg);},setActif:function(s){actif=s;label.innerHTML=s?'Console activée':'Console désactivée';return AI.console;},show:function(){AI.DOM.show(container);return AI.console;},stop:function(msg){message('error',msg,true);throw new Error(msg);},toggle:function(){AI.DOM.toggle(container);return AI.console;},vider:function(){AI.DOM.flush(log);return AI.console;},warning:function(msg){return message('warning',msg);},selectorToText:function(node){var tbl=[];appendSelector(node,tbl);return tbl.join('');}};}();
AI.msgBox=function(){var original,container,all={},uid=0;function efface(cle,instant,essai){var boite,timeout,anime;if(!container){window.setTimeout(function(){efface(cle,instant,essai);},1000);return AI.msgBox;}if(!all[cle]){essai=parseInt(essai,10)+1;if(essai<=2){window.setTimeout(function(){efface(cle,instant,essai);},1000);}return AI.msgBox;}boite=all[cle][0];timeout=all[cle][1];delete all[cle];if(timeout){window.clearTimeout(timeout);}if(boite.firstChild){boite.firstChild.onclick=null;boite.removeChild(boite.firstChild);}function oncomplete(){container.removeChild(boite);}if(instant===true){oncomplete();}else{anime=new AI.ANIMATION({"onComplete":oncomplete}).addSubject(new AI.ANIMATION.numericalTransition(boite,'opacity',1,0)).addSubject(new AI.ANIMATION.numericalTransition(boite,'width',boite.offsetWidth,1)).addSubject(new AI.ANIMATION.numericalTransition(boite,'height',boite.offsetHeight,1));boite.style.overflow='hidden';anime.play();}return AI.msgBox;}function message(cName,msg,cle,html){var timeout,ms,close_button,boite,i,tmp;function closeMe(){return efface(cle);}cle=cle&&''!==cle?cle:'msgBox'+(uid++);if(!container){window.setTimeout(function(){message(cName,msg,cle,html);},500);return AI.msgBox;}if(all[cle]){efface(cle,true);}close_button=AI.DOM.createElement('span',{className:'msgBox-close',onclick:closeMe});boite=AI.DOM.createElement('div',{className:'msgBox-boite msgBox-'+cName},{},[close_button]);if(html){boite.appendChild(AI.DOM.createElement('div',{innerHTML:msg}));}else{tmp=msg.split(AI.consts.TEXT_BR);for(i=0;i<tmp.length;i++){if(i>0){boite.appendChild(AI.DOM.createElement('br'));}boite.appendChild(AI.dCTN(tmp[i]));}}AI.DOM.insertFirst(boite,container);switch(cName){case 'error':ms=60000;break;case 'process':ms=-1;break;case 'warning':ms=4000;break;default:ms=1500;break;}if(ms>0){timeout=window.setTimeout(closeMe,ms);}all[cle]=[boite,timeout];return AI.msgBox;}function layout(){if(document.body){container=container?container:AI.DOM.createElement('DIV',{className:'msgBox'});original=document.body;original.appendChild(container);}else{window.setTimeout(layout,50);}}layout();return{efface:efface,effaceAll:function(){AI.utils.forOwn(all,function(o,k){efface(k,true);});return AI.msgBox;},info:function(msg,cle,html){return message('info',msg,cle,html);},warning:function(msg,cle,html){return message('warning',msg,cle,html);},error:function(msg,cle,html){return message('error',msg,cle,html);},process:function(msg,cle,html){return message('process',msg,cle,html);},resetParentContainer:function(){if(original){AI.msgBox.effaceAll();if(container.parentNode){container.parentNode.removeChild(container);}container=original.ownerDocument.importNode(container,false);original.appendChild(container);}else{layout();}return AI.msgBox;},setParentContainer:function(id){var n=AI.DOM.getById(id);if(n&&container){if(container.parentNode){container.parentNode.removeChild(container);}container=n.ownerDocument.importNode(container,true);n.appendChild(container);}else{AI.msgBox.resetParentContainer();}return AI.msgBox;}};}();AI.msgBox.setPos=function(t,l){AI.console.error('DEPRECATED AI.msgBox.setPos()');};
AI.EVT={X:0,Y:0,listeners:[],stopLoad:false,onload:[],onunload:[],unloadActif:false,fix:function(E){return E||window.event;},add:function(I,T,L,C,A){var r=true,i,m,e,w;if(T instanceof Array){for(i=0,m=T.length;i<m;i++){r=r&&this.add(I,T[i],L,C,A);}return r;}e=AI.DOM.getById(I);if(!e){return false;}C=C?C:e;w=(function(l,c,a){return function(z){return l.call(c,AI.EVT.fix(z),a);};})(L,C,A);this.bind(e,T,w);this.listeners.push([e,T,L,w,C,A]);return true;},remove:function(I,T,L,C){var e,i,m,l=null,r=true;if(AI.utils.isValidArray(T)){for(i=0,m=T.length;i<m;i++){r=this.remove(I,T[i],L,C)&&r;}return r;}e=AI.DOM.getById(I);if(!e){return false;}C=C?C:e;i=this.getListenerIndex(e,T,L,C);if(i>=0){l=this.listeners[i];}if(!l){return false;}this.unbind(e,T,l[3]);delete this.listeners[i];return true;},stop:function(E){this.stopPropagation(E);this.preventDefault(E);return false;},getListenerIndex:function(E,T,L,C){var i,m,l;C=C?C:E;for(i=0,m=this.listeners.length;i<m;i++){l=this.listeners[i];if(l&&l[0]==E&&l[1]==T&&l[2]==L&&l[4]==C){return i;}}return-1;},getTarget:function(E){var f=function(){return null;};if(E&&AI.features.isObjectProperty(E,'target')){f=function(e){var t=e&&e.target?e.target:null;return t&&t.nodeType==3?t.parentNode:t;};}else if(AI.features.isGlobalProperty("event")&&AI.features.isObjectProperty(window.event,'srcElement')){f=function(){var e=window.event,t=e&&e.srcElement?e.srcElement:null;return t&&t.nodeType==3?t.parentNode:t;};}return(this.getTarget=f)(E);},getParentTarget:function(E,N,C){return AI.DOM.parent(this.getTarget(E),N,C);},getRelatedTarget:function(E){var e=this.fix(E),t=e.relatedTarget;if(!t){if(e.type=="mouseout"){t=e.toElement;}else if(e.type=="mouseover"){t=e.fromElement;}}return t&&t.nodeType==3?t.parentNode:t;},getX:function(E){var e=this.fix(E),x=e.pageX;if(!x&&0!==x){x=(e.clientX||0)+this.getScroll('Left');}this.X=x;return x;},getY:function(E){var e=this.fix(E),y=e.pageY;if(!y&&0!==y){y=(e.clientY||0)+this.getScroll('Top');}this.Y=y;return y;},getScroll:function(){return 0;},getKeyboardKey:function(E){var e=AI.EVT.fix(E);return e.type=='keypress'?e.charCode||e.keyCode||e.which:e.which||e.keyCode;},DOMLoaded:function(){var i,m,t,L=AI.EVT.onload;if(AI.EVT.DOMLoaded.OK){return true;}AI.EVT.keys.listen();AI.EVT.remove(document,'DOMContentLoaded',AI.EVT.DOMLoaded);AI.EVT.DOMLoaded.OK=true;for(i=0,m=L.length;i<m;i++){if(!AI.EVT.stopLoad){try{L[i]();}catch(x){t='Erreur lors du chargement'+"\n"+x;if(AI&&AI.console){AI.console.error(t);}else{throw new Error(t);}}}}return true;},onUnLoadDEPRECATED:function(){var L,i;AI.EVT.remove(window,'unload',AI.EVT.onUnLoad);L=AI.EVT.onunload;for(i=0;i<L.length;i++){try{L[i]();}catch(x){}}if(AI.EVT.listeners&&AI.EVT.listeners.length>0){for(i=0;i<AI.EVT.listeners.length;i++){L=AI.EVT.listeners[i];if(L){AI.EVT.remove(L[0],L[1],L[2],L[4]);}}}},loader:function(F){if(this.DOMLoaded.OK){if(!AI.EVT.stopLoad){F();}}else{this.onload.push(F);}},unloaderDEPRECATED:function(F){if(AI.EVT.unloadActif){AI.EVT.add(window,'unload',AI.EVT.onUnLoad);}AI.EVT.unloadActif=true;AI.EVT.onunload.push(F);},bind:function(E,T,L){var p=AI.features.isObjectProperty,f=function(){};if(p(E,'addEventListener')){f=function(e,t,l){e.addEventListener(t,l,false);};}else if(p(E,'attachEvent')){f=function(e,t,l){e.attachEvent('on'+t,l);};}return(this.bind=f)(E,T,L);},unbind:function(E,T,L){var p=AI.features.isObjectProperty,f=function(){};if(p(E,'removeEventListener')){f=function(e,t,l){e.removeEventListener(t,l,false);};}else if(p(E,'detachEvent')){f=function(e,t,l){e.detachEvent('on'+t,l);};}return(this.unbind=f)(E,T,L);},preventDefault:function(E){var f=function(){return false;};if(AI.features.isObjectProperty(E,'preventDefault')){f=function(e){e.preventDefault();return false;};}else if(window.event&&'returnValue' in window.event){f=function(){window.event.returnValue=false;return false;};}return(this.preventDefault=f)(E);},stopPropagation:function(E){var f=function(){return false;};if(E&&AI.features.isObjectProperty(E,'stopPropagation')){f=function(e){e.stopPropagation();return false;};}else if(window.event&&'cancelBubble' in window.event){f=function(){window.event.cancelBubble=true;return false;};}return(this.stopPropagation=f)(E);},buttons:{left:0,right:2,middle:1},getWheelDelta:function(E){return-(E.detail||0);},addWheel:function(E,F,C,A){return this.add(E,"DOMMouseScroll",F,C,A);},removeWheel:function(E,F){return AI.EVT.remove(E,"DOMMouseScroll",F);}};if(document.attachEvent){AI.EVT=AI.utils.injectObject(AI.EVT,{getWheelDelta:function(e){return e.wheelDelta?e.wheelDelta/40:0;},addWheel:function(E,F,C,A){AI.EVT.add(E,'mousewheel',F,C,A);},removeWheel:function(E,F){return AI.EVT.remove(E,"mousewheel",F);},buttons:{left:1,right:2,middle:4},getScroll:function(S){var d=AI.DOM.documentElement(document);if(typeof d['scroll'+S]!='undefined'){return d['scroll'+S];}return 0;}});}AI.EVT.add(document,'DOMContentLoaded',AI.EVT.DOMLoaded);window.onload=AI.EVT.DOMLoaded;AI.EVT.mouseEnter=function(E,L,C,A){function W(e,d){var r=AI.EVT.getRelatedTarget(e);if(this!==r&&!AI.utils.isAChildOf(this,r)){d[0].call(d[1],e,d[2]);}return false;}AI.EVT.add(E,'mouseover',W,E,[L,C,A]);return W;};AI.EVT.mouseLeave=function(E,L,C,A){function W(e,d){var r=AI.EVT.getRelatedTarget(e);if(this!==r&&!AI.utils.isAChildOf(this,r)){d[0].call(d[1],e,d[2]);}return false;}AI.EVT.add(E,'mouseout',W,E,[L,C,A]);return W;};AI.utils.isAChildOf=function(P,C){if(P===C){return false;}while(C&&C!==P){C=C.parentNode;}return C===P;};var EVT=AI.EVT;AI.EVT.touches={esc:27,enter:13,tab:9,space:32,up:38,down:40,left:37,right:39,shift:16,ctrl:17,alt:18,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,del:46,backspace:8,insert:45,home:36,end:35,pageup:33,pagedown:34,numlock:144,numpad_0:96,numpad_1:97,numpad_2:98,numpad_3:99,numpad_4:100,numpad_5:101,numpad_6:102,numpad_7:103,numpad_8:104,numpad_9:105,numpad_divide:111,numpad_multiply:106,numpad_minus:109,numpad_plus:107,_0:48,_1:49,_2:50,_3:51,_4:52,_5:53,_6:54,_7:55,_8:56,_9:57};AI.EVT.getCharCode=function(E){AI.console.error('AI.EVT.getCharCode(E)est DEPRECATED,lui préférer AI.EVT.getKeyboardKey(E)');return AI.EVT.getKeyboardKey(E);};AI.EVT.onUnLoad=AI.EVT.onUnLoadDEPRECATED;AI.EVT.unloader=AI.EVT.unloaderDEPRECATED;AI.EVT.stopEvent=AI.EVT.stop;AI.EVT.addEvent=AI.EVT.add;AI.EVT.removeEvent=AI.EVT.remove;AI.EVT.addEventMouseWheel=AI.EVT.addWheel;AI.EVT.getPageX=AI.EVT.getX;AI.EVT.getPageY=AI.EVT.getY;
AI.EVT.keys={CTRL:false,SHIFT:false,ALT:false,toid:null,toidStop:function(){var K=AI.EVT.keys;K.CTRL=false;K.SHIFT=false;K.ALT=false;if(K.toid){K.toid=window.clearTimeout(K.toid);}},toidStart:function(){this.toidStop();this.toid=window.setTimeout(this.toidStop,500);},keydown:function(E){var e=AI.EVT.fix(E);this.toidStart();this.CTRL=!!e.ctrlKey;this.SHIFT=!!e.shiftKey;this.ALT=!!e.altKey;if(parent&&parent!=self&&parent.AI){parent.AI.EVT.keys.keydown(e);}return true;},keyup:function(){this.toidStop();if(parent&&parent!=self&&parent.AI){parent.AI.EVT.keys.keyup();}return true;},listen:function(){AI.EVT.add(document,'keydown',this.keydown,this);AI.EVT.add(document,'keyup',this.keyup,this);},stop:function(){AI.EVT.remove(document,'keydown',this.keydown,this);AI.EVT.remove(document,'keyup',this.keyup,this);}};
AI.XHR=AI.getSimilarParentObject('XHR')||function(){var defaultHandlers={},requetes=[],totalRequetes=0,esc=function(S){var f;if(AI.features.isGlobalProperty('encodeURIComponent')){f=function(s){return window.encodeURIComponent(s);};}else if(AI.features.isGlobalProperty('escape')){f=function(s){return window.escape(s);};}else{f=function(s){return s;};}return(esc=f)(S);},createRequete=function(){var f,m=AI.features.isGlobalProperty,ok=true;if(m('XMLHttpRequest')){f=function(){return new window.XMLHttpRequest();};}else if(m('createRequest')){f=function(){return window.createRequest();};}else if(m('ActiveXObject')){f=function(){var r=null;try{r=new window.ActiveXObject("Microsoft.XMLHTTP");}catch(e){}return r;};}else{ok=false;f=function(){return null;};}if(!ok&&AI&&AI.console){AI.console.stop('Pas de support XMLHttpRequest');}return(createRequete=f)();};function callDef(T,C,F,a1,a2,a3){var i,m,dH=defaultHandlers;if(typeof dH[T]!='undefined'&&dH[T].length>0){for(i=0,m=dH[T].length;i<m;i++){dH[T][i].call(C,a1,a2,a3);}}if(typeof F==='function'){F.call(C,a1,a2,a3);}}function dispose(R){var i,r;if(R){requetes.remove(R);R.onreadystatechange=function(){};if(typeof R.abort==='function'){try{R.abort();}catch(e){}}callDef('dispose',this);for(i=requetes.length;i--;){r=requetes[i];if(r.parsed&&r.readyState==4){requetes.remove(r);}}}R=null;return null;}function send(params){var rConf=function(params,key,defaut){return typeof params[key]=='undefined'?defaut:params[key];},url=rConf(params,'url',''),methode=rConf(params,'methode','').toUpperCase()=='POST'?'POST':'GET',charset=rConf(params,'charset','UTF-8'),datas=rConf(params,'datas',{}),scope=rConf(params,'scope',this),context=rConf(params,'context',scope),arbitrary=rConf(params,'arbitrary',null),_oninit=rConf(params,'oninit',function(){}),_onload=rConf(params,'onload',function(){}),_onerror=rConf(params,'onerror',function(){}),_onprogress=rConf(params,'onprogress',function(){}),_onfinish=rConf(params,'onfinish',function(){}),req=createRequete(),content=null,queryString=[];if(typeof params.scope!='undefined'){AI.console.error('AI.XHR.send("scope")est DEPRECATED,utiliser "context"');}if(typeof params.unique!='undefined'){AI.console.error('AI.XHR.send("unique")est inutile,à supprimer');}if(typeof url!='string'||''===url){return AI.console.stop("L'url de l'appel XHR est requise");}if(!req){return AI.console.stop("Impossible de créer l'objet XMLHttpRequest. Pas de gestion XHR");}totalRequetes++;requetes.push(req);if('GET'==methode){datas.uidAIXHR=''+(new Date().getTime())+totalRequetes;}AI.utils.forOwn(datas,function(o,k,v){queryString.push(esc(k)+'='+esc(v));});queryString=queryString.join('&');if('GET'==methode&&queryString!==''){url+=((url.indexOf('?')>-1)?'&':'?')+queryString;}req.open(methode,url,true);req.setRequestHeader('User-Agent','XMLHTTP/1.0');if('POST'==methode){req.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset='+charset);content=queryString;}req.onreadystatechange=function(){var status=0;if(req){callDef('progress',context,_onprogress,req,arbitrary);if(req.readyState==4){try{status=req.status;}catch(e){}if(status==200){callDef('load',context,_onload,req,arbitrary);}else{callDef('error',context,_onerror,req,arbitrary);}callDef('finish',context,_onfinish,req,arbitrary);req=dispose(req);}}};callDef('init',context,_oninit,arbitrary);req.send(content);return req;}AI.EVT.unloader(function(){for(var i=requetes.length;i--;){requetes[i]=dispose(requetes[i]);}requetes=null;});return{send:send,dispose:dispose,parseJSONFallback:function(D){var r=null;try{eval("r="+D);}catch(e){}return r;},parseJSON:function(D){if(AI.features.isGlobalProperty("JSON")&&AI.features.isObjectProperty(window.JSON,'parse')){AI.XHR.parseJSON=function(d){try{return window.JSON.parse(d);}catch(e){}return AI.XHR.parseJSONFallback(d);};}else{AI.XHR.parseJSON=AI.XHR.parseJSONFallback;}return AI.XHR.parseJSON(D);},parse:function(R){var d=(typeof R=='string'?R:R.responseText)||'';R.parsed=true;return AI.XHR.parseJSON(d);},setDefaultHandler:function(T,C){if(typeof defaultHandlers[T]=='undefined'){defaultHandlers[T]=[];}defaultHandlers[T].push(C);},getRequetes:function(){return requetes;},getTotalRequetes:function(){return totalRequetes;}};}();AI.AJAX=AI.XHR;
AI.ANIMATION=function(opt){var subjects=[],target=0,state=0,intervalId=null,step=opt&&opt.step?opt.step:10,duration=opt&&opt.duration?opt.duration:400,transition=opt&&opt.transition?opt.transition:AI.ANIMATION.tx.easeInOut,onComplete=opt&&opt.onComplete?opt.onComplete:function(){},onStart=opt&&opt.onStart?opt.onStart:function(){},onStep=opt&&opt.onStep?opt.onStep:function(){},scope=opt&&opt.scope?opt.scope:this,linked=opt&&opt.linked?opt.linked:null,starting=false,interval=duration/step;function propagate(){var i,value=transition(state);for(i=0;i<subjects.length;i++){if(subjects[i].setState){subjects[i].setState(value);}else{subjects[i](value);}}return this;}function onTimerEvent(){var movement=(interval/duration)*(state<target?1:-1);if(starting===true){onStart.call(this,state,linked);starting=false;}if(Math.abs(movement)>=Math.abs(state-target)){state=target;}else{state+=movement;}propagate();onStep.call(scope,state,linked);if(target==state){clearInterval(intervalId);intervalId=null;onComplete.call(scope,target,linked);}}this.seekTo=function(dest){return this.seekFromTo(state,dest);};this.seekFromTo=function(from,dest){starting=true;target=Math.max(0,Math.min(1,dest));state=Math.max(0,Math.min(1,from));if(!intervalId){intervalId=setInterval(onTimerEvent,interval);}return this;};this.jumpTo=function(dest){target=state=Math.max(0,Math.min(1,dest));starting=true;onTimerEvent();return this;};this.toggle=function(){this.seekTo(1-target);return this;};this.addSubject=function(subject){subjects.push(subject);return this;};this.removeSubject=function(subject){subjects.remove(subject);return this;};this.clearSubjects=function(){subjects=[];return this;};this.play=function(){return this.seekFromTo(0,1);};this.reverse=function(){return this.seekFromTo(1,0);};this.setInterval=function(I){interval=I;return this;};this.setDuration=function(D){duration=D;return this;};this.setTransition=function(T){transition=T;return this;};this.setOnComplete=function(O){onComplete=O;return this;};this.setScope=function(S){scope=S;return this;};return this;};AI.ANIMATION.makeEaseIn=function(a){return function(state){return Math.pow(state,a*2);};};AI.ANIMATION.makeEaseOut=function(a){return function(state){return 1-Math.pow(1-state,a*2);};};AI.ANIMATION.tx={easeInOut:function(pos){return((-Math.cos(pos*Math.PI)/2)+0.5);},linear:function(x){return x;},easeIn:AI.ANIMATION.makeEaseIn(1.5),easeOut:AI.ANIMATION.makeEaseOut(1.5)};AI.ANIMATION.numericalTransition=function(E,P,F,T,U){var els=AI.utils.forceArray(E),property=P=='opacity'&&AI.BROWSER.IE?'filter':P,from=parseFloat(F),dest=parseFloat(T),units=U||'px';function getStyle(state){state=from+((dest-from)*state);if(property=='filter'){return "alpha(opacity="+Math.round(state*100)+")";}if(property=='opacity'){return state;}return Math.round(state)+units;}this.setState=function(state){var i,style=getStyle(state);for(i=0;i<els.length;i++){els[i].style[property]=style;}};return this;};AI.ANIMATION.widgetNumericalTransition=function(W,prop,T){var els=AI.utils.forceArray(W),from=parseFloat(W['get'+prop]()),dest=parseFloat(T);function getStyle(state){state=Math.round(from+((dest-from)*state));return Math.round(state);}this.setState=function(state){var i,style=getStyle(state);for(i=0;i<els.length;i++){els[i]['set'+prop](style);}};return this;};AI.ANIMATION.colorTransition=function(E,P,F,T){var els=AI.utils.forceArray(E),property=P=='opacity'&&AI.BROWSER.IE?'filter':P,from,dest;function expandColor(color){var hexColor,R,G,B;hexColor=AI.ANIMATION.parseColor(color);if(hexColor){R=parseInt(hexColor.slice(1,3),16);G=parseInt(hexColor.slice(3,5),16);B=parseInt(hexColor.slice(5,7),16);return[R,G,B];}return[255,255,255];}from=expandColor(F);dest=expandColor(T);function getStyle(color,state){return AI.ANIMATION.toColorPart(Math.round(from[color]+((dest[color]-from[color])*state)));}this.setState=function(state){var i,color='#'+getStyle(0,state)+getStyle(1,state)+getStyle(2,state);for(i=0;i<els.length;i++){els[i].style[property]=color;}};return this;};AI.ANIMATION.toColorPart=function(str){var digits=str.toString(16);if(str<16){return '0'+digits;}return digits;};AI.ANIMATION.parseColor=function(string){var color='#',match=AI.ANIMATION.rgbRe.exec(string),i;if(match){for(i=1;i<=3;i++){color+=AI.ANIMATION.toColorPart(Math.max(0,Math.min(255,intval(match[i]))));}return color;}match=AI.ANIMATION.hexRe.exec(string);if(match){if(match[1].length==3){for(i=0;i<3;i++){color+=match[1].charAt(i)+match[1].charAt(i);}return color;}return '#'+match[1];}return false;};AI.ANIMATION.rgbRe=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i;AI.ANIMATION.hexRe=/^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;var Animation=AI.ANIMATION;
