function getXMLHttpRequest(){var _1=undefined;try{_1=new XMLHttpRequest();}catch(itty){try{_1=new ActiveXObject("Msxml2.XMLHTTP");}catch(bitty){try{_1=new ActiveXObject("Microsoft.XMLHTTP");}catch(teapot){_1=false;}}}return _1;};function dispatch_xmlreq(_2,_3,_4){_2.open("GET",_3,true);_2.onreadystatechange=_4;_2.send(null);};function parseInitialRequest(_5){if(_5.readyState==4){if(_5.status==200){if(_5.responseText=="ERROR;Not logged in"){top.location.href="http://e-hentai.org/bounce_login.php?b=d&bt=3-"+gid+"-"+token;}else{return _5.responseText;}}else{alert("Server communication failed. Server responded with: "+_5.responseText);}}return false;};function wait_roller_set(){document.getElementById("waitroller").src="http://static.ehgt.org/images/roller.gif";};function wait_roller_unset(){document.getElementById("waitroller").src="http://static.ehgt.org/images/blank.gif";};var tagrequest=undefined;var selected_tag=undefined;var selected_link=undefined;function toggle_tagmenu(_6,_7){if(tagrequest!=undefined){return false;}if(selected_link!=undefined&&selected_link!=_7){_toggle_tagmenu(selected_tag,selected_link);selected_tag=undefined;selected_link=undefined;}if(selected_link==_7){selected_tag=undefined;selected_link=undefined;}else{selected_tag=_6;selected_link=_7;}if(_6!=undefined&&_7!=undefined){return _toggle_tagmenu(_6,_7);}};function _refresh_tagmenu_act(_8,ta){var _9="";var _a="";if(ta.className!="tup"){_9=" <img src=\"http://g.ehgt.org/img/menu_right.gif\" class=\"mr\" alt=\"&gt;\" /> <a href=\"javascript:tag_vote_up()\">"+(ta.className==""?"Vote Up":"Withdraw Vote")+"</a>";}if(ta.className!="tdn"){_a=" <img src=\"http://g.ehgt.org/img/menu_right.gif\" class=\"mr\" alt=\"&gt;\" /> <a href=\"javascript:tag_vote_down()\">"+(ta.className==""?"Vote Down":"Withdraw Vote")+"</a>";}document.getElementById("tagmenu_act").innerHTML="Actions:"+_9+_a+" <img src=\"http://g.ehgt.org/img/menu_right.gif\" class=\"mr\" alt=\"&gt;\" /> <a href=\"javascript:tag_show_galleries()\">Show Galleries With This Tag</a> <img src=\"http://g.ehgt.org/img/menu_right.gif\" class=\"mr\" alt=\"&gt;\" /> <a href=\"javascript:toggle_tagmenu(undefined, undefined)\">Add New Tag</a> ";};function _toggle_tagmenu(_b,_c){var _d=_c.style.color=="";if(_d){_refresh_tagmenu_act(_b,_c);}_c.style.color=_d?"blue":"";document.getElementById("tagmenu_new").style.display=_d?"none":"";document.getElementById("tagmenu_act").style.display=_d?"":"none";return false;};function tag_from_field(_e){var _e=document.getElementById("newtagfield").value;document.getElementById("newtagbutton").disabled="disabled";send_vote("/ehgajax.php?act=tagvote&gid="+gid+"&tag="+escape(_e)+"&vote=up");};function tag_vote_up(){send_vote("/ehgajax.php?act=tagvote&gid="+gid+"&tag="+escape(selected_tag)+"&vote=up");};function tag_vote_down(){send_vote("/ehgajax.php?act=tagvote&gid="+gid+"&tag="+escape(selected_tag)+"&vote=down");};function tag_show_galleries(){top.location.href=base_url+"tag/"+selected_tag.replace(" ","+");};function send_vote(_f){if(tagrequest!=undefined){return;}tagrequest=getXMLHttpRequest();if(tagrequest!=false){wait_roller_set();tagrequest.open("GET",_f,true);tagrequest.onreadystatechange=tag_update_vote;tagrequest.send(null);}};function tag_update_vote(){var _10=parseInitialRequest(tagrequest);if(_10!=false){var _11=_10.split(";");tagrequest=undefined;wait_roller_unset();if(_11[0]=="ERROR"){alert("Could not vote for tag. Reason: "+_11[1]);document.getElementById("newtagbutton").disabled="";}else{document.getElementById("newtagfield").value="Enter New Tags (separate with comma)";document.getElementById("newtagbutton").disabled="";rebuild_tags(_11[1]);}}};function rebuild_tags(_12){var _13=document.getElementById("taglist");var _14=_12.split(",");var _15="";for(tagentry in _14){if(_14[tagentry]!=""){var _16=_14[tagentry].split("=");var tag=_16[0];var _17=tag.replace(/ /,"_");var _18=_16[1].split("~");var _19=_18[0];var _1a=_18[1];var _1b="";if(_1a=="up"){_1b="tup";}else{if(_1a=="down"){_1b="tdn";}}opacity="1.0";if(perv=document.getElementById("td_"+_17)){opacity=perv.style.opacity;}_15+="<div id=\"td_"+_17+"\" class=\"gt\" style=\"opacity:"+opacity+"\"><a id=\"ta_"+_17+"\" href=\"http://g.e-hentai.org/tag/"+escape(tag)+"\" class=\""+_1b+"\" onclick=\"return toggle_tagmenu('"+tag+"', this)\">"+tag+"</a> (<span id=\"tc_"+_17+"\" class=\""+_1b+"\">"+_19+"</span>)</div>";}}_13.innerHTML=_15;toggle_tagmenu(undefined,undefined);};var raterequest=undefined;var rating=undefined;function get_rating_image(_1c){return "http://static.ehgt.org/images/review/quality-"+(_1c>0?_1c:0)+".gif";};function rating_set(val){if(raterequest==undefined){rating=val;if(raterequest!=undefined){return;}raterequest=getXMLHttpRequest();if(raterequest!=false){document.getElementById("rating_label").innerHTML="Rating gallery...";var url="/ehgajax.php?act=rate&gid="+gid+"&rating="+rating;dispatch_xmlreq(raterequest,url,rating_update);}}};function rating_update(){var _1d=parseInitialRequest(raterequest);if(_1d!=false){var _1e=_1d.split(";");if(_1e[0]=="ERROR"){alert("Could not rate gallery. Reason: "+_1e[1]);document.getElementById("rating_label").innerHTML="Rating failed.";}else{var _1f=parseInt(document.getElementById("rating_count").innerHTML)+1;document.getElementById("rating_count").innerHTML=_1f;document.getElementById("rating_image").src=get_rating_image(rating);document.getElementById("rating_label").innerHTML="Thanks for rating!";}}};function rating_show(val){if(raterequest==undefined){document.getElementById("rating_image").src=get_rating_image(val);document.getElementById("rating_label").innerHTML="Rate as "+(val/2)+" stars";}};function rating_reset(){if(raterequest==undefined){document.getElementById("rating_image").src=get_rating_image(Math.round(original_rating*2));document.getElementById("rating_label").innerHTML=original_rating==0?"Not Yet Rated":"Average: "+original_rating;}};function display_comment_field(){document.getElementById("formdiv").style.display="";var _20=0;if(!document.documentElement.scrollTop){_20=document.body.scrollTop;}else{_20=document.documentElement.scrollTop;}window.scrollTo(0,_20+99999);};var commentrequest=undefined;function vote_comment_up(cid){document.getElementById("comment_vote_up_"+cid).style.color="red";vote_comment(cid,1);};function vote_comment_down(cid){document.getElementById("comment_vote_down_"+cid).style.color="red";vote_comment(cid,-1);};function vote_comment(cid,val){if(commentrequest==undefined){commentrequest=getXMLHttpRequest();if(commentrequest!=false){var url="/ehgajax.php?act=commentvote&cid="+cid+"&vote="+val;dispatch_xmlreq(commentrequest,url,comment_update);comment_fadeout(cid);}}};function comment_update(){var _21=parseInitialRequest(commentrequest);if(_21!=false){var _22=_21.split(";");if(_22[0]=="ERROR"){alert("Could not vote for comment. Reason: "+_22[1]);}else{var _23=parseInt(_22[1]);var _24=parseInt(_22[2]);var _25=parseInt(_22[3]);document.getElementById("comment_score_"+_23).innerHTML=(_24>0?"+":"")+_24;document.getElementById("comment_vote_up_"+_23).style.color=(_25>0?"blue":"");document.getElementById("comment_vote_down_"+_23).style.color=(_25<0?"blue":"");}comment_fadein(_23,true);commentrequest=undefined;}};function comment_fadeout(cid){var s=document.getElementById("comment_score_"+cid);var _26=parseFloat(s.style.opacity);var _27=Math.max(0,_26-0.05);s.style.opacity=_27;if(_27>0){setTimeout(function(){comment_fadeout(cid);},10);}else{s.style.visibility="hidden";}};function comment_fadein(cid,_28){var s=document.getElementById("comment_score_"+cid);var _29=parseFloat(s.style.opacity);var _2a=0;if(s.style.visibility=="hidden"){s.style.visibility="visible";_28=false;}if(!_28){_2a=Math.min(1,_29+0.05);s.style.opacity=_2a;}if(_2a<1){setTimeout(function(){comment_fadein(cid,_28);},10);}};