$(document).ready(function(){var l=$("#darebox").attr("class");var k=0;var u=$("#ulevel").text();if(u=="Moderator"){k=1}if($("#mature").is(":checked")){var t=1}else{var t=0}if($("#inclusion").is(":checked")){var x=1}else{var x=0}var v=$("#dareset").val();var s=0;var b=0;var c="";var e=$("#comstat").html();var r=1;var d=1;var f=0;if(k){$("#modunapprove").click(function(){$.post("/x/srv/ajax_mod.php",{GDID:l,action:2},function(){alert("You can now edit this item by going to your queue.")})})}j(l);$("#truth").click(function(){q(0,t,x,v);return false});$("#dare").click(function(){q(1,t,x,v);return false});$("#addcomment").click(function(){m();return false});$("#s1").click(function(){h(1);return false});$("#s2").click(function(){h(2);return false});$("#s3").click(function(){h(3);return false});$("#s4").click(function(){h(4);return false});$("#s5").click(function(){h(5);return false});$("#mature").click(function(){if($("#mature").is(":checked")){$("#mature + label").addClass("selmature");$("#inclusion").removeAttr("disabled");$("#inclusion + label").removeClass("seldisable");$.get("/x/srv/update.php",{action:"1",set:"10"});t=1}else{$("#mature + label").removeClass("selmature");$("#inclusion").attr("disabled","disabled");$("#inclusion + label").addClass("seldisable");$.get("/x/srv/update.php",{action:"1",set:"20"});t=0}});$("#inclusion").click(function(){if($("#inclusion").is(":checked")){$.get("/x/srv/update.php",{action:"2",set:"10"});x=1}else{$.get("/x/srv/update.php",{action:"2",set:"20"});x=0}});$("#dareset").change(function(){v=$("#dareset").val();$.get("/x/srv/update.php",{action:"3",set:v})});$("#dclick").click(function(){var y;y=window.open("/extras/dice/dice.html","Dice","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=354,height=260");if(window.focus){y.focus()}});$("#mclick").click(function(){var y;y=window.open("/extras/players/decider.php","PlayerManager","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=360,height=470");if(window.focus){y.focus()}});$("#loginform").submit(function(){$("#redbox").hide("fast")});function m(){uComment=$("#comtxt").val();if((uComment!="")&&(b==0)){b=1;$("#addcomment span").text("Adding comment...");$("#comtxt").attr("disabled","disabled");$.post("/x/srv/comment.php",{GDID:l,comment:uComment},function(y){$("comment",y).each(function(z){commentResponse=$(this).find("response").text();commentMessage=$(this).find("message").text()});if(commentResponse=="1"){$("#comstat").removeClass("redalert");$("#comstat").text(commentMessage);$("#addcomment").fadeOut("slow");w();o(l,r)}else{if(commentResponse=="0"||commentResponse=="3"){$("#comstat").text(commentMessage);$("#comstat").addClass("redalert");if(!(commentResponse=="3")){$("#comtxt").removeAttr("disabled");$("#addcomment span").text("Add Comment");b=0}else{$("#addcomment").fadeOut("slow")}}}})}}function h(y){if(s==0){s=1;$.post("/x/srv/vote.php",{GDID:l,vote:y},function(z){voteResponse="";$("vote",z).each(function(A){voteResponse=$(this).find("response").text()});if(voteResponse=="1"){p(y);$("#rtext").text("Vote added!")}else{if(voteResponse=="0"){$("#rtext").text("You already voted!")}}})}else{$("#rtext").text("You already voted!")}}function p(y){var z="";if(y==0){z="no"}if(y==1){z="one"}if(y==2){z="two"}if(y==3){z="three"}if(y==4){z="four"}if(y==5){z="five"}z+="star";$("#ratingarea ul").attr("class","rating "+z)}function q(B,A,z,y){if(f==0){f=1;$("#loading").fadeIn(400,function(){g();$("#comcenter").slideUp(900,function(){$("#comcenter").hide();$.post("/x/srv/gdXML.php",{rtord:B,rating:A,inclusion:z,set:y},function(H){var D="";var G=0;var E="";var F="";$("item",H).each(function(O){l=$(this).find("GDID").text();D=$(this).find("text").text();G=$(this).find("stars").text();E=$(this).find("author").text();F=$(this).find("authorURL").text();d=$(this).find("comments").text();$("#gdtext p").text(D);$("#aname a").attr("href",F);$("#aname a").text(E);p(G)});var L="";var M="";var I="";var C="";var K="";var J="";var N="";$("comment",H).each(function(O){M=$(this).find("date").text();I=$(this).find("author").text();C=$(this).find("authorURL").text();K=$(this).find("avatar").text();J=$(this).find("text").text();N=$(this).find("cid").text();L+=formatComment(M,I,C,K,J,N)});$("#comcenter").html(L);a(l,e);$("#loading").fadeOut(800,function(){if(Number(d)>0){$("#comcenter").slideDown("slow");if(Number(d)>8){i(l,1)}else{j(l)}}f=0})})})})}}function a(z,y){s=0;$("#rtext").text("Rating:");$("#darebox").attr("class",z);r=1;b=0;$("#comtxt").val("");$("#comtxt").removeAttr("disabled");$("#addcomment span").text("Add Comment");$("#addcomment").show();$("#comstat").removeClass("redalert");$("#comstat").html(y)}function w(){$("html, body").animate({scrollTop:0},900)}function j(z){var y;$(".pgjump").click(function(){w();y=$(this).text();o(z,y);return false});$(".pgnxt").click(function(){w();o(z,(Number(r)+1));return false});$(".pgprv").click(function(){w();o(z,(Number(r)-1));return false});if(k){n()}}function o(z,y){if(f==0){f=1;g();$("#comcenter").slideUp(900,function(){$("#comcenter").hide();$.post("/x/srv/gdCOM.php",{GDID:z,page:y},function(E){var H="";var B="";var D="";var A="";var C="";var G="";var F="";$("comment",E).each(function(I){B=$(this).find("date").text();D=$(this).find("author").text();A=$(this).find("authorURL").text();C=$(this).find("avatar").text();G=$(this).find("text").text();F=$(this).find("cid").text();H+=formatComment(B,D,A,C,G,F)});r=y;$("#comcenter").html(H).slideDown("slow");i(z,y);f=0})})}}function g(){$("#comwrap").slideUp("fast")}function i(z,y){$("#comwrap").load("/x/srv/gdPG.php",{GDID:z,page:y},function(){j(z);$("#comwrap").slideDown("slow")})}function n(){$(".comment").dblclick(function(){cid=$(this).attr("id");username=$(this).find(".combot a").text();var y=window.open("/x/srv/modcomment.php?username="+username+"&cid="+cid,"Dice","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=460,height=300");if(window.focus){y.focus()}});$(".comment .comin").simpletip({content:"Double-click a comment bubble to moderate.",fixed:true,position:"bottom"})}});function formatComment(c,e,d,b,f,g){var a="";a='\n<div class="comment" id="com'+g+'">\n<div class="comtop"></div>\n<div class="comin">\n<div class="comtxt">\n'+f+'\n</div>\n<div class="comavtr">\n<a href="'+d+'" target="_BLANK"><img src="'+b+'" class="imgavtr" alt="'+e+'" /></a>\n</div>\n<div class="clear"></div>\n</div>\n<div class="combot"><strong><a href="'+d+'" target="_BLANK">'+e+"</a></strong> posted "+c+"</div>\n</div>\n";return a};