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 closeWindow() { top.close(); window.close(); } //-------------------------------------- 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 dataTableSelectionRadio(radio) { var id = radio.name.substring(radio.name.lastIndexOf(':')); var el = radio.form.elements; for(var i = 0 ; i < el.length; i++) { if (el[i].name.substring(el[i].name.lastIndexOf(':')) == id) { el[i].checked = false; } } radio.checked = true; } function openPopupListePresence() { if('true' == document.getElementById('openPopupListePresenceFlag').value){ window.open('../saisirPresence/listePresence.jspx', '', 'location=0,status=1,scrollbars=1,width=685,height=800'); } document.getElementById('openPopupListePresenceFlag').value ='false'; return false; } function openPopupInfoComplementaire() { if('true' == document.getElementById('openPopupInfoComplementaireFlag').value){ window.open('../saisirPresence/infoComplementaire.jspx', '', 'location=0,status=1,scrollbars=1,width=685,height=800'); } document.getElementById('openPopupInfoComplementaireFlag').value ='false'; return false; } function openPopupStatistiqueRendezVous() { if('true' == document.getElementById('openPopupStatistiqueRendezVousFlag').value) { window.open('../saisirPresence/listeStatistiqueRdv.jspx', '', 'location=0,status=1,scrollbars=1,width=685,height=800'); } document.getElementById('openPopupStatistiqueRendezVousFlag').value ='false'; return false; } function delegateSubmitToHiddenButton(element) { hiddenStatutValidator = document.getElementById('statutValidator'); if(hiddenStatutValidator){ hiddenStatutValidator.value = 'valueSetted'; } //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); } }