var SESSION; var debugOnce=0; var ie=false, ie11=false, ie10=false, ie9=false, ie8=false, ie7=false, ie6=false, ns=(navigator.appName.indexOf("Netscape")!=-1)||window.opera; if(!ns){ ie=true; var ieversion=parseInt(navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE")+5) ); if(ieversion>=10){ ie9=true; ie10=true; }else if(ieversion>=9){ ie9=true; }else if(ieversion>=8){ ie8=true; }else if(ieversion>=7){ ie7=true; }else{ ie6=true; } setCookie('ieversion',ieversion,31536000); }else{ var ie11reg=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/g; var ieversion=ie11reg.exec(navigator.userAgent); if(ieversion && typeof ieversion[1]!='undefined'){ ieversion=parseInt(ieversion[1]); ie=true; if(ieversion>=11){ ie11=true; ie10=true; } setCookie('ieversion',ieversion,31536000); } } var isMobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); var isApple = (/iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase())); var isAndroid = (/android/i.test(navigator.userAgent.toLowerCase())); var isGingerbread = isAndroid && (/gingerbread/i.test(navigator.userAgent.toLowerCase())); var mobileOrientation=0; var isTouch = (('ontouchstart' in window) || (window.navigator.msMaxTouchPoint)); var count_popDHTML=0; function getCookie(name){ var start=document.cookie.indexOf(name+'='); if((!start)&&(name!=document.cookie.substring(0,name.length))){return null;} if(start==-1)return null; var len=start+name.length+1; var end=document.cookie.indexOf(";",len); if(end==-1)end=document.cookie.length; var retour=unescape(document.cookie.substring(len,end)); start=null;len=null;name=null;end=null; return retour; } function setCookie(name,val,expsec){ var expdate=new Date(); expdate.setTime(parseInt(expdate.getTime()) + parseInt(expsec*1000)); var c_val=escape(val) + "; path=/" + ((expsec==null) ? "" : "; expires="+expdate.toUTCString()); document.cookie=name + "=" + c_val; expdate=null;name=null;val=null;expsec=null;c_val=null; } function getParamFromQuerystring(key,url){ key=key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regex=new RegExp("[\\?&]"+key+"=([^&#\/]*)"); var qs=regex.exec(url); key=null;url=null;regex=null; if(qs == null) return; else return qs[1]; } function include(destination){ var ext=destination.split('.').pop(); if(ext=='css'){ var e=window.document.createElement('link'); e.setAttribute('rel','stylesheet'); e.setAttribute('href',destination); e.setAttribute('type','text/css'); e.setAttribute('media','all'); var head=document.getElementsByTagName('head'); if(head[0]){ head[0].appendChild(e); } head=null; }else{ var e=window.document.createElement('script'); e.setAttribute('type','text/javascript'); e.setAttribute('src',destination); window.document.body.appendChild(e); } destination=null;ext=null;e=null; } function getCSS(el,att){ var retour; if(window.getComputedStyle){ var style=window.getComputedStyle(el,""); retour=style.getPropertyValue(att); style=null; }else{ retour=el.currentStyle[att]; } el=null;att=null; return retour; } function hasFlash(){ if(isApple||isMobile){return false;} try { var fo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); if(fo){ fo=null; return true;} }catch(e){ if(navigator.mimeTypes && typeof navigator.mimeTypes ["application/x-shockwave-flash"] != undefined){ return true; } } return false; } function getWindowXY(){ var x=0,y=0; if(typeof(window.innerWidth)=='number'){x=window.innerWidth;y=window.innerHeight;} else if(!ie7 && !ie8 && window.screen) {x=window.screen.availWidth; y=window.screen.availHeight; } else if(document.documentElement && document.documentElement.clientWidth){x=document.documentElement.clientWidth;y=document.documentElement.clientHeight;} else if(document.body && document.body.clientWidth){x=document.body.clientWidth;y=document.body.clientHeight;} var retour=[x,y]; x=null;y=null; return retour; } function getDocumentXY(){ var D = document; var x=0,y=0; x=Math.max( Math.max(D.body.scrollWidth, D.documentElement.scrollWidth), Math.max(D.body.offsetWidth, D.documentElement.offsetWidth), Math.max(D.body.clientWidth, D.documentElement.clientWidth) ); y=Math.max( Math.max(D.body.scrollHeight, D.documentElement.scrollHeight), Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), Math.max(D.body.clientHeight, D.documentElement.clientHeight) ); var retour=[x,y]; x=null;y=null;D=null; return retour; } function getScrollXY(){ var x=0,y=0; if(typeof(window.pageYOffset)=='number'){x=window.pageXOffset;y=window.pageYOffset;} else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){x=document.body.scrollLeft;y=document.body.scrollTop;} else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){x=document.documentElement.scrollLeft;y=document.documentElement.scrollTop;} var retour=[x,y]; x=null;y=null; return retour; } function getObjXY(obj){ // bug: pos absolue var curleft=0,curtop=0; if(obj.offsetParent){ do{ curleft+=obj.offsetLeft;curtop+=obj.offsetTop; }while(obj=obj.offsetParent); } var retour=[curleft,curtop]; curleft=null;curtop=null;obj=null; return retour; } function getMousePos(e){ var x=0,y=0; if(!e){var e=window.event;} if(e.pageX||e.pageY){x=e.pageX;y=e.pageY;} if(e.clientX||e.clientY){x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;} var retour=[x,y]; x=null;y=null;e=null; return retour; } function cancelDefaultBehavior(e){ if(!e&&window.event){var e=window.event;e.returnValue=false;} else if(e&&e.preventDefault){e.preventDefault();} e=null; return false; } function handleTouchStart(e){ this.xDown=e.touches[0].clientX; this.yDown=e.touches[0].clientY; this.xUp=null; this.yUp=null; } function handleTouchMove(e){ if(!this.xDown||!this.yDown){return;} this.xUp=e.touches[0].clientX; this.yUp=e.touches[0].clientY; } function handleTouchEnd(){ if(this.xUp==null || this.yUp==null){ this.swipeCallback('cancel'); return; } var xDiff=this.xDown-this.xUp; var yDiff=this.yDown-this.yUp; var swipeLimit=50; if(this.swipeLimit){swipeLimit=this.swipeLimit;} if(Math.max(Math.abs(xDiff),Math.abs(yDiff))<=swipeLimit){ this.swipeCallback('cancel'); return; } var dir=null; if(Math.abs(xDiff)>Math.abs(yDiff)){ if(xDiff>0){dir='left';} else{dir='right';} }else{ if(yDiff>0){dir='up';} else{dir='down';} } this.swipeCallback(dir); } function addEvent(obj,etype,func){ if(etype=='swipe'){ obj.swipeCallback=func; addEvent(obj,'touchstart',handleTouchStart); addEvent(obj,'touchmove',handleTouchMove); addEvent(obj,'touchend',handleTouchEnd); }else if(obj==document && etype=='ready' && typeof $ !='undefined'){ $(document).ready(func); }else if(obj==window && etype=='load' && typeof $ !='undefined'){ $(document).ready(func); }else{ if(obj==window && etype=='complete'){ etype='load'; } if(obj&&obj.addEventListener)obj.addEventListener(etype,func,false); else if(obj.attachEvent){obj["e"+etype+func]=func;obj.attachEvent("on"+etype,function(){obj["e"+etype+func]();});} } } function createNodeTree(node,container){ if(node.nodeType==1){ var newNode; if(ie&&ieversion<=7&&node.nodeName=='input'){// fix IE bug var tmp=''; var newNode = document.createElement('input'); for(var j=0;j"); tmp=null; }else if(ie&&ieversion<=7&&node.nodeName=='iframe'){// fix IE bug var tmp=''; var newNode = document.createElement('iframe'); for(var j=0;j"); tmp=null; }else if(ie&&ieversion<=7&&node.nodeName=='iframe'){// fix IE bug }else{ newNode=document.createElement(node.nodeName); var att; for(var j=0;jyDoc){ yPop=yWin; }else{ yPop=yDoc; } yPop+=10; m.style.height=yPop+"px";m.style.right="0px"; window.document.body.appendChild(m); $(".zopim").addClass('hide'); if(ie6){ sels=document.getElementsByTagName('select'); for(var i=0; i0){ e.style.width=w+"px"; }else{ w=0; } if(h=='auto'){ if(e.offsetHeight && e.offsetHeight>10){ h=e.offsetHeight+100; }else{ h=100; } e.oH=h; if(e.firstChild && e.firstChild.style){e.firstChild.style.marginTop='50px';} } if(h>0){ e.style.height=h+"px"; }else{ h=0; } reposPopDHTML(id); addEvent(window,'resize',function(){reposPopDHTML(id);}); if(closelink && m){ if(closelink.currentStyle){ var closelink_style=closelink.currentStyle['display']; }else if(window.getComputedStyle){ var closelink_style=document.defaultView.getComputedStyle(closelink,null).getPropertyValue('display'); } if(closelink_style && closelink_style!='none'){ addEvent(m,'click',function(){delPopDHTML(id);}); } } content=null;w=null;h=null;mask=null;closelink=null;e=null;m=null; } // repositionne le popup DTML function reposPopDHTML(id){ var tmp; tmp=getWindowXY(); xWin=tmp[0]; yWin=tmp[1]; tmp=getDocumentXY();xDoc=tmp[0];yDoc=tmp[1]; yPop=yWin; var m=document.getElementById('popmask'); if(m){ if(yWin>yDoc){ mHeight=yWin; }else{ mHeight=yDoc; } yPop+=10; m.style.height=mHeight+"px"; m.style.right="0px"; } var e=document.getElementById(id); if(!e){ return; } if(e.oW || typeof e.oW!='number'){ w=e.oW; }else{ w=500; } if(e.oH || typeof e.oH!='number'){ h=e.oH; }else{ h=300; } var xPop=(xWin-w)/2-10; var yPop=(yWin-h)/2-10; if(yPop<0){ yPop=5; } if(xPop<0){ xPop=5; } if(ie6){ tmp=getScrollXY();xScr=tmp[0];yScr=tmp[1];xPop+=xScr;yPop+=yScr; } e.style.left=(xPop-5)+"px"; e.style.top=yPop+"px"; e=null; } function delPopDHTML(id){ var el=document.getElementById(id); var m=document.getElementById('popmask'); if(el && el.mask) count_popDHTML--; if(window.document.body){ if(el){ window.document.body.removeChild(el); } if(m && count_popDHTML==0){ window.document.body.removeChild(m); $(".zopim").removeClass('hide'); sels=document.getElementsByTagName('select'); for(var i=0; i/g,''); } audio[i].parentNode.innerHTML=audio[i].innerHTML; } } } } function showAudioControls(source){ if(!isAndroid || isGingerbread){ return; } var audio=source.getElementsByTagName('audio'); for(var i=0; iavailXY[0] && (y+pop.offsetHeight+50)>availXY[1]){// x invalide; y invalide pop.style.top=(y-pop.offsetHeight-10)+'px'; pop.style.left=(availXY[0]-pop.offsetWidth-10)+'px'; }else if((x+pop.offsetWidth)>availXY[0]){// x invalide pop.style.top=(y+50)+'px'; pop.style.left=(availXY[0]-pop.offsetWidth-10)+'px'; }else if((y+pop.offsetHeight)>availXY[1]){// y invalide pop.style.top=(y-pop.offsetHeight-10)+'px'; pop.style.left=(x-this.offsetWidth-10)+'px'; }else{ pop.style.top=y+'px'; pop.style.left=x+'px'; } this.tmptitle=this.title; this.title=''; } function hideHint(){ pop=document.getElementById('pophint'); if(pop) pop.parentNode.removeChild(pop); if(typeof this.tmptitle != 'undefined' && this.tmptitle!=''){ this.title=this.tmptitle; this.tmptitle=''; } } function initVideos(source){ var obj=source.getElementsByTagName('iframe'); for(var i=0; i=docXY[1] && winXY[1]>0 && docXY[1]>0){ footer.style.position='absolute'; footer.style.bottom='0px'; footer.style.left='0px'; }else{ footer.style.position='relative'; footer.style.bottom='auto'; } } function smoothScroll(origY,destY,dir){ if(typeof 'dir'== undefined || dir!='up') dir='down'; var speed=8; if(ie6) speed=Math.floor(speed/2); if(dir=='up') origY=origY-Math.floor((origY-destY)/speed); else origY=origY+Math.floor((destY-origY)/speed); if( (dir=='down' && origY>=destY) || (dir=='up' && origY<=destY) ){ window.scrollTo(0,destY); }else{ var tmp=getScrollXY(); var oldY=tmp[1]; window.scrollTo(0,origY); tmp=getScrollXY(); var newY=tmp[1]; if(oldY==newY) window.scrollTo(0,destY); else setTimeout('smoothScroll('+origY+','+destY+',"'+dir+'")',speed); } } var XHRTimer; function getXHRObject(){ var XHR=null; if (window.XMLHttpRequest) { XHR = new XMLHttpRequest(); }else if(window.ActiveXObject){ try{ XHR=new ActiveXObject("Msxml2.XMLHTTP"); }catch (e){ try{ XHR=new ActiveXObject("Microsoft.XMLHTTP"); }catch (e){ return null; } } } return XHR; } // CORRIGER LA METHODE DE DETECTION DE TIMETOUT // Si on envoit des requetes successives trop rapidement, le delai avant l'alerte de timeout n'est pas cleare // On a acces a SESSION. On pourrait l'inclure automatiquement si elle est settee, plutot que de demander de l'inclure dans les infos de pages // ... function XHRQuery(page,method,data,response,handler,sync) { var XHR=getXHRObject(); if(!XHR){ alert('JavaScript : votre navigateur ne supporte pas les objets XMLHttpRequest...'); return false; } if(typeof data =='string'){ data+='&nocache='+Math.random()*100000; } if(page.indexOf('sellocation')==0){ page="/inc/js/"+page; } if(!method){ method='get'; } if(response){ response=response.toLowerCase(); } method=method.toLowerCase(); // ie6 a besoin des params dans le url, pas dans send() if(ie6 || method=='get'){ if(page.indexOf('?')==-1){ page+='?'+data; } else{ page+='&'+data; } } var async=true; if(sync){ async=false; } XHRTimer=setTimeout(XHRTimeout,10000); XHR.open(method,page,async); if(async){ // asynchonous XHR.onreadystatechange = function() { if (XHR.readyState == 4) { force_return=XHRCallback(XHR,response,handler); if(force_return){ return force_return; } } } } if(typeof data.name!='undefined'){ // UPLOAD FICHIER AJAX XHR.setRequestHeader('X_FILENAME',data.name); XHR.send(data); }else if(method=='post'){ XHR.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XHR.send(data); }else{ XHR.send(); } if(!async){ // synchronous force_return=XHRCallback(XHR,response,handler); if(force_return){ return force_return; } } } function XHRCallback(XHR,response,handler){ if(XHRTimer){ clearTimeout(XHRTimer); } if(XHR.status==200){ var result; if(response=='xml'){ if(!XHR.responseXml && XHR.responseText.indexOf('expire')!=-1){ top.location.replace("/error/expire.php"); }else{ result=XHR.responseXML.documentElement; } }else{ result=XHR.responseText; } if(typeof handler == 'function'){ handler(result); }else if(handler=='RETURN'){ return result; }else{ eval(result); } }else if(XHR.status==403){ // session expiree top.location.replace("/error/expire.php"); }else if(XHR.status!=0){ // erreur de connection (404, 500, etc.) alert('ERROR '+XHR.status+": "+XHR.statusText); } } function XHRTimeout(){ // alert('Error: Request timeout'); if(XHRTimer){ clearTimeout(XHRTimer); } } var hash; if(window.location.hash.length>1){ hash=window.location.hash.replace(/^#ss/,''); hash=hash.replace(/^#/,''); window.scrollTo(0,0); }