Component.UserCommentDeleteLink=Class.create(Component.Link,{onClick:function(A){A.stop();
new View.ConfirmationPopup(this.element,{content:"Are you sure you want to delete this comment?",onConfirm:this.onDelete.bindAsEventListener(this),onCancel:this.onCancel.bindAsEventListener(this)});
},onCancel:function(){},onDelete:function(){new Ajax.Request("/api/v1/users/"+this.element.readAttribute("user")+"/comments/"+this.element.readAttribute("comment")+".json",{parameters:{_method:"delete"},method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
Tracker.tag("RemoveProfileComment");
},onSuccess:function(A){new Effect.Shrink(this.element.up("li"),{direction:"top-left",duration:0.5});
},onFailure:function(A){new View.ErrorPopup(this.element,{title:"Unexpected Error",content:"Failed to delete the comment."});
}});
Component.FriendSelect=Class.create(Component.Select,{onChange:function(A){if($F(this.element)!=""){document.location=$F(this.element);
}}});
Component.NominateSuperReviewerLink=Class.create(Component.Link,{onClick:function(A){A.stop();
var B="userId=${user.id}&eliteRole=REV";
new Ajax.Request("/elites/action/nominate",{parameters:B,onSuccess:this.onSuccess.bind(this)});
},onSuccess:function(A){window.location.reload(true);
}});
Component.BlockUserLink=Class.create(Component.Link,{onClick:function(A){A.stop();
new View.ConfirmationPopup(this.element,{content:"Are you sure you want to block this member?",onConfirm:this.onBlock.bindAsEventListener(this)});
},onBlock:function(){this.blocked=this.element.readAttribute("blocked");
this.blocker=this.element.readAttribute("blocker");
var A={_format:"json",_method:"post"};
new Ajax.Request("/api/v1/users/"+this.blocked+"/blocks",{parameters:A,method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
this.element.update("...");
},onSuccess:function(A){this.element.replace("Blocked.");
},onFailure:function(A){this.element.update("Oops, please try again later.");
}});
Component.UnblockUserLink=Class.create(Component.Link,{onClick:function(A){A.stop();
new View.ConfirmationPopup(this.element,{content:"Are you sure you want to unblock this member?",onConfirm:this.onBlock.bindAsEventListener(this)});
},onBlock:function(){this.blocked=this.element.readAttribute("blocked");
this.blocker=this.element.readAttribute("blocker");
var A={_format:"json",_method:"delete"};
new Ajax.Request("/api/v1/users/"+this.blocked+"/blocks/"+this.blocker,{parameters:A,method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
this.element.update("...");
},onSuccess:function(A){this.element.replace("Unblocked.");
},onFailure:function(A){this.element.update("Oops, please try again later.");
}});
Component.RemoveBuddyLink=Class.create(Component.Link,{onClick:function(A){A.stop();
new View.ConfirmationPopup(this.element,{content:"Are you sure you want to remove this friend?",onConfirm:this.onDelete.bindAsEventListener(this)});
},onDelete:function(){var B=this.element.readAttribute("me");
var A=this.element.readAttribute("friend");
var C={_method:"delete",_format:"json"};
new Ajax.Request("/api/v1/users/"+B+"/friends/"+A,{parameters:C,onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
},onSuccess:function(A){this.element.replace("Removed.");
},onFailure:function(A){this.element.replace("Oops, please try again later.");
}});
Component.ChangeSkinLink=Class.create(Component.Link,{onClick:function(A){A.stop();
var B={skin:this.element.readAttribute("skin")};
new Ajax.Request("/skins/action/change",{parameters:B,onSuccess:this.onSuccess.bind(this)});
},onSuccess:function(A){new View.SuccessPopup(this.element,{title:"Profile Updated.",content:"Click 'ok' to check out your new profile skin.",onClose:this.onClose.bindAsEventListener(this)});
},onClose:function(A){document.location="/profile";
}});
Component.FlashWidget=Class.create(Component.FlashMovieMeeboBarDecoupler);




var ratingSubmitQueue=new Array();
var ratingSubmitQueueLength=0;
var ajaxObj;
var d=document;
var curRatingIds=new Array();
var curRatings=new Array();
var origRatings=new Array();
var movieTitles=new Array();
var movieDbIds=new Array();
var rateSrc=new Array();
function rateScoreToImage(A,B){useNew=false;
if(B=="qck"||B=="wiz"||B=="mct"){useNew=true;
}if(A==0){return"http://static5.flixster.com/static/images/0stars."+(useNew?"new.":"")+"gif";
}if(A==1){return"http://static5.flixster.com/static/images/1stars."+(useNew?"new.":"")+"gif";
}if(A==2){return"http://static5.flixster.com/static/images/2stars."+(useNew?"new.":"")+"gif";
}if(A==3){return"http://static5.flixster.com/static/images/3stars."+(useNew?"new.":"")+"gif";
}if(A==4){return"http://static5.flixster.com/static/images/4stars."+(useNew?"new.":"")+"gif";
}if(A==5){return"http://static5.flixster.com/static/images/5stars."+(useNew?"new.":"")+"gif";
}if(A==6){return"http://static5.flixster.com/static/images/halfstars."+(useNew?"new.":"")+"gif";
}if(A==7){return"http://static5.flixster.com/static/images/1_halfstars."+(useNew?"new.":"")+"gif";
}if(A==8){return"http://static5.flixster.com/static/images/2_halfstars."+(useNew?"new.":"")+"gif";
}if(A==9){return"http://static5.flixster.com/static/images/3_halfstars."+(useNew?"new.":"")+"gif";
}if(A==10){return"http://static5.flixster.com/static/images/4_halfstars."+(useNew?"new.":"")+"gif";
}if(A==_NOT_INTERESTED){return"http://static5.flixster.com/static/images/0stars."+(useNew?"new.":"")+"gif";
}if(A==_WANT_TO_SEE){return"http://static5.flixster.com/static/images/0stars."+(useNew?"new.":"")+"gif";
}return"http://static5.flixster.com/static/images/0stars."+(useNew?"new.":"")+"gif";
}function flashSaveButton(){if($("widgetSaveBtn")){document.images["widgetSaveBtn"].src="http://static5.flixster.com/static/images/bt_save_ani.gif";
}}function commonWgt_ajaxSubmit(A){var B=commonWgt_getRateSubmitParams(A);
new Ajax.Request("/rate.sv",{parameters:B});
}var expWgt_openMovie="";
function expWgt_expand(A){expWgt_closeOpened();
expWgt_rateSet(A,curRatings[A]);
$("expWgtDisplay"+A).style.display="none";
$("expWgt_rateBox"+A).style.display="block";
expWgt_openMovie=A;
}function expWgt_collapse(A){$("expWgt_rateBox"+A).style.display="none";
$("expWgtDisplay"+A).style.display="block";
}function expWgt_closeOpened(){if(expWgt_openMovie!=""){expWgt_commentSet(expWgt_openMovie,$("commonWgt_commentBox"+expWgt_openMovie).value);
expWgt_rateSave(expWgt_openMovie);
expWgt_openMovie="";
}}function expWgt_rateClear(A){expWgt_commentSet(A,"");
expWgt_rateSet(A,0);
expWgt_rateSave(A);
}function expWgt_rateDone(A){expWgt_commentSet(A,$("commonWgt_commentBox"+A).value);
expWgt_rateSave(A);
}function expWgt_rateStarHover(B,A){document.images["expWgt_rateStarsBtn"+B].src=rateScoreToImage(A,"exp");
}function expWgt_rateStarsReset(A){rating=curRatings[A];
if(rating==_NOT_INTERESTED||rating==_WANT_TO_SEE){document.images["expWgt_rateStarsBtn"+A].src="http://static5.flixster.com/static/images/0stars.gif";
}else{document.images["expWgt_rateStarsBtn"+A].src=rateScoreToImage(rating,"exp");
}}function expWgt_commentSet(A,B){$("commonWgt_commentBox"+A).value=B;
if($("expWgt_comImg"+A)){if(B==""){$("expWgt_comImg"+A).style.display="none";
}else{$("expWgt_comImg"+A).style.display="inline";
}}}function expWgt_rateSet(A,B){curRatings[A]=B;
if(B==_NOT_INTERESTED){document.images["expWgt_rateNiImg"+A].src="http://static5.flixster.com/static/images/ni_on.gif";
document.images["expWgt_rateWsImg"+A].src="http://static5.flixster.com/static/images/ws.gif";
document.images["expWgt_rateStarsBtn"+A].src="http://static5.flixster.com/static/images/0stars.gif";
$("expWgt_rateStarsBtn"+A).className="expWgt_rateStars";
$("expWgt_rateStarBar"+A).className="expWgt_rateStarBar";
if($("expWgt_RerateBtn"+A)){$("expWgt_RerateBtn"+A).style.display="inline";
}if(document.images["expWgt_RateImg"+A]!=null){document.images["expWgt_RateImg"+A].src="http://static5.flixster.com/static/images/ni_flat.gif";
}}else{if(B==_WANT_TO_SEE){document.images["expWgt_rateNiImg"+A].src="http://static5.flixster.com/static/images/ni.gif";
document.images["expWgt_rateWsImg"+A].src="http://static5.flixster.com/static/images/ws_on.gif";
document.images["expWgt_rateStarsBtn"+A].src="http://static5.flixster.com/static/images/0stars.gif";
$("expWgt_rateStarsBtn"+A).className="expWgt_rateStars";
$("expWgt_rateStarBar"+A).className="expWgt_rateStarBar";
if($("expWgt_RerateBtn"+A)){$("expWgt_RerateBtn"+A).style.display="inline";
}if(document.images["expWgt_RateImg"+A]!=null){document.images["expWgt_RateImg"+A].src="http://static5.flixster.com/static/images/ws_flat.gif";
}}else{if(parseInt(B)==0){curRatings[A]=0;
document.images["expWgt_rateWsImg"+A].src="http://static5.flixster.com/static/images/ws.gif";
document.images["expWgt_rateNiImg"+A].src="http://static5.flixster.com/static/images/ni.gif";
$("expWgt_rateStarsBtn"+A).className="expWgt_rateStars";
$("expWgt_rateStarBar"+A).className="expWgt_rateStarBar";
if($("expWgt_RerateBtn"+A)){$("expWgt_RerateBtn"+A).style.display="none";
}if(document.images["expWgt_RateImg"+A]!=null){document.images["expWgt_RateImg"+A].src="http://static5.flixster.com/static/images/rateMe.gif";
}}else{curRatings[A]=parseInt(B);
document.images["expWgt_rateWsImg"+A].src="http://static5.flixster.com/static/images/ws.gif";
document.images["expWgt_rateNiImg"+A].src="http://static5.flixster.com/static/images/ni.gif";
$("expWgt_rateStarsBtn"+A).className="expWgt_rateStars expWgt_rateStars_mod_on";
$("expWgt_rateStarBar"+A).className="expWgt_rateStarBar expWgt_rateStarBar_mod_on";
if($("expWgt_RerateBtn"+A)){$("expWgt_RerateBtn"+A).style.display="inline";
}if(document.images["expWgt_RateImg"+A]!=null){document.images["expWgt_RateImg"+A].src=rateScoreToImage(curRatings[A],"exp");
}}}}}function expWgt_rateSave(A){expWgt_collapse(A);
commonWgt_rateSave(A,true);
expWgt_openMovie="";
}var fltWgt_openMovie="";
function fltWgt_rateStarHover(B,A,C){if($("fltWgt_rateStarsBtn"+B)){document.images["fltWgt_rateStarsBtn"+B].src=rateScoreToImage(A,C);
}}function fltWgt_rateStarsReset(A,B){rating=curRatings[A];
if(rating==_NOT_INTERESTED||rating==_WANT_TO_SEE){if($("fltWgt_rateStarsBtn"+A)){document.images["fltWgt_rateStarsBtn"+A].src="http://static5.flixster.com/static/images/0stars"+((B=="wiz"||B=="mct")?".new":"")+".gif";
}}else{if($("fltWgt_rateStarsBtn"+A)){document.images["fltWgt_rateStarsBtn"+A].src=rateScoreToImage(rating,B);
}}}function fltWgt_rateSet(mvID,rating,type,callback){if(curRatings[mvID]==rating&&curRatings[mvID]!=0){fltWgt_rateSet(mvID,0,type);
if(callback!=null){var code=callback+"('"+mvID+"', '0')";
eval(code);
}return ;
}else{document.fire("rating:score");
curRatings[mvID]=rating;
prepend="";
if(type=="small"){prepend="bt_";
}if(type=="wiz"||type=="mct"){prepend="wiz_";
}if(rating==_NOT_INTERESTED){if($("fltWgt_rateNiImg"+mvID)){document.images["fltWgt_rateNiImg"+mvID].src="http://static5.flixster.com/static/images/"+prepend+"ni_on.gif";
}}else{if($("fltWgt_rateNiImg"+mvID)){document.images["fltWgt_rateNiImg"+mvID].src="http://static5.flixster.com/static/images/"+prepend+"ni_off.gif";
}}if(rating==_WANT_TO_SEE){if($("fltWgt_rateWsImg"+mvID)){document.images["fltWgt_rateWsImg"+mvID].src="http://static5.flixster.com/static/images/"+prepend+"ws_on.gif";
}}else{if($("fltWgt_rateWsImg"+mvID)){document.images["fltWgt_rateWsImg"+mvID].src="http://static5.flixster.com/static/images/"+prepend+"ws_off.gif";
}}if(rating==_NOT_INTERESTED||rating==_WANT_TO_SEE||rating==0){if($("fltWgt_rateStarsBtn"+mvID)){document.images["fltWgt_rateStarsBtn"+mvID].src="http://static5.flixster.com/static/images/0stars"+((type=="wiz"||type=="mct")?".new":"")+".gif";
}}curRatings[mvID]=parseInt(rating);
if(callback!=null){var code=callback+"('"+mvID+"', '"+rating+"')";
eval(code);
}}if(type!="mct"){fltWgt_rateSave(mvID,true);
}else{}}function fltWgt_expandComment(A){if(fltWgt_openMovie==A){fltWgt_collapse(fltWgt_openMovie);
}else{fltWgt_closeOpened();
$("fltWgt_commentExpand"+A).style.display="block";
fltWgt_openMovie=A;
}}function fltWgt_collapse(A){$("fltWgt_commentExpand"+A).style.display="none";
fltWgt_rateSave(A,false);
fltWgt_openMovie="";
}function fltWgt_closeOpened(){if(fltWgt_openMovie!=""){fltWgt_collapse(fltWgt_openMovie);
}}function fltWgt_rateSave(A,B){commonWgt_rateSave(A,B);
}function fltWgt_commentSet(mvID,newComment,callback){$("commonWgt_commentBox"+mvID).value=newComment;
if(callback!=null){var code=callback+"('"+mvID+"')";
eval(code);
}}function fltWgt_rateClear(A,B){fltWgt_commentSet(A,"");
fltWgt_rateSet(A,0,B);
}_AJAX_PARAMS="rateAction=doRate&rateUser="+currentUser.id+"&key="+encodeURIComponent(currentUser.key);
_WANT_TO_SEE="12";
_NOT_INTERESTED="11";
function commonWgt_rateSave(A,D){if(currentUser.isLoggedIn()){commonWgt_ajaxSubmit(A);
if(curRatings[A]==_WANT_TO_SEE&&origRatings[A]!=_WANT_TO_SEE){if(D){var C=movieTitles[A];
if(C.length>30){C=C.substring(0,30)+"...";
}var B=C+" has been added to your list.";
}}}else{commonWgt_ajaxSubmit(A);
if(D){var C=movieTitles[A];
if(C.length>30){C=C.substring(0,30)+"...";
}alert("Your ratings will not be saved until you register or sign in!");
}}if($("widgetSaveBtn")){document.images["widgetSaveBtn"].src="http://static5.flixster.com/static/images/bt_saved.gif";
}}function commonWgt_getRateSubmitParams(B){var A=Math.random()*1000000;
var C=Math.round(A);
if(movieDbIds&&movieDbIds[B]){return(_AJAX_PARAMS+"&rateMovie="+movieDbIds[B]+"&rateScore="+curRatings[B]+"&rateComment="+encodeURIComponent($("commonWgt_commentBox"+B).value)+"&rateSource="+rateSrc[B]+"&rid="+C+"&ratingId="+(curRatingIds&&curRatingIds[B]?curRatingIds[B]:-1));
}else{}}



