function submitForm(id) { document.getElementById(id).submit(); } function modeDiscret() { document.getElementById('change_mode').submit(); } function displayTable(id, sub, total) { for (var i=1; i<=total;i++) { document.getElementById(sub+'_'+i).style.display = 'none'; } document.getElementById(sub+'_'+id).style.display = 'block'; } function showKeycode(e, sEvent, site) { var iKeyCode = 0; if (window.event) iKeyCode = window.event.keyCode; else if (e) iKeyCode = e.which; if (iKeyCode.toString()==123) { document.location=site; } } function openMention(page) { window.open('/'+page+'/','memtions_legales','directories=no,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=360,height=110'); } function getObj(id) { if (document.all) { return document.all[id]; } else { return document.getElementById(id); } } function getAbsoluteOffsetTop(obj) { var top = obj.offsetTop; var parent = obj.offsetParent; while (parent != document.body) { top += parent.offsetTop; parent = parent.offsetParent; } top = top + 5; return top; } function getAbsoluteOffsetLeft(obj) { var left = obj.offsetLeft; var parent = obj.offsetParent; while (parent != document.body) { left += parent.offsetLeft; parent = parent.offsetParent; } left = left+5; return left; } function openNavigator(htPage,url,theme,num) { window.open('/'+htPage+'/?theme='+theme+'&num='+num+'&id='+escape(url),'actu','directories=no,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=no,toolbar=yes,width=800,height=600'); } var timerID = 0; function getNbMails() { if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); else { return; } var url = '/nbMails.htm'; xhr_object.open("GET",url,true); div = document.getElementById('nbMails'); xhr_object.onreadystatechange=function() { if (xhr_object.readyState == 4) { div.innerHTML = xhr_object.responseText; } } xhr_object.send(null); //timerID = setTimeout("getNbMails()", 300000); } function sendFriend(htpage, id) { window.open('/'+htpage+'/email.htm?id='+id,'Send_Mail','directories=no,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=405,height=350'); } var http_request = false; var req; function rating(htpage, id, val) { if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); else { return; } var url = '/'+htpage+'/rating.htm?id='+id+'&rate='+val+''; xhr_object.open("GET",url,true); div = document.getElementById('ratingSuccess'); xhr_object.onreadystatechange=function() { if (xhr_object.readyState == 4) { div.innerHTML = xhr_object.responseText; } } xhr_object.send(null); } function rating(htpage, id, val, uid) { if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); else { return; } var url = '/'+htpage+'/rating.htm?id='+id+'&rate='+val+'&uid='+uid+''; xhr_object.open("GET",url,true); div = document.getElementById('ratingSuccess'); xhr_object.onreadystatechange=function() { if (xhr_object.readyState == 4) { div.innerHTML = xhr_object.responseText; } } xhr_object.send(null); } function addFav(type, htpage, id) { var nl_msg = new Object(); nl_msg['videos'] = "videos-fav"; nl_msg['games'] = "games-fav"; var ok_msg = new Object(); ok_msg['videos'] = "Vidéo ajoutée !"; ok_msg['games'] = "Jeu ajouté !"; if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); else { return; } var url = htpage+'?id='+id+''; xhr_object.open("GET",url,true); btn = document.getElementById('addFavBtn'); xhr_object.onreadystatechange=function() { if (xhr_object.readyState == 4) { var return_code = xhr_object.responseText; if (return_code=="NOTLOGGED") { displayLogin(nl_msg[type]); } else { btn.value = ok_msg[type]; btn.desabled = true; } } } xhr_object.send(null); } function URLEncode( text ) { if (text) { // The Javascript escape and unescape functions do not correspond // with what browsers actually do... var SAFECHARS = "0123456789" + // Numeric "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic "abcdefghijklmnopqrstuvwxyz" + ""; // RFC2396 Mark characters var HEX = "0123456789ABCDEF"; var plaintext = text; var encoded = ""; for (var i = 0; i < plaintext.length; i++ ) { var ch = plaintext.charAt(i); if (ch == " ") { encoded += "+"; // x-www-urlencoded, rather than %20 } else if (SAFECHARS.indexOf(ch) != -1) { encoded += ch; } else { var charCode = ch.charCodeAt(0); if (charCode > 255) { alert( "Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" + "(URL encoding only supports 8-bit characters.)\n" + "A space (+) will be substituted." ); encoded += "+"; } else { encoded += "%"; encoded += HEX.charAt((charCode >> 4) & 0xF); encoded += HEX.charAt(charCode & 0xF); } } } // for return encoded; } else return ""; };