var h = 0; var l = 0; var i = 161; var j = 0; function departPopUpAlerte() { recalagePopUpAlerte(); affichagePopUpAlerte(); } function affichagePopUpAlerte() { var comment = "
Programmes TV par Email
\"Fermer
Inscription Gratuite\"\"
\"Valider
"; expression = document.getElementById('montextePopUpAlerte'); expression.innerHTML = comment; document.getElementById('montextePopUpAlerte').style.position = "absolute"; var d=dimension_detect(); var newTop = h + d.top; var newLeft = l; if (self.innerWidth) { newLeft = newLeft - 10; } document.getElementById('montextePopUpAlerte').style.left = newLeft+"px"; document.getElementById('montextePopUpAlerte').style.top = newTop+"px"; document.getElementById('montextePopUpAlerte').style.zIndex = 10000; setTimeout("deplacementPopUpAlerte()",10); } function deplacementPopUpAlerte() { document.getElementById('messengerPopUpAlerte').style.left = j+"px"; document.getElementById('messengerPopUpAlerte').style.top = i+"px"; i = i - 4; if (i > 0) { setTimeout("deplacementPopUpAlerte()",10); } else { document.getElementById('messengerPopUpAlerte').style.top = 0+"px"; timerRecalage = setInterval("recalagePopUpAlerte()",100); } } var dimension_detect=function() { var d={'viewW':0,'viewH':0,'docH':0,'docW':0,'left':0,'top':0}; if (document.body.scrollHeight>document.body.offsetHeight) { d.docW=document.body.scrollWidth; d.docH=document.body.scrollHeight; } else { d.docW=document.body.offsetWidth; d.docH=document.body.offsetHeight; } if (self.innerWidth) { d.viewW=self.innerWidth; d.viewH=self.innerHeight; d.left=window.pageXOffset; d.top=window.pageYOffset; } else { var ie=(document.compatMode&&document.compatMode!='BackCompat')?document.documentElement:document.body; d.viewW=ie.clientWidth; d.viewH=ie.clientHeight; d.left=ie.scrollLeft; d.top=ie.scrollTop; } return d; }; var timerRecalage; function recalagePopUpAlerte() { var d=dimension_detect(); var larg = d.viewW; var haut = d.viewH; if (self.innerWidth) { larg = larg - 20; } h = haut - 161; l = larg - 200; var newTop = h + d.top; var newLeft = l; //window.alert("newTop : "+newTop); document.getElementById('montextePopUpAlerte').style.left = newLeft+"px"; document.getElementById('montextePopUpAlerte').style.top = newTop+"px"; } function decalagePopUpAlerte() { var d=dimension_detect(); var scrollingTop = d.top; var scrollingLeft = d.left; if (self.innerWidth) { scrollingLeft = scrollingLeft - 10; } var l2=scrollingLeft + l; var h2=scrollingTop + h; document.getElementById('montextePopUpAlerte').style.left = l2+"px"; document.getElementById('montextePopUpAlerte').style.top = h2+"px"; } window.onload = function() { departPopUpAlerte(); } function rangerPopUpAlerte() { clearInterval(timerRecalage); document.getElementById('messengerPopUpAlerte').style.left = j+"px"; document.getElementById('messengerPopUpAlerte').style.top = i+"px"; i = i + 4; if (i < 161) { setTimeout("rangerPopUpAlerte()",10); } else { document.getElementById('messengerPopUpAlerte').style.top = 161+"px"; } //setTimeout("deplacementPopUpAlerte()",10000); } function nettoyageMessenger() { if (document.getElementById('formulairemailMessenger').txt_email.value == "Votre email") { document.getElementById('formulairemailMessenger').txt_email.value = ""; } } function inscriptionMessenger() { var email = document.getElementById('formulairemailMessenger').txt_email.value; var reg= /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/; if (document.getElementById('radioNormalMessenger').checked == true) { var mode = "normal"; } else if (document.getElementById('radioSmartphoneMessenger').checked == true) { var mode = "smartphone"; } if(reg.test(email)==true) { testEmail = "correct"; } else { testEmail = "incorrect"; } //TEST DE L'EMAIL if (testEmail == "incorrect") { window.alert("L'e-mail que vous avez saisi est incorrect"); } else { var url = "http://www.tv-express.com/infos/inscription.php"; url += "?email="+email; url += "&mode="+mode; //window.alert(email); document.getElementById('formulairemailMessenger').txt_email.value = ""; var xmlHttp; if (document.all) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else { xmlHttp = new XMLHttpRequest(); try { netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead'); } catch (e) { } } xmlHttp.open("GET",url); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState == 4) { var doc = xmlHttp.responseText; if (doc == "ok") { window.alert("Vous \u00EAtes maintenant abonn\u00E9 \u00E0 TV-Express\nVous recevrez tous les matins votre programme par email"); rangerPopUpAlerte(); } else if (doc == "deja") { window.alert("Vous \u00EAtes d\u00E9j\u00E0 abonn\u00E9 \u00E0 TV-Express"); rangerPopUpAlerte(); } else { window.alert("Votre email est invalide"); } } else { } } xmlHttp.send(null); x = delete xmlHttp; } } var body = document.getElementsByTagName("body")[0]; var div = document.createElement("div"); div.id = "montextePopUpAlerte"; body.appendChild(div);