var Loader=Class.create({initialize:function(){this.script=$H();this.loader=false},add:function(script){this.script.set(this.script.size(),script)},load:function(){var local=this;if(!this.loader&&!document.loaded){this.loader=setInterval(function(){local.load()},100)}if(document.loaded){clearInterval(this.loader);this.script.toJSON().evalJSON();this.script.each(function(script){if(typeof(script.value)==="function"){script.value()}})}}});var Callback=Class.create({initialize:function(div,marginTop,animated){var local=this;this.div=div;this.top=$(this.div).positionedOffset()['top'];this.marge=marginTop;this.animated=animated;window.onscroll=function(){local.scroll()}},scroll:function(){var local=this;if(document.viewport.getScrollOffsets()['top']>this.top){if(this.animated){new Effect.Move(this.div,{y:(document.viewport.getScrollOffsets()['top']-this.top+this.marge),duration:0.3,mode:'absolute'})}else{$(this.div).style.top=(document.viewport.getScrollOffsets()['top']-this.top+this.marge)+'px'}}else{if(this.animated){new Effect.Move(this.div,{y:0,duration:0.3,mode:'absolute'})}else{$(this.div).style.top='0px'}}}});var Scroller=Class.create({initialize:function(div,prefix){this.currentBloc=0;this.prefix=prefix;this.blocs=$(div).childElements();this.totalBlocs=this.blocs.length},start:function(){var local=this;if(this.currentBloc==this.totalBlocs){this.currentBloc=1}else{this.currentBloc=this.currentBloc+1}for(i=0;i<this.totalBlocs;i++){if((i+1)==this.currentBloc){Effect.SlideDown(this.prefix+'-'+this.currentBloc)}else{$(this.prefix+'-'+(i+1)).hide()}}this.timeout=setTimeout(function(){local.start()},10000)}});var Popup=Class.create({initialize:function(name,file,width,minHeight,top,title,closable,draggable){var local=this;this.name=name;this.file=file;this.closable=closable;this.draggable=draggable;this.width=width;this.top=top;this.title=title;this.interval=setInterval(function(){local.set()},100);this.blackboard='blackboard'+this.name;this.larg=0;this.haut=0;this.minHeight=minHeight;var detect=navigator.userAgent.toLowerCase();this.ie=detect.indexOf('msie')+1},is_numeric:function(mixed_var){return(typeof(mixed_var)==='number'||typeof(mixed_var)==='string')&&mixed_var!==''&&!isNaN(mixed_var)},set:function(){var local=this;if(document.loaded){clearInterval(this.interval);if($(this.blackboard)==null){var obj=document.createElement('div');obj.setAttribute('id',this.blackboard);document.body.appendChild(obj)}$(this.blackboard).addClassName('blackboard');$(this.blackboard).onclick=function(){local.hide()};if($(this.name)==null){var box=document.createElement('div');box.setAttribute('id',this.name);document.body.appendChild(box)}$(this.name).addClassName('popup');$(this.name).style.width=this.width+'px';$(this.name).style.top=this.top+'px';var title=document.createElement('div');title.setAttribute('id',this.name+'_title');$(this.name).appendChild(title);$(this.name+'_title').addClassName('title');$(this.name+'_title').innerHTML=this.title;if(this.draggable){var move=document.createElement('span');move.setAttribute('id',this.name+'_move');$(this.name).appendChild(move);$(this.name+'_move').addClassName('move');$(this.name+'_move').title="Déplacer";new Draggable(this.name,{handle:this.name+'_move'});$(this.name+'_title').style.cursor='move';new Draggable(this.name,{handle:this.name+'_title'})}if(this.closable){var close=document.createElement('span');close.setAttribute('id',this.name+'_close');$(this.name).appendChild(close);$(this.name+'_close').addClassName('close');$(this.name+'_close').title="Fermer";$(this.name+'_close').onclick=function(){local.hide()}}var container=document.createElement('div');container.setAttribute('id',this.name+'_container');$(this.name).appendChild(container);$(this.name+'_container').addClassName('container');var container2=document.createElement('div');container2.setAttribute('id',this.name+'_container2');$(this.name+'_container').appendChild(container2);$(this.name+'_container2').addClassName('container2');var content=document.createElement('div');content.setAttribute('id',this.name+'_content');$(this.name+'_container2').appendChild(content);$(this.name+'_content').addClassName('content');$(this.name+'_content').insert('Chargement en cours ...');$(this.blackboard).hide();$(this.name).hide()}},show:function(){var local=this;new Ajax.Updater(this.name+'_content',this.file);if(window.innerHeight){this.larg=(window.innerWidth);this.haut=(window.innerHeight)}else{this.larg=(document.body.clientWidth);this.haut=(document.body.clientHeight)}$(this.name).style.left=((this.larg-this.width)/2)+'px';$(this.blackboard).style.zIndex=1000;$(this.name).style.zIndex=1001;$(this.blackboard).appear({duration:0.5,from:0.0,to:0.8});$(this.name).appear({duration:0.5,from:0.0,to:1.0});setTimeout(function(){local.resize()},500)},hide:function(){var local=this;if(this.closable&&typeof(this.closable)=='string'){location.hash='#'+this.closable}$(this.blackboard).appear({duration:0.5,from:0.8,to:0.0});$(this.name).appear({duration:0.5,from:1.0,to:0.0});setTimeout(function(){local.unset()},500)},unset:function(){$(this.blackboard).hide();$(this.blackboard).style.zIndex=0;$(this.name).hide();$(this.name).style.zIndex=0},resize:function(){var local=this;if(this.ie){var max=(this.haut-this.top+30)/2}else{var max=this.haut-(this.top*2)}if(local.is_numeric(this.minHeight)&&this.minHeight>0){if(this.minHeight>max){$(this.name).style.height=max+'px'}else{$(this.name).style.height=this.minHeight+'px'}}else{if($(this.name).getHeight()>max){$(this.name).style.height=max+'px'}}$(this.name+'_content').style.height=($(this.name).getHeight()-55)+'px'}});
