function redirigerAccueil(msg,lang) { var pageAccueilURL; if (lang == 'en') { pageAccueilURL = "http://www.immigration-quebec.gouv.qc.ca/en/electronic-services"; } else { pageAccueilURL = "http://www.immigration-quebec.gouv.qc.ca/fr/services"; } alert(msg); location.href=pageAccueilURL; } function simulerClick(element) { var e = document.createEvent('MouseEvents'); e.initEvent('click', true, true ); element.dispatchEvent(e); } function avertirChoixChangeNiv(choix,msg) { var idx = choix.value; if (idx == 0) { if(confirm(msg)) { return true; } else { choix.checked = false; return false; } } return true; } function avertirChoixBur(choix,msg) { var idx = choix.value; if (idx == 0 || idx == 1) { if(confirm(msg)) { return true; } else { choix.checked = false; return false; } } return true; } function avertirChoixTutNon(msg) { alert(msg); } function avertirChoixTut(choix,msg,message) { var idx = choix.value; if (idx == 'TUT') { if(confirm(msg)) { return true; } else { avertirChoixTutNon(message) } } return true; } 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))); } } 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) { window.open("fermer.jspx","LogoutWindow","width=400,height=350,status=yes,resizable=yes"); } } else { if (left == 10004) { window.open("fermer.jspx","LogoutWindow","width=400,height=350,status=yes,resizable=yes"); } } } 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; } // This function is responsible for checking which button is pressed. If user clicks the right mouse button then an alert is coming out that "Right Click Not Allowed!". function whichButton(event) { if (event.button==2)//For right click { alert("Right Click Not Allowed!"); } } // This function is responsible for checking which key is being pressed. If user presses ctrl key then the an alert is coming out that "Sorry, this functionality is disabled.". function noCTRL(e) { var urlParameters = parseUrlParameters(location.search); var msg = "Cette fonctionnalité est désactivée."; var lang = urlParameters["lang"]; if(lang == 'fr'){ msg = "Cette fonctionnalité est désactivée."; } if(lang == 'en'){ msg = "Sorry, this functionality is disabled."; } if(lang == 'es'){ msg = "Sorry, this functionality is disabled."; } var code = (document.all) ? event.keyCode:e.which; //var msg = "Sorry, this functionality is disabled."; if (parseInt(code)==17) // This is the Key code for CTRL key { alert(msg); window.event.returnValue = false; } } function checkCtrlIns(event) { if (event.ctrlKey==1 || event.keyCode==45 || event.keyCode==17) { return false } else { return true } } function browser() { if (event.button == 2) if (navigator.appName == 'Microsoft Internet Explorer') { clickIE() } if (navigator.appName == 'Netscape') { clickNS } else { clickNS } //Disable right click script III- By Renigade (renigade@mediaone.net) //For full source code, visit http://www.dynamicdrive.com var message=""; /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") } function reenable() { var message=""; /////////////////////////////////// function clickIE() {if (document.all) {(message);return true;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return true;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return true") } 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; } } } } } //----------------------------------------- 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(event) { if (!event) { event = window.event; } var keyCode = event.keyCode; //BACK_SPACE_KEY if ( keyCode == BACK_SPACE_KEY && ((event.target || event.srcElement).tagName != "TEXTAREA") && ((event.target || event.srcElement).tagName != "INPUT")) { cancelEvent(event); return false; } //F5 else if ( keyCode == F5_KEY) { cancelEvent(event); return false; } }