function get_ajax(){try{return new XMLHttpRequest()}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}return null}var ajax_request=get_ajax();function form_to_string(d){var b="";for(var c=0;c<d.elements.length;c++){e=d.elements[c];if(typeof(e.name)!="undefined"&&!e.disabled&&e.type!="submit"){v=e.tagName=="SELECT"?e.options[e.selectedIndex].value:(((e.type=="checkbox"||e.type=="radio")&&!e.checked)?"":e.value);b+=(e.type=="radio"&&!e.checked)?"":((b==""?"":"&")+encodeURIComponent(e.name)+"="+encodeURIComponent(v))}}return b}function comment_expand(d,g,f){var c=$(d).parents(".comment_body").eq(0).find(".more_comment_text").eq(0);c.toggle();d.innerHTML=(c.get(0).style.display=="none")?g:f;return true}function comment_page(b){ajax_request.onreadystatechange=function(){if(ajax_request.readyState==4){comment_page_area(b)}};ajax_request.open("GET",b.href+"&ajax=true",true);ajax_request.send(null);return true}function comment_page_area(b){var c=$.trim(ajax_request.responseText);if(c){$(b).parents(".prime_comments_section").eq(0).html(c)}}function comment_post(i,h){var g=$(i).prev(".prime_comments_section").eq(0);var d=g.find(".display_number").eq(0).html();var j="ajax=true&final_num="+(d?d.replace(/[^0-9]/,""):"0")+"&"+form_to_string(i);g.nextAll(".comment_result").eq(0).html("<div><p>"+h+"</p></div>").slideDown("fast");ajax_request.onreadystatechange=function(){if(ajax_request.readyState==4){comment_result(i)}};ajax_request.open("POST",i.action,true);ajax_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");ajax_request.send(j);return true}function comment_result(k){var j=$.trim(ajax_request.responseText);if(j){var i=j.split("|",3);var h=i[0]||"",g=i[1]||"",m=i[2]||"";$(k).nextAll(".comment_result").html(g).slideDown("normal");if(h=="post"){var l=$(k).prevAll(".prime_comments_section").eq(0);l.find(".comment_list").eq(0).prepend(m);l.find(".comment_area").eq(0).slideDown("slow");l.find(".comment_area_empty").eq(0).slideUp("slow");$(k).slideUp("slow")}}}function toggle_report_text(f){var d=(f.options[f.selectedIndex].value=="custom")?true:false;var g=$(f).parents("form").find(":text").toggle(d)}function hide_report_form(b){$(b).parents("form").slideUp("fast");return true}function show_report_form(d){var c=$(d).parents(".comment_area").find(".report_comment_form").eq(0);if(c.get(0)){c.slideToggle("fast")}else{c=$(d).parents(".prime_comments_section").find(".report_comment_form").eq(0);$(d).parents(".comment_info").after(c);c.slideDown("fast")}var f=d.href.replace(/^.*id=([0-9]+)$/,"$1");c.find(':hidden[name="post_id"]').eq(0).attr("value",f);return true}function report_comment(g){var d="ajax=true&"+form_to_string(g),c=$(g).find(".comment_result").eq(0);$(g).nextAll(".comment_result").slideUp("normal");c=c.clone().insertAfter(g).eq(0);c.slideDown("fast");ajax_request.onreadystatechange=function(){if(ajax_request.readyState==4){comment_reported(g,c)}};ajax_request.open("POST",g.action,true);ajax_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");ajax_request.send(d);return true}function comment_reported(j,k){var i=ajax_request.responseText;if(i){var h=i.split("|",2);var g=h[0]||"",d=h[1]||"";k.addClass(g).html(d).slideDown("normal");$(j).slideUp("slow")}}function toggle_comment_review(b){var d=$(b).find("input:checkbox").eq(0).attr("checked");var a=$(b).siblings(".article_correction_confirm").eq(0);if(d){a.slideDown()}else{a.slideUp()}};
