var xhr=[],xi=[];xi[0]=1;var cp_update=0;function xhrRequest(a){for(var b=xi.length,d=0;d<xi.length;d++)if(xi[d]==1){xi[d]=0;b=d;break}xi[b]=0;if(window.ActiveXObject)try{xhr[b]=new ActiveXObject("Msxml2.XMLHTTP")}catch(f){try{xhr[b]=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}else if(window.XMLHttpRequest){xhr[b]=new XMLHttpRequest;xhr[b].overrideMimeType&&xhr[b].overrideMimeType("text/"+a)}return b}
function AjaxRequest(a,b,d,f){if(!(a=="cp_update"||a=="cp_update_mes"||a=="cp_update_button"||a=="cp_update_status"||a=="clear_cp_update"))document.getElementById("cploading").innerHTML='<TABLE width="242" height="58" style="border:1px solid #cccccc;background-color:#FCF8C7;"><TR align="center"><TD class="loading"><img src="theme/'+theme+'/images/loading.gif" align="absmiddle">\u00c7\u00e0\u00e3\u00f0\u00f3\u00e7\u00ea\u00e0. \u00cf\u00ee\u00e6\u00e0\u00eb\u00f3\u00e9\u00f1\u00f2\u00e0 \u00ef\u00ee\u00e4\u00ee\u00e6\u00e4\u00e8\u00f2\u00e5...</TD></TR></TABLE>';
var e=xhrRequest();xhr[e].open(b,d,true);xhr[e].onreadystatechange=function(){if(xhr[e].readyState==4){var c=xhr[e].responseText;document.getElementById("cploading").innerHTML="";if(xhr[e].status==200){if(a=="userid"||a=="pass"||a=="pass2"||a=="slspass"||a=="slspass2"||a=="email")check_reg_(a,c);else if(a=="check_cp_update")refresh_cp_update(c);else if(a=="clear_cp_update")cp_update=0;else if(a=="cp_update_status"){if(c==-1||c==3||c==4||c==5||c==6){c="ajax.php?module=clear_cp_update";AjaxRequest("clear_cp_update",
"get",c)}}else if(a!="do_cp_update")document.getElementById(a).innerHTML=c;xi[e]=1;xhr[e]=null}}};b=="post"&&xhr[e].setRequestHeader("Content-Type","application/x-www-form-urlencoded");f?xhr[e].send(f):xhr[e].send(null)}function check_post(a){for(;a.indexOf("&")!=-1;)a=a.replace("&","symbol_and");for(;a.indexOf("+")!=-1;)a=a.replace("+","symbol_plus");return a}
function preview_post(a){a=check_post(document.getElementById(a).t_mes.value);a="val="+a+"";var b="ajax.php?module=post_preview";AjaxRequest("post_preview","post",b,a)}function show_poll_form(){var a="ajax.php?module=show_poll_form";AjaxRequest("poll_form","get",a);document.getElementById("t_post_form").newpoll.value=1}
function close_poll_form(){var a='<a href="#" onClick="show_poll_form(); return false;">Click here to manage this topic\'s poll</a>';document.getElementById("t_post_form").newpoll.value=0;document.getElementById("poll_form").innerHTML=a}function page_select(a,b){b="ajax.php?module=page_select&name="+a+"&"+b+"";AjaxRequest(""+a+"","get",b)}function do_bb_code(a,b){a="ajax.php?module=do_bb_code&form_id="+a+"&name="+b+"";AjaxRequest(""+b+"","get",a)}
function check_reg(a){var b=document.regis_form,d;switch(a){case "userid":d="val="+b.userid.value+"";break;case "pass":d="val="+b.userpass.value+"";break;case "pass2":d="val="+b.userpass2.value+"&val2="+b.userpass.value+"";break;case "slspass":d="val="+b.userslspass.value+"";break;case "slspass2":d="val="+b.userslspass.value+"&val2="+b.userslspass2.value+"";break;case "email":d="val="+b.email.value+"";break}b="ajax.php?module=check_reg&check="+a+"";AjaxRequest(a,"post",b,d)}
function check_reg_(a,b){if(b){document.getElementById("attn_"+a+"_").innerHTML=b;document.getElementById("attn_"+a+"").style.display="";document.getElementById("_attn_"+a+"").innerHTML='<img src="theme/'+theme+'/images/aff_cross.gif" align="absmiddle">'}else{document.getElementById("attn_"+a+"_").innerHTML="";document.getElementById("attn_"+a+"").style.display="none";document.getElementById("_attn_"+a+"").innerHTML='<img src="theme/'+theme+'/images/aff_tick.gif" align="absmiddle">'}}
function quick_edit(a,b){b="ajax.php?module=quick_edit_post&"+b+"";eval(a+"_old = document.getElementById(x).innerHTML");AjaxRequest(""+a+"","get",b)}function save_quick_edit(a,b){var d=check_post(document.getElementById(a).t_mes.value);a="val="+d+"&p="+document.getElementById(a).p.value+"";d="ajax.php?module=save_quick_edit";AjaxRequest(b,"post",d,a)}function restore_post(a){document.getElementById(a).innerHTML=eval(a+"_old")}
function resize_img(){for(var a=1;a<=total_img_resize;a++){var b=eval("document.images.user_posted_image_"+a+""),d=b.src,f=parseInt(b.width)?parseInt(b.width):parseInt(b.style.width),e=parseInt(b.height)?parseInt(b.height):parseInt(b.style.height);if(f>max_width&&max_width){var c=parseInt(0.8*max_width),g=parseInt(c*e/f);if(g>max_height&&max_height){var h=g;g=parseInt(0.8*max_height);c=parseInt(g*c/h)}b.width=c;b.height=g;b=eval("document.getElementById('image_"+a+"')");c=parseInt(c/f*100);original_src=
b.innerHTML;b.innerHTML="<table border='0' cellspacing='0' cellpadding='0'><tr style='background-color:#000000;cursor: pointer;cursor: hand;' onclick=\"window.open('"+d+"')\"><td style='padding:3px;color:#ffffff;'><img src='theme/"+theme+"/images/img-resized.png'> Reduced: "+c+"% of original size [ "+f+" x "+e+" ] - Click to view full image</td></tr><tr><td>"+original_src+"</td></tr></table>"}else if(e>max_height&&max_height){g=parseInt(0.8*max_height);c=parseInt(g*f/e);if(c>max_width&&max_width){h=
c;c=parseInt(0.8*max_width);g=parseInt(c*g/h)}b.width=c;b.height=g;b=eval("document.getElementById('image_"+a+"')");c=parseInt(c/f*100);original_src=b.innerHTML;b.innerHTML="<table border='0' cellspacing='0' cellpadding='0'><tr style='background-color:#000000;cursor: pointer;cursor: hand;' onclick=\"window.open('"+d+"')\"><td style='padding:3px;color:#ffffff;'><img src='theme/"+theme+"/images/img-resized.png'> Reduced: "+c+"% of original size [ "+f+" x "+e+" ] - Click to view full image</td></tr><tr><td>"+
original_src+"</td></tr></table>"}}}function check_cp_update(){var a="ajax.php?module=check_cp_update";AjaxRequest("check_cp_update","get",a)}function refresh_cp_update(a){a=parseInt(a);a="ajax.php?module=refresh_cp_update&code="+a+"";AjaxRequest("cp_update","get",a+"&position=0");AjaxRequest("cp_update_mes","get",a+"&position=1");AjaxRequest("cp_update_button","get",a+"&position=2")}
function do_cp_update(){var a="ajax.php?module=do_cp_update";AjaxRequest("do_cp_update","get",a);cp_update=1;setTimeout("process_cp_update()",1000)}function process_cp_update(){if(cp_update){var a="ajax.php?module=status_cp_update";AjaxRequest("cp_update_status","get",a);a="ajax.php?module=refresh_cp_update&code=2";AjaxRequest("cp_update_mes","get",a+"&position=1");AjaxRequest("cp_update_button","get",a+"&position=2");setTimeout("process_cp_update()",500)}};
