function redirigerAccueil(msg, lang) { alert(msg); if (lang == 'en') { location.href = "http://www.immigration-quebec.gouv.qc.ca/en/electronic-services/index.html"; } else if (lang == 'es') { location.href = "http://www.immigration-quebec.gouv.qc.ca/es/servicios-electronicos/index.html"; } else { location.href = "http://www.immigration-quebec.gouv.qc.ca/fr/services/index.html"; } } function parseUrlParameters(url) { var obj = new Object(); var nvpairs = url.substring(1).split("&"); for (var idx = 0; idx < nvpairs.length; idx++) { var tokens = nvpairs[idx].split("="); obj[unescape(tokens[0])] = tokens.length == 2 ? unescape(tokens[1]) : undefined; } return obj; } function doUnload() { alert('test close'); } function doUnload(evt) { var left = window.screenLeft; var top = window.screenTop; var e = (window.event) ? window.event : evt; var y = e.clientY; var x = e.clientX; var abssize = document.body.offsetWidth-30; var IEVersion = getIEVersionNumber(); if (IEVersion >= 7) { if (y < 0 && x >= abssize) { //alert("You are about to exit : " + window.screenLeft + "," + window.screenTop + ",clientY: " + y); //window.open("fermer.jspx","LogoutWindow","width=400,height=350,status=yes,resizable=yes"); document.getElementById('quitterButton').click(); } } else if (left == 10004) { //window.open("fermer.jspx","LogoutWindow","width=400,height=350,status=yes,resizable=yes"); document.getElementById('quitterButton').click(); } } function getIEVersionNumber() { var ua = navigator.userAgent; var MSIEOffset = ua.indexOf("MSIE"); if (MSIEOffset == -1) { return 0; } else { return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset))); } } //-------------------------------------- bloquer copier coller -------------------------------- function bloqueCopierColler(e) { if (!e) var e = window.event; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); return false; } function appliqueRegleCopierColler() { for (var iForm = 0; iForm < document.forms.length; iForm++) { var formCourante = document.forms[iForm]; for (var iInput = 0; iInput < formCourante.length; iInput++) { var inputCourant = formCourante[iInput]; var styles = inputCourant.className.split(" "); for (var iStyle = 0; iStyle < styles.length; iStyle++) { var style = styles[iStyle]; if (style == "nocopy") { inputCourant.oncopy = bloqueCopierColler; } else if (style == "nopaste") { inputCourant.onpaste = bloqueCopierColler; inputCourant.ondrop = bloqueCopierColler; } else if (style == "nocut") { inputCourant.oncut = bloqueCopierColler; } } } } } //-------------------------------------- end / bloquer copier coller -------------------------------- function popupOrganismeInfo(partenaireId,uniteAdminId) { relativeURL = (partenaireId!=null)? "popup/organismeInfo.jspx?partenaireId="+partenaireId : "popup/organismeInfo.jspx?uniteAdminId="+uniteAdminId; //url = "'"+relativeURL+"'"; //alert(url); window.open(relativeURL, 'organismeInfo', 'location=0,status=1,scrollbars=1,width=600,height=800'); return false; } function closeWindow() { top.close(); window.close(); } function delegateSubmitToHiddenButton(element) { hiddenStatutValidator = document.getElementById('statutValidator'); if(hiddenStatutValidator){ hiddenStatutValidator.value = 'statutSetted'; } //find the hiddden button tdElement = element.parentNode.parentNode; var children = tdElement.childNodes; var hiddenButton = null; for(var i = 0 ; i < children.length; i++) { element = children[i]; if(element.tagName == "BUTTON") { hiddenButton = element; break; } } //simulate click if(hiddenButton != null) { hiddenButton.click(); } } //----------------------------------------- de-activate backspace et F5 buttons events ------------------------ F5_KEY = 116; BACK_SPACE_KEY = 8; document.onkeydown=checkKey; function cancelEvent(event) { event.keyCode = 0; event.cancelBubble = true; if (navigator.userAgent.toLowerCase().indexOf("msie") == -1) { event.stopPropagation(); } else { //alert("prevented"); event.returnValue = false; } } function checkKey(e) { if (!e) var e = window.event; var keyCode = e.keyCode; //----------------------- desactivation de F5 et BACK_SPACE ------------------- //BACK_SPACE_KEY if ( keyCode == BACK_SPACE_KEY && ((e.target || e.srcElement).tagName != "TEXTAREA") && ((e.target || e.srcElement).tagName != "INPUT") ) { cancelEvent(e); return false; } //F5 else if ( keyCode == F5_KEY) { cancelEvent(e); return false; } } function capitalizeRefNumber(inputTextElement) { var val = inputTextElement.value; if(val.charAt(0) == 'c') { inputTextElement.value = val.charAt(0).toUpperCase() + val.slice(1); } }