function random_string() { var random = Math.random()*4 + Math.random()*2 + Math.random()*6 + Math.random()*10; return random; } function loadFragmentInToElement(fragment_url, element_id) { var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlhttp = new ActiveXObject("Msxml.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } var element = document.getElementById(element_id); // element.innerHTML = ' '; xmlhttp.open("GET", fragment_url); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { element.innerHTML = xmlhttp.responseText; } } xmlhttp.send(null); } function comment_drop(post,id) { valid_user = confirm('Voulez-vous vraiment supprimer ce commentaire ?\nAttention, cette action est irréversible!'); if(valid_user == 1) { fragment = 'async.php?drop_comment=' + id + '&post=' + post; loadFragmentInToElement(fragment, 'box_comments'); } } function post_drop(post,context) { valid_user = confirm('Voulez-vous vraiment supprimer cet article ?\nTous les commentaires liés à cet article seront perdus.\nAttention, cette action est irréversible!'); if(valid_user == 1) { fragment = 'async.php?drop_post=' + post + '&context=' + context; block = 'post_' + post; loadFragmentInToElement(fragment, block); } } function new_post() { loadFragmentInToElement('async.php?write', 'box_content'); } function post_edit(post) { block = 'post_' + post; loadFragmentInToElement('async.php?edit=' + post, block); }