var agent = navigator.userAgent.toLowerCase(); //console.log("hello world"); /** * Common popup fonction */ function popup(url, width, height, scroll, windowName) { if (url != 0) { var top = (screen.height - height) / 2; var left = (screen.width - width) / 2; if (!windowName) windowName = 'popupLag'; oWinPop = window.open(url, windowName, 'top=' + top + ',left=' + left + ',resizable=no,location=no,menubar=no,scrollbars=' + scroll + ',status=no,toolbar=no,fullscreen=no,dependent=no,width=' + width + ',height=' + height); return false; // oWinPop.focus(); } } function setupPopup() { if (!document.getElementsByTagName) return; // Implémentation du lien d'impression if (document.getElementById("envoie")) { var monElemList = document.createElement("li"); var monLienPrint = document.createElement("a"); var monText = document.createTextNode("Print"); monLienPrint.id = "imprime"; monLienPrint.href = "window.print()"; monLienPrint.onclick = function () { window.print(); return (false); } monLienPrint.appendChild(monText); monElemList.appendChild(monLienPrint); document.getElementById("envoie").parentNode.parentNode.insertBefore(monElemList, document.getElementById("envoie").parentNode); } var all_links = document.getElementsByTagName("a"); for (var i = 0; i < all_links.length; i++) { var myLink = all_links[i]; // les popups if (myLink.className && (" " + myLink.className + " ").indexOf("popup") != -1) { // code for safari mac if (agent.indexOf("safari") != -1) { myLink.onclick = function () { clickPopup(this); return (false); } } else { addEvent(myLink, "click", clickPopup, false); addEvent(myLink, "click", cancelClick, false); } } // les liens de fermeture de fen�tre if (myLink.className && (" " + myLink.className + " ").indexOf(" closeWin ") != -1) { // code for safari mac if (agent.indexOf("safari") != -1) { myLink.onclick = function () { window.close(); return (false); } } else { addEvent(myLink, "click", closeWin, false); addEvent(myLink, "click", cancelClick, false); } } // les liens documents if ((myLink.href.indexOf(".pdf") != -1 || myLink.href.indexOf(".xls") != -1 || myLink.href.indexOf(".doc") != -1 || myLink.href.indexOf(".ppt") != -1) && (agent.indexOf("safari") == -1)) { myLink.target = "_blank"; } // les liens blank else if (myLink.className && (" " + myLink.className + " ").indexOf(" blank ") != -1) { myLink.target = "_blank"; } } /* affichage du bon background au roll-over sur le li correspondant */ var menu = document.getElementById("menudyn"); var tabli = document.getElementsByTagName("li"); var vraisTabLi = new Array(); for (var i = 0; i < tabli.length; i++) { var monElemTab = tabli[i]; if (monElemTab.parentNode.parentNode.id != undefined && monElemTab.parentNode.parentNode.id == "menudyn") { vraisTabLi.unshift(monElemTab); } } // apply fonctionnality on top menu main li items for (var i = 0; i < vraisTabLi.length; i++) { var monLi = vraisTabLi[i]; // display current rubrique on if (menuTopCurrentRubrique == monLi.firstChild.id) monLi.firstChild.style.backgroundPosition = "0px -15px"; // handle rollover and disable current rubrique rollover monLi.onmouseover = function () { if (menuTopCurrentRubrique != this.firstChild.id) this.firstChild.style.backgroundPosition = "0px -15px"; } monLi.onmouseout = function () { if (menuTopCurrentRubrique != this.firstChild.id) this.firstChild.style.backgroundPosition = "0px 0px"; } } } function clickPopup(e) { /* not for safari mac */ if (agent.indexOf("safari") == -1) { var target = findTarget(e); } if (agent.indexOf("safari") != -1) { var target = e; } if (!target) { return false; } else { var myLink = target.href; if (target.className && (" " + target.className + " ").indexOf(" popupAudio ") != -1) { myHeight = "height=150"; } else { myHeight = "height=405"; } var top = (screen.height - myHeight) / 2; var left = (screen.width - 380) / 2; eval('window.open(myLink, "popupAudio", "top="+top+",left="+left+", width=380, height="+myHeight+", status=yes, toolbar=no, resizable=yes, menubar=no, location=no, scrollbars=no")'); } } function closeWin(e) { var target = findTarget(e); if (!target) { return false; } else { window.close(); } } function findTarget(e) { /* part of the DOM EVENT */ var target; if (window.event && window.event.srcElement) target = window.event.srcElement; else if (e && e.target) target = e.target; if (!target) return null; return target; } function cancelClick(e) { if (window.event && window.event.returnValue) { window.event.returnValue = false; } if (e && e.preventDefault) { e.preventDefault(); } return false; } addLoadListener(setupPopup); $(document).ready(function () { $('embed').each(function () { var src = $(this).attr('src'); var width = $(this).attr('width'); var height = $(this).attr('height'); var id = $(this).attr('id'); var name = $(this).attr('name'); var bgcolor = $(this).attr('bgcolor'); var quality = $(this).attr('quality'); var wmode = $(this).attr('wmode'); var flashvars = $(this).attr('flashvars'); $(this).replaceWith(""); }); });