var nav = navigator.userAgent.toLowerCase() ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Menu Functions * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ function plopMenuItem(lid) { var li = document.getElementById(lid) ; if( li.className != null && li.className == "select" ) li.className = "" ; else li.className = "select" ; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TabbedPane Functions * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ function showTab(tabsid,tabid) { var tabmenuid = "tab"+tabsid+"_menu" ; var tabcontentid = "tab"+tabsid+"_content" ; var newsel_menuid = "tab"+tabsid+"m"+tabid ; var newsel_contentid = "tab"+tabsid+"b"+tabid ; // update menu var list = document.getElementById(tabmenuid).getElementsByTagName("li") ; for(var i=0; i 10 ) { document.getElementById('motif-'+ligne).value = motif.substring(0,10)+"..."; }else { document.getElementById('motif-'+ligne).value = motif; } if(document.getElementById('infoBulle'+ligne) != null) { document.getElementById('infoBulle'+ligne).innerHTML = motif; } document.getElementById('motif-Default'+ligne).value = motif; } catch(e) { document.forms[curModal["id"]][0].submit() ; } } } document.body.removeChild( curModal["divBlock"] ) ; document.body.removeChild( curModal["divModal"] ) ; } curModal = [] ; } function confirmSaisiAppreciation(res,appre,ligne) { if( curModal != null && curModal["id"] != null ) { if(res == "yes") { if( curModal["type"] == "js" ) { try { curModal["id"]() ; } catch(e) {alert(e);} } else { try { document.getElementById('appre').value = appre; document.getElementById('numLigne').value = ligne; if(appre.length > 10 ) { document.getElementById('appreciation-'+ligne).value = appre.substring(0,10)+"..."; }else { document.getElementById('appreciation-'+ligne).value = appre; } if(document.getElementById('infoBulle'+ligne) != null) { document.getElementById('infoBulle'+ligne).innerHTML = appre; } document.getElementById('appreciation-Default'+ligne).value = appre; } catch(e) { document.forms[curModal["id"]][0].submit() ; } } } document.body.removeChild( curModal["divBlock"] ) ; document.body.removeChild( curModal["divModal"] ) ; } curModal = [] ; } function popupSaisiMotif(res) { if( window.parent && window.parent.confirmSaisiMotif ) try{window.parent.confirmSaisiMotif(res,document.getElementById('motifRefus_RAW').value,document.getElementById('numLigne').value) ;} catch(e) {} } function popupSaisiAppreciation(res) { if( window.parent && window.parent.confirmSaisiAppreciation ) try{window.parent.confirmSaisiAppreciation(res,document.getElementById('appreciation_RAW').value,document.getElementById('numLigne').value) ;} catch(e) {} } function popupSaisiMotifRec(res) { if( window.parent && window.parent.confirmSaisiMotifRec ) try{window.parent.confirmSaisiMotifRec(res,document.getElementById('motif_RAW').value,document.getElementById('numLigne').value) ;} catch(e) {} } function popupConfirmSupp(res) { if( window.parent && window.parent.conResultSupp ) try{window.parent.conResultSupp(res) ;} catch(e) {} } //evo 233831 - fin function popupConfirmDownloadFileAtriaCat(res) { if( window.parent && window.parent.conResultSupp ) try{window.parent.downloadFileAtriaCat(res) ;} catch(e) {} } function downloadFileAtriaCat(res) { document.forms['form-color-cat'].submit(); popupResult('no'); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Calendar Functions * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ var months = ["Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"] ; var days = ["Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche"] ; var dps = [] ; function DatePicker() { this.calId = null ; this.div = null ; this.input = null ; this.butspan = null ; this.visible = false ; this.curY = 0 ; this.curM = 0 ; this.curD = 0 ; this.selY = 0 ; this.selM = 0 ; this.selD = 0 ; } addEvent(window, 'load', createCalendars); //addEvent(window, 'mousedown', hideAllCalendars); addEvent(window, 'mousedown', checkIfCloseCalendar); function createCalendars() { var list = document.getElementsByTagName("input") ; for(var i=0; i"+dp.curY,null,3,null) ) ; var fn3 = function(){ var y2 = m+1==12?1:0 ; updateMonthTab(dp,m+1==12?0:m+1,y+y2); } ; trTitle.appendChild( getTD(-1,"titleTD",">","5%",null,fn3) ) ; var fn4 = function(){ updateMonthTab(dp,m,y+1); } ; trTitle.appendChild( getTD(-1,"titleTD",">>","5%",null,fn4) ) ; tbody.appendChild(trTitle); var trHeader = document.createElement("tr"); trHeader.appendChild( getTH(null,"lun.","14%") ) ; trHeader.appendChild( getTH(null,"mar.","14%") ) ; trHeader.appendChild( getTH(null,"mer.","14%") ) ; trHeader.appendChild( getTH(null,"jeu.","14%") ) ; trHeader.appendChild( getTH(null,"ven.","14%") ) ; trHeader.appendChild( getTH(null,"sam.","14%") ) ; trHeader.appendChild( getTH(null,"dim.","14%") ) ; tbody.appendChild(trHeader); var today = new Date() ; var needAppend = false ; var tr = document.createElement("tr"); for(var i = 1 ; i < startDay ; i++) tr.appendChild( getTD(i,null," ",null,null,null) ) ; for(var i = 0 ; i < maxDays ; i++) { if(startDay == 8) { tbody.appendChild(tr); tr = document.createElement("tr"); startDay = 1 ; needAppend = false ; } startDay++ ; var ii = i+1 ; var isToday = (today.getDate()==ii&&today.getMonth()==m&&today.getFullYear()==y) ; var isSel = (dp.selD==ii&&dp.selM==m&&dp.selY==y) ; var fn8 = function(){ clicDay(dp,this.i,m,y); } ; tr.appendChild( getTD(ii,isSel?"dayTDsel":(isToday?"dayTDcur":"dayTD"),""+ii,null,null,fn8) ) ; needAppend = true ; } if(needAppend) tbody.appendChild(tr); table.appendChild(tbody); dp.div.innerHTML = "" ; dp.div.appendChild(table); } function clicDay(dp,d,m,y) { dp.selD = d ; dp.selM = m ; dp.selY = y ; dp.input.value = prefixNumber(d)+"/"+prefixNumber(m+1)+"/"+y ; updateMonthTab(dp,m,y); hideAllCalendars() ; } function getTD(i,className,content,w,colspan,fn) { var td = document.createElement("td"); td.i = i ; if(className!=null) td.className = className ; if(fn!=null) td.onclick = fn ; if(content!=null) td.innerHTML = content ; if(w!=null) td.width = w ; if(colspan!=null) td.colSpan = colspan ; return td ; } function getTH(className,content,w) { var th = document.createElement("th"); if(content!=null) th.innerHTML = content ; if(w!=null) th.width = w ; return th ; } function daysInMonth(iMonth, iYear) { return 32 - new Date(iYear, iMonth, 32).getDate(); } function prefixNumber(num) { if(num > 0 && num < 10) return "0"+num ; return num ; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Table Sort * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ addEvent(window, 'load', checkSortables2 ); function checkSortables2() { if( nav.indexOf("msie") != -1 ) return ; //desactivate "sortable tables" on ie (rows render problem) var list = document.getElementsByTagName("table") ; for(var i=0; i valb) ) return -1 ; if( (asc && vala > valb) || (!asc && vala < valb) ) return 1 ; return 0 ; }) ; for(var i = 0 ; i < tbody.childNodes.length ; i++) tbody.removeChild( tbody.childNodes[i] ); var altline = 1 ; for(var i = 0 ; i < rows.length ; i++) { /* if( rows[i].className == null || rows[i].className == "" || rows[i].className == "alt") { rows[i].className = altline==2?"alt":"" ; } altline = altline==1?2:1 ; */ tbody.appendChild(rows[i]); } } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * LightBulbs * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ var bulbs = [] ; var functionCheckBulbs = function() { for(var s in bulbs) { bulbs[s]["div"].parentNode.removeChild(bulbs[s]["div"]); if(bulbs[s]["altspan"] != null) bulbs[s]["altspan"].parentNode.removeChild(bulbs[s]["altspan"]); bulbs[s]["bulb"].className = bulbs[s]["oriCN"] ; } bulbs = [] ; var list = toArray(document.getElementById("div_content").getElementsByTagName("span")) ; list = list.concat( toArray(document.getElementById("div_content").getElementsByTagName("div")) ) ; for(var i = 0 ; i < list.length ; i++) { if( list[i].getAttribute("modifier") != null && list[i].getAttribute("modifier").indexOf("bulb")!=-1 ) { var forinput = list[i].getAttribute("for")!=null?document.getElementById(list[i].getAttribute("for")):null ; var altspan = null ; if(forinput != null) { var text = list[i].innerHTML ; var isErr = list[i].getAttribute("modifier").indexOf("err")!=-1 ; var isInfo = list[i].getAttribute("modifier").indexOf("info")!=-1 ; var isTriangle = list[i].getAttribute("modifier").indexOf("triangle")!=-1 ; if(isTriangle) { altspan = document.createElement("span") ; altspan.className = isErr?"contextError":(isInfo?"contextInfo":"") ; altspan.innerHTML = " " ; if(forinput.parentNode != null) { try { forinput.parentNode.insertBefore(altspan , forinput.nextSibling); } catch(e){} } } var w = 250 ; //var h = 50 ; /* var div = document.createElement("div") ; //div.className = "lightBulb" ; div.setAttribute("modifier" , list[i].getAttribute("modifier")!=null?list[i].getAttribute("modifier"):"" ); div.style.position = "absolute" ; div.style.zIndex = "15" ; div.style.width = w+"px" ; //div.style.height = h+"px" ; var indiv = document.createElement("div") ; indiv.className = "lightBulbContent" ; indiv.innerHTML = text ; div.appendChild(indiv) ; var indiv2 = document.createElement("div") ; indiv2.className = "lightBulbArrow" ; div.appendChild(indiv2) ; */ var div = document.createElement("table"); div.setAttribute("cellspacing" , "0"); div.setAttribute("cellpadding" , "0"); var divt = document.createElement("tbody"); //div.className = "tableBulb" ; div.setAttribute("modifier" , list[i].getAttribute("modifier")!=null?list[i].getAttribute("modifier"):"" ); div.style.position = "absolute" ; div.style.zIndex = "15" ; div.style.width = w+"px" ; var itaTR = document.createElement("tr"); var itaTD1 = document.createElement("td"); itaTD1.style.width = (w-16)+"px" ; itaTD1.className = "c" ; itaTD1.innerHTML = text ; itaTR.appendChild(itaTD1); var itaTD2 = document.createElement("td"); itaTD2.style.width = 16+"px" ; itaTD2.setAttribute("valign" , "top"); var indiv2 = document.createElement("div"); indiv2.className = "a" ; itaTD2.appendChild(indiv2); itaTR.appendChild(itaTD2); divt.appendChild(itaTR) ; div.appendChild(divt); try { forinput.parentNode.insertBefore(div , forinput.nextSibling); } catch(e){} var cs = {"x":0,"y":0} ; getXY2(forinput,cs); div.style.left = (cs.x - (w+5) )+"px" ; div.style.top = (cs.y - div.offsetHeight + forinput.offsetHeight)+"px" ; //div.className = "lightBulb" ; div.className = "tableBulb" ; var genid = generateID(5) ; forinput.genid = genid ; bulbs[genid] = {"div":div,"bulb":list[i],"ori":forinput,"oriCN":list[i].className,"indiv2":indiv2,"altspan":altspan } ; forinput.onmouseover = function(e){ startBulb(this.genid); } ; forinput.onfocus = function(e){ startBulb(this.genid); } ; forinput.onmouseout = function(e){ closeBulb(this.genid) ; } if(isTriangle) { altspan.genid = genid ; altspan.onmouseover = function(e){ startBulb(this.genid); } ; altspan.onmouseout = function(e){ closeBulb(this.genid) ; } } forinput.onblur = function(e){ closeBulb(this.genid) ; } div.style.display = "none" ; list[i].className = "hideme" ; } } } } ; if (window.addEventListener) // W3C standard window.addEventListener("load", functionCheckBulbs , false); else if (window.attachEvent) // Microsoft window.attachEvent("onload", functionCheckBulbs); function startBulb(id) { closeAllBulbs() ; var f = function(){ if( bulbs[id] != null ) { var cs = {"x":0,"y":0} ; getXY2(bulbs[id]["ori"],cs); bulbs[id]["div"].style.top = (cs.y - bulbs[id]["div"].offsetHeight)+"px" ; bulbs[id]["div"].style.display = "inline" ; } } ; bulbs[id]["timer"] = setTimeout(f,10); } function closeAllBulbs() { for(i in bulbs) closeBulb(i) ; } function showBulb(id) { } function closeBulb(id) { if( bulbs[id] != null ) { bulbs[id]["div"].style.display = "none" ; clearTimeout(bulbs[id]["timer"]) ; } } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Accessibility * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ var curSize = 0 ; function resizeText(multiplier) { if(curSize+multiplier > 3 || curSize+multiplier < -3) return ; curSize+=multiplier; var rootElement = document.body; //document.getElementById("div_center") ; if(rootElement.style.fontSize == "") { rootElement.style.fontSize = "1.0em"; } rootElement.style.fontSize = parseFloat(rootElement.style.fontSize) + (multiplier * 0.12) + "em"; functionCheckBulbs(); } if (window.addEventListener) // W3C standard window.addEventListener("load", checkForNavLang , false); else if (window.attachEvent) // Microsoft window.attachEvent("onload", checkForNavLang); function checkForNavLang() { try { document.getElementById("form_changelang_ok").parentNode.removeChild(document.getElementById("form_changelang_ok")) ; } catch(e){} } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Utils * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ if(!String.prototype.endsWith){ String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; } if(!String.prototype.startsWith){ String.prototype.startsWith = function (str) { return !this.indexOf(str); }; } function toArray(col) { var res = [] ; for(var i = 0 ; i < col.length ; i++) res[i] = col.item(i) ; return res ; } function isNumeric(input){ var RE = /^-{0,1}\d*\.{0,1}\d+$/; return (RE.test(input)); } function addEvent(obj, type, fn) { if( obj.attachEvent ) { obj["e"+type+fn] = fn; obj[type+fn] = function(){obj["e"+type+fn]( window.event );}; obj.attachEvent( "on"+type, obj[type+fn] ); } else { obj.addEventListener( type, fn, true ); } } function getXY(el) { var left = 0; var top = 0; while(el.offsetParent != undefined && el.offsetParent != null) { left += el.offsetLeft + (el.clientLeft != null ? el.clientLeft : 0); top += el.offsetTop + (el.clientTop != null ? el.clientTop : 0); el = el.offsetParent; } return [left,top]; } function getXY2(o, offset) { if (!o) return; offset.x += o.offsetLeft; offset.y += o.offsetTop ; getXY2(o.offsetParent, offset); } var idMap = "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789" ; function generateID(length) { var res = "" ; for(var i=0 ; i < length ; i++) { var c = self.idMap.charAt( Math.random()*self.idMap.length ); res += c ; } return res ; } function showPopup(idElement) { var element = document.getElementById(idElement) ; element.style.display = 'block'; // $(".div_center").fadeTo(200,1); } function closePopup(idElement) { var element = document.getElementById(idElement) ; element.style.display = 'none'; } function disableSubmit(){ var btnTransmettre = document.getElementById('transmettreBtn'); var transmettre = document.getElementById('transmettre'); transmettre.value = btnTransmettre.value; btnTransmettre.disabled = true; btnTransmettre.style.cursor = "not-allowed"; btnTransmettre.style.opacity = "0.65"; btnTransmettre.onclick = ""; document.formadel.submit(); }