UserReview=new Class.create({initialize:function(b){(this.container=$(b))&&this.container.observe("click",this.containerClickEvent.bindAsEventListener(this))},containerClickEvent:function(b){var a=b.element();a.tagName=="IMG"&&(a=$(a.parentNode));if(a.hasClassName("report_spam_review")){b.stop();new Ajax.Request(a.href,{onComplete:function(c){if(c=Application.ajaxResponseProcess(c,null)){this.hideAllForms();this.win=new DefaultDialog({handle:a,width:300,padding:0,margin:0,content:c.resource,className:"grey_top",
close:{link:!1,overlay:!0,esc:!0}});this.win.open()}}.bind(this)});return!0}if(a.hasClassName("report_spam_comment")){b.stop();new Ajax.Request(a.href,{onComplete:function(c){if(c=Application.ajaxResponseProcess(c,null)){this.hideAllForms();this.win=new DefaultDialog({handle:a,width:300,padding:0,margin:0,content:c.resource,className:"grey_top",close:{link:!1,overlay:!0,esc:!0}});this.win.open()}}.bind(this)});return!0}if(a.hasClassName("close_comment_form")){b.stop();this.hideAllForms();return!0}if(a.hasClassName("btn_grey")){b.stop();
new Ajax.Request(a.href,{onComplete:function(c){c=Application.ajaxResponseProcess(c,new SimpleMessage(a.up(5).select(".comment_message").first(),{add:function(d){this.container.show();this.container.update(d);return!0}}));if(typeof c.resource.vote1!="undefined"){a.up(1).select(".thumbs_up_value").first().update(c.resource.vote1);a.up(1).select(".thumbs_down_value").first().update(c.resource.vote2);a.up(5).select(".comment_message").first().fade({duration:2})}}});return!0}if(a.hasClassName("read_review")){b.stop();
new Ajax.Request(a.href,{onComplete:function(c){(c=Application.ajaxResponseProcess(c,null))&&$(a.parentNode).update(c.resource)}})}if(a.hasClassName("user_review_comment")){b.stop();this.getReviewCommentForm(a)}if(a.hasClassName("view_all_comments")){b.stop();new Ajax.Request(a.href,{onComplete:function(c){if(c=Application.ajaxResponseProcess(c,null)){$("comments_"+a.id.replace("view_all_comments_","")).update(c.resource);a.hide()}}})}},commentReviewById:function(b){(b=$("commentReview"+b))&&this.getReviewCommentForm(b)},
getReviewCommentForm:function(b){new Ajax.Request(b.href,{onComplete:function(a){if(a=Application.ajaxResponseProcess(a,null)){this.hideAllForms();$(b.parentNode).hide();new Insertion.After($(b.parentNode),a.resource)}}.bind(this)})},hideAllForms:function(){$$(".comment_area").each(function(b){try{b.up(1).select(".block").first().show()}catch(a){}b.remove()})}});

