if(!window.iwin)var iwin={};iwin.userReviews={charactersLimit:1E3};
iwin.userReviews.errors={ERRORS_USERREVIEW_RATINGOVERALL_VALUE:"Please rate Overall.",ERRORS_USERREVIEW_RATINGGRAPHICS_VALUE:"Please rate Graphics.",ERRORS_USERREVIEW_RATINGSOUND_VALUE:"Please rate Sound.",ERRORS_USERREVIEW_RATINGGAMEPLAY_VALUE:"Please rate Gameplay.",ERRORS_USERREVIEW_COMMENT_EMPTY:"Review text box is empty.",ERRORS_USERREVIEW_COMMENT_TOO_LONG:"Your review cannot exceed 1000 characters.",ERRORS_USERREVIEW_DISCARDED:"Please submit a legible review of useful length.",ERRORS_USERREVIEW_COMMENT_LANGUAGE:"Please refrain from using naughty language in your review.",
ERRORS_USERREVIEW_COMMENT_URL:"Please remove URLs from your review.",ERRORS_USERREVIEW_COMMENT_INVALID:"Your comment has illegal characters.",ERRORS_USERREVIEW_ALREADY_REVIEWED:"We already have your review for this game."};
iwin.userReviews.recordVote=function(a,b){var d;a=$J(a);d=$J(".review_self_url",a.parents(".player_review")).text();$J.ajax({type:"POST",url:d+"?_method=PUT",contentType:"application/json",data:'{"feedback":"'+(b?"positive":"negative")+'"}',dataType:"json",success:function(c){var e;e=a.parents(".was_helpful");$J(".upvotes",e).text(c.helpfulness);$J(".total",e).text(c.helpfulness+c.unhelpfulness);$J(".vote_links",e).text("Thank you for rating this review.")},error:function(c){c&&c.status===401&&iwin.AuthUI.Login.show($(a.get(0)),
"You have to log in before you can rate another user's review.")}})};iwin.userReviews.validateComment=function(){if(i$("ur_comment").value.length>iwin.userReviews.charactersLimit)i$("ur_comment").value=i$("ur_comment").value.substring(0,iwin.userReviews.charactersLimit);i$("charactersLeft").value=iwin.userReviews.charactersLimit-i$("ur_comment").value.length};
iwin.userReviews.submitReview=function(){var a,b;a={comment:$F("ur_comment"),anonymous:i$("ur_anonymous").checked,ratings:{overall:$F("ur_stars_overall"),graphics:$F("ur_stars_graphics"),sound:$F("ur_stars_sound"),gameplay:$F("ur_stars_gameplay")}};a=Object.toJSON(a);b=i$("gameReviewErrors");b.addClassName("hideObj");i$("submitReview").hide();i$("statusMessage").show();i$("ur_comment").disabled=true;new Ajax.Request(i$("userReviewForm").action,{method:"POST",encoding:"UTF-8",contentType:"application/json",
requestHeaders:{Accept:"application/json"},postBody:a,onException:iwin.Util.problemHandler.bind("iwin.ReviewInfo.sendForm"),onSuccess:function(){i$("statusMessage").innerHTML="Thank you, your review has been received.";console.debug("success[iwin.userReviews.submitReview]")},onFailure:function(d){var c;d.status===401&&iwin.AuthUI.Login.show(i$("submitReview"),"You have to log in before you can add your review.");console.error("failure[iwin.ReviewInfo.sendForm]:  %s ",d.status);d=d.responseJSON.problems;
b.innerHTML="";for(c=0;c<d.length;c+=1)b.innerHTML+=iwin.userReviews.errors[d[c]]+"<br/>";b.removeClassName("hideObj");i$("statusMessage").hide();i$("submitReview").show();i$("ur_comment").disabled=false}})};
iwin.userReviews.init=function(){i$("ur_comment").observe("keydown",function(){iwin.userReviews.validateComment()});i$("ur_comment").observe("keyup",function(){iwin.userReviews.validateComment()});i$("submitReview").observe("click",function(a){iwin.userReviews.submitReview();Event.stop(a)});i$("review_form_link").observe("click",function(a){Event.stop(a)});Event.observe(i$("review_form_link"),"click",iwin.userReviews.reviewPopupHandler.bindAsEventListener(iwin.userReviews.reviewPopupHandler))};
iwin.userReviews.reviewPopupHandler=function(a){var b=$J(window);if(iwin.Auth.getCurrentUsername()||a.memo!=null&&a.memo.username!=null){iwin.Util.showObj("reviewGamePopup");a=$J("#reviewGamePopup");a.css("position","absolute");a.css("margin","0");a.css("top",(b.height()-a.innerHeight())/2+b.scrollTop()+"px");a.css("left",(b.width()-a.innerWidth())/2+b.scrollLeft()+"px");iwin.Util.showObj("reviewGamePopup");iwin.Util.showPopup("overlay",true);if(DetectFlashVer(9,0,0)!==true){$$("#userReviewForm .ratings")[0].hide();
i$("submitReview").hide();i$("ur_comment").disabled=true;i$("statusMessage").innerHTML="Please <a href='http://www.macromedia.com/go/getflashplayer'  rel='nofollow' style='text-decoration:underline;'>download</a> and install  macromedia flash player ";i$("statusMessage").show()}}else{iwin.Util.Event.observeOnce(document,"iwin:auth:login:success",this,["iwin:auth-ui:close"]);iwin.AuthUI.Login.show()}};iwin.userReviews.starInput=function(a,b){i$(a).value=b};Event.observe(document,"dom:loaded",iwin.userReviews.init);
var StarInput_DoFSCommand;StarInput_DoFSCommand=iwin.userReviews.starInput;

