function togV() { //toggle password for blog var sel = document.getElementById('status'); var obj = document.getElementById('add'); var pass = document.getElementById('password'); var passh = document.getElementById('passwordhint'); if(sel.selectedIndex == 3) { obj.style.display = ""; pass.focus(); } else { obj.style.display = "none"; pass.value = ""; passh.value = ""; } } function con() { //confirm actions var obj = document.getElementById('add'); obj.style.display = ""; } function go(link, p) { //go to a link var year = p.selectedIndex; var s = p.options[year].value; if(s) { var url = link + s; var WindowObj = window.open(url, "_self"); try { var obj = WindowObj.name; } catch(e) { alert(""); } } } var pressR = false; function replyC(id) { //reply comment on blog if(pressR == false) { document.getElementById('com_' + id).style.display = ''; document.getElementById('reply_' + id).focus(); pressR = true; } else if(pressR == true) { document.getElementById('com_' + id).style.display = 'none'; pressR = false; } } var pressD = false; function deleteC(id) { //delete comment on blog if(pressD == false) { document.getElementById('delete_comment_' + id).style.display = ''; pressD = true; } else if(pressD == true) { document.getElementById('delete_comment_' + id).style.display = 'none'; pressD = false; } } /*below is ajax*/ var xmlhttp; if(window.ActiveXObject) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if(window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest; } function changeCap() { //change captcha var theimage = document.getElementById('cap'); xmlhttp.open("GET", "/qwerty/admin/ajax_checks.php?reset_cap", true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { theimage.src = "/qwerty/verify.php?t4com=" + new Date().getTime(); } } xmlhttp.send(null); } function ajaxCheckUser() { var obj = document.getElementById('stuff_status'); var param = "username_status=" + document.getElementById('username').value; xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php", true); xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { if(xmlhttp.responseText == "g") { obj.innerHTML = "\"\""; document.getElementById('username').style.backgroundColor = ""; } else if(xmlhttp.responseText == "b") { obj.innerHTML = "\"\""; document.getElementById('username').select() document.getElementById('username').focus() document.getElementById('username').style.backgroundColor = "red"; } } } xmlhttp.send(param); } var changed = false; var really_send = false; var worktype; function ajaxSaveBlog() { if(changed == true) { var blog_title = document.getElementById('blog_title_a').value; var blog_post = document.getElementById('post').value; var params = "blog_title=" + blog_title + "&blog_post=" + blog_post; xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php", true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState != 4) { document.getElementById('auto_save_box').innerHTML = "" + autosaving + ""; } else {//if(xmlhttp.readyState == 4) { document.getElementById('auto_save_box').innerHTML = "" + autosavedone + " " + new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds() + ""; setTimeout("document.getElementById('auto_save_box').innerHTML = ''", 5*1000); } } xmlhttp.send(params); setTimeout("ajaxSaveBlog();", 120*1000); } } function confirmLeave() { //leave blog edit var toparam; if(changed == true && really_send == false) { if(worktype != null) { var leave = confirm(justedit); } else { var leave = confirm(confleave); } if(leave == true) { if(worktype != null) { toparam = "&edit=" + worktype; } else { toparam = ""; } var params = "save_blog_title=" + document.getElementById('blog_title_a').value + "&save_blog_post=" + document.getElementById('post').value + toparam; xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php", true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.send(params); } else { var params = "nosave=true"; xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php", true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.send(params); } } } function reply() { if(document.getElementById('private') != null) { var private = document.getElementById('private').checked; } if(document.getElementById('reply_username') != null && document.getElementById('reply_user_www') != null) { var reply_username = document.getElementById('reply_username'); var reply_user_www = document.getElementById('reply_user_www'); } if(document.getElementById('captcha_code') != null) { var captcha_code = document.getElementById('captcha_code'); } var reply_blog_post = document.getElementById('reply_blog_post'); var blogdate = document.getElementById('blogdate').value; var insertWhere = document.getElementById('all_com_wrap'); var params = (reply_username == null) ? "private="+private : "reply_username="+reply_username.value+"&reply_user_www="+reply_user_www.value; params += (captcha_code == null) ? "" : "&captcha_code="+captcha_code.value; params += "&reply_blog_post="+reply_blog_post.value+"&blogdate="+blogdate; var addtourl = new Date().getTime(); xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php?kill=" + addtourl, true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState != 4) { //document.getElementById('submit_reply').disabled = true; } else {//if(xmlhttp.readyState == 4) { //document.getElementById('submit_reply').disabled = false; if(xmlhttp.responseText == "vw") { if(document.getElementById('stuff_status') != null && document.getElementById('captcha_code') != null) { document.getElementById('stuff_status').innerHTML = "\"\""; document.getElementById('captcha_code').select() document.getElementById('captcha_code').focus() document.getElementById('captcha_code').style.backgroundColor = "red"; } addtourl = new Date().getTime(); } else if(xmlhttp.responseText == "nu") { if(document.getElementById('reply_username') != null) { document.getElementById('reply_username').select(); document.getElementById('reply_username').focus() document.getElementById('reply_username').style.backgroundColor = "red"; document.getElementById('reply_username').onkeyup = function() { document.getElementById('reply_username').style.backgroundColor = ""; } } } else if(xmlhttp.responseText == "pe" || xmlhttp.responseText == "fi") { document.getElementById('reply_blog_post').select(); document.getElementById('reply_blog_post').focus(); document.getElementById('reply_blog_post').style.backgroundColor = "red"; document.getElementById('reply_blog_post').onkeyup = function() { document.getElementById('reply_blog_post').style.backgroundColor = ""; } } else { if(document.getElementById('stuff_status') != null && document.getElementById('captcha_code') != null) { document.getElementById('stuff_status').innerHTML = ""; document.getElementById('captcha_code').style.backgroundColor = ""; //changeCap(); document.getElementById('cap').src = "/qwerty/verify.php?t4com=" + new Date().getTime(); captcha_code.value = ""; } if(document.getElementById('reply_username') != null && document.getElementById('reply_user_www') != null) { reply_username.value = ""; reply_user_www.value = "http://"; } reply_blog_post.value = ""; insertWhere.innerHTML = xmlhttp.responseText; window.scrollby(0, -260); } } } xmlhttp.send(params); } function replyCom(id) { var myreply = document.getElementById('reply_'+id).value; var blog_date = document.getElementById('blog_date_'+id).value; var orig_com_date = document.getElementById('orig_com_date_'+id).value; var isinv = document.getElementById('isinv_'+id).value; var isedit = document.getElementById('isedit_'+id); var showwhere = document.getElementById('thereply_'+id); var params = "myreply=" + myreply + "&blog_date=" + blog_date + "&orig_com_date=" + orig_com_date + "&isinv=" + isinv + "&isedit=" + isedit.value; xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php?kill=" + new Date().getTime(), true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState != 4) { document.getElementById('reply_'+id).disabled = true; } else {//if(xmlhttp.readyState == 4) { document.getElementById('reply_'+id).disabled = false; document.getElementById('com_' + id).style.display = 'none'; pressR = false; isedit.value = "yes"; showwhere.innerHTML = xmlhttp.responseText; } } xmlhttp.send(params); } function addFriend(name, what) { var param = "addfriend="+name; xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php", true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { what.innerHTML = addedfriend; what.removeAttribute("onclick"); } } xmlhttp.send(param); } function rmFriend(name) { var param = "rmfriend="+name; xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php", true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { document.getElementById('rm_friends_list').innerHTML = xmlhttp.responseText; } } xmlhttp.send(param); } function revertStyle(me) { var param = "revert_style=true"; var conf = confirm(revss); if(conf == true) { xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php", true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { document.getElementById('site_ssheet').value = xmlhttp.responseText; me.disabled = true; me.setAttribute("value", revdone); } } xmlhttp.send(param); } else { return false; } } function revertOwn(me) { var param = "revert_own=true"; var conf = confirm(revownss); if(conf == true) { xmlhttp.open("POST", "/qwerty/admin/ajax_checks.php", true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { document.getElementById('site_ssheet').value = xmlhttp.responseText; me.disabled = true; me.setAttribute("value", revdone); } } xmlhttp.send(param); } else { return false; } }