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.NemqQuestion=Class.create(Component,{initialize:function($super,A){$super(A);
this.element.observe("mouseover",this.onMouseover.bindAsEventListener(this));
this.element.observe("mouseout",this.onMouseout.bindAsEventListener(this));
this.element.observe("click",this.onClick.bindAsEventListener(this));
},onMouseover:function(A){this.element.toggleClassName("hover");
},onMouseout:function(A){this.element.removeClassName("hover");
},onClick:function(A){document.location="/never-ending-quiz";
}});
Component.CloseHomepageMessageLink=Class.create(Component.Link,{onClick:function(A){A.stop();
Tracker.trackEvent("Homepage","Announcement","Close",null);
new Ajax.Request("/homepage/action/disable-message",{onSuccess:this.onSuccess.bind(this)});
},onSuccess:function(A){new Effect.Fade($("announcements"),{duration:0.5,from:1,to:0,queue:"end",transition:Effect.Transitions.sinoidal});
}});
Component.AddressBookLinks=Class.create(Component,{initialize:function($super,A){$super(A);
this.element.down("h4").observe("click",this.onClick.bindAsEventListener(this));
},onClick:function(A){Effect.toggle(this.element.down("ul"),"appear",{duration:0.5,queue:"end",transition:Effect.Transitions.sinoidal});
this.element.down("h4").toggleClassName("open");
}});
Component.ToggleLink=Class.create(Component.Link,{onClick:function(B){var A=$(this.element.readAttribute("toggle"));
Effect.toggle(A,"appear",{duration:0.5,queue:"end",transition:Effect.Transitions.sinoidal});
}});
Component.FriendsActivity=Class.create(Component,{initialize:function($super,A){$super(A);
this.updateFeed(25);
this.element.observe("view:more",this.updateFeed.bind(this,25));
this.element.observe("view:less",this.updateFeed.bind(this,10));
},updateFeed:function(A){this.element.update('<p class="loading">Loading friends activity...</p>');
var B="action=viewActivity&limit="+A;
new Ajax.Request("/friends.sv",{parameters:B,onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this),onTimeout:this.onTimeout.bind(this)});
},onSuccess:function(A){this.element.update(A.responseText);
new Component.Binder(this.element);
this.element.fire("friendContent:loaded");
},onTimeout:function(A){this.element.update("Sorry, our request for your recent friends activity timed out. It's probably Ed's fault, but it also could be the network.  Please refresh your browser and try again!");
},onFailure:function(A){this.element.update("Sorry, our request for your recent friends activity failed. You could blame Ed, or just try refreshing to see if the problem magically goes away!");
}});
Component.ViewMoreLink=Class.create(Component.Link,{onClick:function(A){this.element.fire("view:more",{});
}});
Component.ViewLessLink=Class.create(Component.Link,{onClick:function(A){this.element.fire("view:less",{});
}});
Component.RegenerableFlixsterFeed=Class.create(Component,{initialize:function($super,A){$super(A);
$("fullRegen").observe("click",this.onFullRegenClick.bindAsEventListener(this));
$("favorReviews").observe("click",this.onFavorReviewsClick.bindAsEventListener(this));
$("showAll").observe("click",this.onShowAllClick.bindAsEventListener(this));
},onFullRegenClick:function(A){var B="action=fullRegen";
$("friendsActivity").update("<p class=loading>Loading friends activity (full regen)...</p>");
new Ajax.Request("/friends.sv",{parameters:B,onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this),onTimeout:this.onTimeout.bind(this)});
},onFavorReviewsClick:function(A){var B="action=favorReviews";
$("friendsActivity").update("<p class=loading>Loading friends activity (favor reviews)...</p>");
new Ajax.Request("/friends.sv",{parameters:B,onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this),onTimeout:this.onTimeout.bind(this)});
},onShowAllClick:function(A){var B="action=showAll";
$("friendsActivity").update("<p class=loading>Loading friends activity (show all)...</p>");
new Ajax.Request("/friends.sv",{parameters:B,onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this),onTimeout:this.onTimeout.bind(this)});
},onSuccess:function(A){$("friendsActivity").update(A.responseText);
new Component.Binder($("friendsActivity"));
$("mergeContainer").hide();
$("newsfeed_items").show();
$("FeedFilterButtonTabs").hide();
},onTimeout:function(A){$("friendsActivity").update("Sorry, our request for your recent friends activity timed out.  It's probably Eugene's fault, but it also could be the network.  Please refresh your browser and try again!");
},onFailure:function(A){$("friendsActivity").update("Sorry, our request for your recent friends activity failed.  You could blame Ed, or just try refreshing to see if the problem magically goes away!");
}});
Component.AlertDisplayPreference=Class.create(Component,{initialize:function($super,A){$super(A);
this.closeLink=$("alertClose");
this.messageDiv=$("userAlerts");
if(this.closeLink!=null){this.closeLink.observe("click",this.onCloseClick.bindAsEventListener(this));
}},onCloseClick:function(A){Event.stop(A);
new Ajax.Request("/homepage/action/disable-alert",{onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this),onTimeout:this.onTimeout.bind(this)});
},onSuccess:function(A){this.messageDiv.hide();
},onTimeout:function(A){this.messageDiv.update("Sorry, our request to change your display preference for the alert box has timed out.  It's probably Scott's fault, but it also could be the network.  Please refresh your browser and try again!");
},onFailure:function(A){this.messageDiv.update("Sorry, unable to change your alert preference.  You could blame Scott, or just try refreshing to see if the problem magically goes away!");
}});
Component.HomepageHideMeetPeopleLink=Class.create(Component.Link,{onClick:function(A){A.stop();
new Ajax.Request("/homepage/action/disable-meet-people",{onSuccess:this.onSuccess.bind(this)});
},onSuccess:function(A){this.element.up("div").hide();
}});
Component.AddFriendsWidget=Class.create(Component,{initialize:function($super,A){$super(A);
var C=A.down("span.addFriend");
if(C!=null){C.observe("click",this.onAddFriend.bindAsEventListener(this));
}var B=A.down("span.notFriend");
if(B!=null){B.observe("click",this.onNotFriend.bindAsEventListener(this));
}},onAddFriend:function(A){var C=this.element.up("form");
if(C!=null){var B=Form.serialize(C);
C.update('<span class="added">invitation sent!</span>');
new Ajax.Request(this.getAddFriendUrl(),{parameters:B});
}},onNotFriend:function(A){var C=this.element.up("form");
if(C!=null){var B=Form.serialize(C);
C.update('<span class="ignored">never again!</span>');
new Ajax.Request("/invite/action/do-you-know/block",{parameters:B});
}}});
Component.ConnectFriendsWidget=Class.create(Component.AddFriendsWidget,{getAddFriendUrl:function(){return"/invite/action/connect-request/send";
}});
Component.InviteFriendsWidget=Class.create(Component.AddFriendsWidget,{getAddFriendUrl:function(){return"/invite/action/manual/send";
}});
Component.NewArticlesAnnouncementDisplayPreference=Class.create(Component,{initialize:function($super,A){$super(A);
this.closeLink=$("announcementClose");
this.messageDiv=$("newArticleAnnouncement");
if(this.closeLink!=null){this.closeLink.observe("click",this.onCloseClick.bindAsEventListener(this));
}},onCloseClick:function(A){Event.stop(A);
new Ajax.Request("/homepage/action/disable-article",{onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
},onSuccess:function(A){new Effect.Fade(this.messageDiv,{duration:0.5,from:1,to:0,queue:"end",transition:Effect.Transitions.sinoidal});
},onFailure:function(A){this.messageDiv.update("Sorry, unable to change your display preference.  You could blame Dan, or just try refreshing to see if the problem magically goes away!");
}});
View.FriendSuggestions=Class.create(View.RemoteView,{render:function(A){var B="viewHomePageFriendSuggestions=true";
new Ajax.Request("/friendsuggestion.sv",{parameters:B,onSuccess:this.onSuccess.bind(this)});
},onSuccess:function(A){this.element.update(A.responseText);
new Component.Binder(this.element);
}});
Component.DeferredAjaxLoader=Class.create(Component,{initialize:function(A){this.element=$(A);
new View.FriendSuggestions("friendSuggestionsView");
}});
Component.DisplayTopThirtyFriends=Class.create(Component,{initialize:function(A){this.element=$(A);
this.element.observe("click",this.onClick.bindAsEventListener(this));
this.element.observe("mouseover",this.onMouseOver.bindAsEventListener(this));
this.element.observe("mouseout",this.onMouseOut.bindAsEventListener(this));
},onClick:function(A){Effect.toggle($("overflowFriends"),"appear",{duration:0.5,queue:"end",transition:Effect.Transitions.sinoidal});
$("overflowFriends").toggleClassName("open");
if(!$("overflowFriends").hasClassName("open")){$("friendsExpandArrow").setAttribute("src","http://static5.flixster.com/static/images/icons/expandDownArrowBlue.gif");
}else{$("friendsExpandArrow").setAttribute("src","http://static5.flixster.com/static/images/icons/collapseUpArrowBlue.gif");
}},onMouseOver:function(A){if(!$("overflowFriends").hasClassName("open")){$("friendsExpandArrow").setAttribute("src","http://static5.flixster.com/static/images/icons/expandDownArrowOrange.gif");
}else{$("friendsExpandArrow").setAttribute("src","http://static5.flixster.com/static/images/icons/collapseUpArrowOrange.gif");
}},onMouseOut:function(A){if(!$("overflowFriends").hasClassName("open")){$("friendsExpandArrow").setAttribute("src","http://static5.flixster.com/static/images/icons/expandDownArrowBlue.gif");
}else{$("friendsExpandArrow").setAttribute("src","http://static5.flixster.com/static/images/icons/collapseUpArrowBlue.gif");
}}});
Component.FeedFilterButtonTabs=Class.create(Component,{initialize:function(A){this.element=A;
$("newsfeed").observe("merge:complete",this.activate.bind(this));
},activate:function(A){A.stop();
this.filterContent();
this.defaultViewIndex=parseInt(this.element.readAttribute("defaultView"));
this.element.observe("button:click",this.onButtonTabClick.bind(this));
this.element.down("li",this.defaultViewIndex).fire("button:click");
},filterContent:function(){this.userMessagingElementsInMergeList=$("mergeContainer").select("ol.userMessagingElement");
this.friendActivityElementsInMergeList=$("mergeContainer").select("ol.friendActivityElement");
this.hotTodayActivityElementsInMergeList=$("mergeContainer").select("ol.hotTodayActivityElement");
this.allActivityElementsInMergeList=$("mergeContainer").select("ol");
},onButtonTabClick:function(A){A.stop();
this.filter=parseInt(Event.element(A).readAttribute("filter"));
switch(this.filter){case 0:this.showFriendsActivityPlusHotToday();
this.handleButtonTabStates(this.filter);
break;
case 1:this.showFriendsActivity();
this.handleButtonTabStates(this.filter);
break;
case 2:this.showHotToday();
this.handleButtonTabStates(this.filter);
break;
default:}},showFriendsActivity:function(){this.allActivityElementsInMergeList.invoke("hide");
this.friendActivityElementsInMergeList.invoke("show");
this.userMessagingElementsInMergeList.invoke("show");
},showHotToday:function(){this.allActivityElementsInMergeList.invoke("hide");
this.hotTodayActivityElementsInMergeList.invoke("show");
this.userMessagingElementsInMergeList.invoke("hide");
},showFriendsActivityPlusHotToday:function(){this.allActivityElementsInMergeList.invoke("hide");
this.allActivityElementsInMergeList.invoke("show");
this.userMessagingElementsInMergeList.invoke("hide");
},handleButtonTabStates:function(A){this.element.select("li.selected").each(function(D,C){D.removeClassName("selected");
});
this.element.down("li",A).addClassName("selected");
var B="t="+A;
new Ajax.Request("/homepage/action/set-feedtab-pref",{parameters:B,onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
},onSuccess:function(){},onFailure:function(){}});
Component.FeedListManager=Class.create(Component,{initialize:function(A){this.element=A;
this.element.observe("friendContent:loaded",this.doMerge.bind(this));
$("mergeContainer").show();
},doMerge:function(A){A.stop();
this.userMessagingElements=$("newsfeed_items").select("ol.userMessagingElement");
this.friendActivityElements=$("newsfeed_items").select("ol.friendActivityElement");
this.hotTodayActivityElements=$("hotTodayActivity").select("ol.hotTodayActivityElement");
this.totalActivityElementsLength=this.friendActivityElements.length+this.hotTodayActivityElements.length;
this.htElement=0;
this.friendElement=0;
this.htList=true;
this.friendList=false;
this.placementInterval=((this.friendActivityElements!=null)&&(this.friendActivityElements.length>0))?(parseInt((this.friendActivityElements.length)/this.hotTodayActivityElements.length)):null;
this.placementInterval=(this.placementInterval<1)?1:this.placementInterval;
$("mergeContainer").update();
this.userMessagingElements.each(function(C,B){$("mergeContainer").insert({bottom:C});
});
for(i=0;
i<this.totalActivityElementsLength;
i++){if(this.htList){if((this.hotTodayActivityElements[this.htElement]!=null)&&(this.hotTodayActivityElements[this.htElement]!=undefined)){$("mergeContainer").insert({bottom:this.hotTodayActivityElements[this.htElement]});
}this.htElement++;
if((this.friendActivityElements[this.friendElement]!=null)&&(this.friendActivityElements[this.friendElement]!=undefined)){this.htList=!this.htList;
this.friendList=!this.friendList;
}}else{if(this.friendList){for(j=0;
j<this.placementInterval;
j++){if((this.friendActivityElements[this.friendElement]!=null)&&(this.friendActivityElements[this.friendElement]!=undefined)){$("mergeContainer").insert({bottom:this.friendActivityElements[this.friendElement]});
}this.friendElement++;
}if((this.hotTodayActivityElements[this.htElement]!=null)&&(this.hotTodayActivityElements[this.htElement]!=undefined)){this.htList=!this.htList;
this.friendList=!this.friendList;
}}}}this.element.fire("merge:complete");
}});
Component.MessageDisplayPreference=Class.create(Component,{initialize:function($super,A){$super(A);
this.closeLink=$("messageClose");
this.messageDiv=$("announcements");
if(this.closeLink!=null){this.closeLink.observe("click",this.onCloseClick.bindAsEventListener(this));
}},onCloseClick:function(A){Event.stop(A);
new Ajax.Request("/homepage/action/disable-message",{onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
},onSuccess:function(A){new Effect.Fade(this.messageDiv,{duration:0.5,from:1,to:0,queue:"end",transition:Effect.Transitions.sinoidal});
},onFailure:function(A){this.messageDiv.update("Sorry, unable to change your display preference.  You could blame Scott, or just try refreshing to see if the problem magically goes away!");
}});
Component.MessageDisplayPreference=Class.create(Component,{initialize:function($super,A){$super(A);
this.closeLink=$("messageClose");
this.messageDiv=$("announcements");
if(this.closeLink!=null){this.closeLink.observe("click",this.onCloseClick.bindAsEventListener(this));
}},onCloseClick:function(A){Event.stop(A);
new Ajax.Request("/homepage/action/disable-message",{onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
},onSuccess:function(A){new Effect.Fade(this.messageDiv,{duration:0.5,from:1,to:0,queue:"end",transition:Effect.Transitions.sinoidal});
},onFailure:function(A){this.messageDiv.update("Sorry, unable to change your display preference.  You could blame Scott, or just try refreshing to see if the problem magically goes away!");
}});
Component.AddToPartnerLinks=Class.create(Component,{initialize:function($super,A){$super(A);
this.element.down("h4").observe("click",this.onClick.bindAsEventListener(this));
},onClick:function(A){Effect.toggle(this.element.down("ul"),"appear",{duration:0.5,queue:"end",transition:Effect.Transitions.sinoidal});
this.element.down("h4").toggleClassName("open");
}});
Component.ContentRotator=Class.create(Component,{ROTATION_INTERVAL:4500,POINTER_HEIGHT_OFFSET:10,initialize:function($super,A){$super(A);
this.tabs=this.element.select("li");
this.selectedTab=this.tabs[0];
this.contentArea=this.element.down("div.contentArea");
this.adjustHeight();
this.positionPointer(this.selectedTab);
this.contentUrl=this.selectedTab.readAttribute("contentUrl");
this.contentArea.observe("click",this.onContentClick.bindAsEventListener(this));
if(this.tabs.size()>1){this.contentImages=new Hash();
this.contentArea.select("img.content").each(function(B){var C=B.readAttribute("index");
this.contentImages.set(C,B);
}.bind(this));
this.captions=this.contentArea.select("div.caption");
this.boundRotate=this.rotateContent.bind(this);
this.rotationTimerElapsed=0;
this.startRotationTimer();
this.tabs.invoke("observe","mouseover",this.onTabHover.bindAsEventListener(this));
this.tabs.invoke("observe","mouseout",this.onTabUnhover.bindAsEventListener(this));
this.tabs.invoke("observe","click",this.onTabClick.bindAsEventListener(this));
this.contentArea.observe("mouseover",this.onHover.bindAsEventListener(this));
this.contentArea.observe("mouseout",this.onUnhover.bindAsEventListener(this));
}},adjustHeight:function(){var F=this.element.getHeight()-this.getVertSupplementaryHeight(this.element);
var E=this.element.readAttribute("minHeight");
var C=this.getVertSupplementaryHeight(this.contentArea);
var A=F-C;
if(E){A=Math.max(A,E);
this.contentArea.setStyle({height:A+"px"});
this.element.setStyle({height:A+"px"});
}var G=this.getVertSupplementaryHeight(this.selectedTab);
A=F-(this.tabs.size()*G);
if(E){A=Math.max(A,E);
}var D=Math.round(A/this.tabs.size());
this.tabs.invoke("setStyle",{height:D+"px"});
if(this.tabs.size()>1){var B=this.element.down("ul");
A=B.getHeight()+this.getVertSupplementaryHeight(B)-C;
this.contentArea.setStyle({height:A+"px"});
this.element.setStyle({height:A+"px"});
}},positionPointer:function(B){var A=B.positionedOffset().top+Math.round(B.getHeight()/2)-this.POINTER_HEIGHT_OFFSET+"px";
this.contentArea.down(".pointer").setStyle({top:A});
this.element.down(".pointer").setStyle({top:A});
},startRotationTimer:function(){if(this.rotationTimerElapsed>=this.ROTATION_INTERVAL){this.rotateContent();
}else{this.rotationTimerStart=new Date().getTime()-this.rotationTimerElapsed;
var A=this.ROTATION_INTERVAL-this.rotationTimerElapsed;
this.timeoutId=setTimeout(this.boundRotate,A);
}},rotateContent:function(B){var A=this.tabs.indexOf(this.selectedTab);
if(A<this.tabs.size()-1){A++;
}else{A=0;
}this.selectTab(this.tabs[A]);
this.startRotationTimer();
},onContentClick:function(A){if(this.contentUrl&&A.target.tagName.toUpperCase()!="A"){location.href=this.contentUrl;
}},onTabHover:function(B){this.onHover(B);
var A=this.getTabEventTarget(B);
if(!A.hasClassName("active")){A.addClassName("hover");
}},onTabUnhover:function(B){this.onUnhover(B);
var A=this.getTabEventTarget(B);
if(A.hasClassName("hover")){A.removeClassName("hover");
}},onTabClick:function(B){var A=this.getTabEventTarget(B);
if(A!=this.selectedTab){B.stop();
clearTimeout(this.timeoutId);
this.selectTab(A);
}},onHover:function(A){clearTimeout(this.timeoutId);
this.rotationTimerElapsed=new Date().getTime()-this.rotationTimerStart;
},onUnhover:function(A){this.startRotationTimer();
},selectTab:function(D){var C=this.tabs.indexOf(this.selectedTab);
var E=this.tabs.indexOf(D);
this.contentUrl=D.readAttribute("contentUrl");
this.selectedTab.removeClassName("active");
D.removeClassName("hover");
D.addClassName("active");
this.positionPointer(D);
var B=this.contentImages.get(C);
if(B){new Effect.Fade(B,{from:1,to:0,duration:1.2});
}B=this.contentImages.get(E);
if(B){new Effect.Appear(B,{from:0,to:1,duration:1.2});
}var A=this.captions[C];
new Effect.Parallel([new Effect.Morph(A,{style:"left:-420px;",duration:1.2})]);
var F=this.captions[E];
F.setStyle({left:"451px"});
new Effect.Parallel([new Effect.Morph(F,{style:"left:60px;",duration:1.2})],{delay:0.2});
this.rotationTimerElapsed=0;
this.selectedTab=D;
},getVertSupplementaryHeight:function(A){return parseInt(A.getStyle("paddingTop").replace("px",""))+parseInt(A.getStyle("paddingBottom").replace("px",""))+parseInt(A.getStyle("borderTopWidth").replace("px",""))+parseInt(A.getStyle("borderBottomWidth").replace("px",""));
},getTabEventTarget:function(B){var A=B.target;
if(A.tagName.toUpperCase()!="LI"){A=Element.up(A,"li");
}return A;
}});
Component.WhatsHappeningRefreshLink=Class.create(Component.Link,{onClick:function(A){this.stopObservingClick();
this.element.removeClassName("jbutton");
this.element.src="http://static5.flixster.com/static/images/refreshing2.gif";
var B={numRatings:this.element.readAttribute("numRatings"),time:this.element.readAttribute("time")};
new Ajax.Request("/homepage/service/recent-ratings",{parameters:B,method:"get",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
},onSuccess:function(A){$("recentRatings").replace(A.responseText);
new Component.Binder($("recentRatings"));
},onFailure:function(A){this.element.src="http://static5.flixster.com/static/images/refresh2.gif";
this.element.addClassName("jbutton");
this.startObservingClick();
}});




var isOldPage=false;
var RatingManager={cache:new Cache(),options:{url:"/rate.sv",parameters:""},save:function(B,A,E,C){RatingManager.cache.put(A,E);
if(B!=null&&B!=""){var D="rateAction=doRateScore&rateMovie="+A+"&rateScore="+E+"&rateSource="+C+RatingManager.options.parameters;
new Ajax.Request(RatingManager.options.url,{parameters:D});
}},find:function(A){return RatingManager.cache.get(A);
}};
var ReviewManager={cache:new Cache(),options:{url:"/rate.sv",parameters:""},save:function(C,B,A,D){ReviewManager.cache.put(B,A);
if(C!=null&&C!=""){var E="rateAction=doRateReview&rateMovie="+B+"&rateComment="+encodeURIComponent(A)+"&rateSource="+D+RatingManager.options.parameters;
new Ajax.Request(ReviewManager.options.url,{parameters:E});
}},find:function(A){return ReviewManager.cache.get(A);
}};
var RatingWidget=Class.create();
RatingWidget.prototype={initialize:function(B,A,D,C){this.user=B;
this.movie=A;
this.score=D;
this.source=C;
if((this.source=="HOM")||(this.source=="SPL")||(this.source=="QIK")||(this.source=="MVT")){isOldPage=true;
}this.stars=new RatingStars(this);
this.buttons=new RatingButtons(this);
if($("clear"+this.movie)!=null){Event.observe($("clear"+this.movie),"click",this.onClear.bind(this));
}},onRate:function(A){if(!(this.user!=null&&this.user!="")){Tracker.trackEvent("Rating Widget","Anonymous Rating Attempt","Movie Detail");
new View.ErrorPopup("stars"+this.movie,{title:"Whoops",content:"<a href='/userAuth.do?displayRegister='>Register</a> or <a href='/userAuth.do?displayLogin='>login</a> to save and share all of your ratings and reviews!"});
return ;
}if(this.score==A){this.score=0;
}else{this.score=A;
}document.fire("rating:score",{movie:this.movie,score:this.score});
RatingManager.save(this.user,this.movie,this.score,this.source);
this.stars.paint(this.score);
this.buttons.paint(this.score);
},onClear:function(){this.score=0;
RatingManager.save(this.user,this.movie,this.score,this.source);
this.stars.paint(this.score);
this.buttons.paint(this.score);
}};
var RatingStars=Class.create();
RatingStars.prototype={initialize:function(A){this.widget=A;
Event.observe("stars"+this.widget.movie,"mousemove",this.onMousemove.bindAsEventListener(this));
Event.observe("stars"+this.widget.movie,"mouseout",this.onMouseout.bindAsEventListener(this));
Event.observe("stars"+this.widget.movie,"click",this.onClick.bindAsEventListener(this));
this.paint(this.widget.score);
},onMousemove:function(A){var B=this.map(A);
this.paint(B);
},onMouseout:function(A){this.paint(this.widget.score);
},onClick:function(A){var B=this.map(A);
this.widget.onRate(B);
},map:function(E){var D=Position.cumulativeOffset(Event.element(E));
var C=Event.element(E);
var A=0;
if(E.offsetX){A=E.offsetX;
}else{if(C.offsetX!=null){var B=C.offsetX;
A=E.layerX-B;
}else{if(E.layerX){var B=Position.cumulativeOffset(C)[0];
A=E.layerX-B;
C.offsetX=B;
}}}if($R(0,7).include(A)){return 6;
}else{if($R(8,14).include(A)){return 1;
}else{if($R(15,22).include(A)){return 7;
}else{if($R(23,29).include(A)){return 2;
}else{if($R(30,37).include(A)){return 8;
}else{if($R(38,44).include(A)){return 3;
}else{if($R(45,52).include(A)){return 9;
}else{if($R(53,59).include(A)){return 4;
}else{if($R(60,66).include(A)){return 10;
}else{if($R(67,74).include(A)){return 5;
}else{return -1;
}}}}}}}}}}},paint:function(A){if(isOldPage){switch(A){case 1:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/1.0.gif";
break;
case 2:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/2.0.gif";
break;
case 3:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/3.0.gif";
break;
case 4:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/4.0.gif";
break;
case 5:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/5.0.gif";
break;
case 6:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/0.5.gif";
break;
case 7:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/1.5.gif";
break;
case 8:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/2.5.gif";
break;
case 9:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/3.5.gif";
break;
case 10:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/4.5.gif";
break;
default:$("stars"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/0.0.gif";
}}else{switch(A){case 1:$("stars"+this.widget.movie).className="ratingStars ratingWidget score10";
$("currentScore").className="ratingStars score10";
break;
case 2:$("stars"+this.widget.movie).className="ratingStars ratingWidget score20";
$("currentScore").className="ratingStars score20";
break;
case 3:$("stars"+this.widget.movie).className="ratingStars ratingWidget score30";
$("currentScore").className="ratingStars score30";
break;
case 4:$("stars"+this.widget.movie).className="ratingStars ratingWidget score40";
$("currentScore").className="ratingStars score40";
break;
case 5:$("stars"+this.widget.movie).className="ratingStars ratingWidget score50";
$("currentScore").className="ratingStars score50";
break;
case 6:$("stars"+this.widget.movie).className="ratingStars ratingWidget score05";
$("currentScore").className="ratingStars score05";
break;
case 7:$("stars"+this.widget.movie).className="ratingStars ratingWidget score15";
$("currentScore").className="ratingStars score15";
break;
case 8:$("stars"+this.widget.movie).className="ratingStars ratingWidget score25";
$("currentScore").className="ratingStars score25";
break;
case 9:$("stars"+this.widget.movie).className="ratingStars ratingWidget score35";
$("currentScore").className="ratingStars score35";
break;
case 10:$("stars"+this.widget.movie).className="ratingStars ratingWidget score45";
$("currentScore").className="ratingStars score45";
break;
default:$("stars"+this.widget.movie).className="ratingStars ratingWidget score00";
$("currentScore").className="ratingStars score00";
}}}};
var RatingButtons=Class.create();
RatingButtons.prototype={initialize:function(A){this.widget=A;
if($("wts"+this.widget.movie)){Event.observe("wts"+this.widget.movie,"click",this.onWtsClick.bindAsEventListener(this));
if(!isOldPage){Event.observe("wts"+this.widget.movie,"mouseover",this.onWtsMouseOver.bindAsEventListener(this));
Event.observe("wts"+this.widget.movie,"mouseout",this.onWtsMouseOut.bindAsEventListener(this));
}}if($("ni"+this.widget.movie)){Event.observe("ni"+this.widget.movie,"click",this.onNiClick.bindAsEventListener(this));
if(!isOldPage){Event.observe("ni"+this.widget.movie,"mouseover",this.onNiMouseOver.bindAsEventListener(this));
Event.observe("ni"+this.widget.movie,"mouseout",this.onNiMouseOut.bindAsEventListener(this));
}}this.paint(this.widget.score);
},onWtsClick:function(A){this.widget.onRate(12);
},onWtsMouseOver:function(A){$("wts"+this.widget.movie).className="ratingInterest ratingWidget wtsHover";
},onWtsMouseOut:function(A){if(this.widget.score==12){$("wts"+this.widget.movie).className="ratingInterest ratingWidget wtsOn";
}else{$("wts"+this.widget.movie).className="ratingInterest ratingWidget wtsOff";
}},onNiClick:function(A){this.widget.onRate(11);
},onNiMouseOver:function(A){$("ni"+this.widget.movie).className="ratingInterest ratingWidget niHover";
},onNiMouseOut:function(A){if(this.widget.score==11){$("ni"+this.widget.movie).className="ratingInterest ratingWidget niOn";
}else{$("ni"+this.widget.movie).className="ratingInterest ratingWidget niOff";
}},paint:function(A){if(isOldPage){switch(A){case 11:if($("ni"+this.widget.movie)){$("ni"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/ni.on.gif";
}if($("wts"+this.widget.movie)){$("wts"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/ws.off.gif";
}break;
case 12:if($("ni"+this.widget.movie)){$("ni"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/ni.off.gif";
}if($("wts"+this.widget.movie)){$("wts"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/ws.on.gif";
}break;
default:if($("ni"+this.widget.movie)){$("ni"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/ni.off.gif";
}if($("wts"+this.widget.movie)){$("wts"+this.widget.movie).src="http://static5.flixster.com/static/images/rating/ws.off.gif";
}}}else{switch(A){case 11:if($("ni"+this.widget.movie)){$("ni"+this.widget.movie).className="ratingInterest ratingWidget niOn";
$("currentScore").className="ratingInterest niOn";
}if($("wts"+this.widget.movie)){$("wts"+this.widget.movie).className="ratingInterest ratingWidget wtsOff";
}break;
case 12:if($("ni"+this.widget.movie)){$("ni"+this.widget.movie).className="ratingInterest ratingWidget niOff";
}if($("wts"+this.widget.movie)){$("wts"+this.widget.movie).className="ratingInterest ratingWidget wtsOn";
$("currentScore").className="ratingInterest wtsOn";
}break;
default:if($("ni"+this.widget.movie)){$("ni"+this.widget.movie).className="ratingInterest ratingWidget niOff";
}if($("wts"+this.widget.movie)){$("wts"+this.widget.movie).className="ratingInterest ratingWidget wtsOff";
}}}}};
var ReviewWidget=Class.create();
ReviewWidget.prototype={initialize:function(B,A,C){this.user=B;
this.movie=A;
this.source=C;
Event.observe($("comment"+this.movie),"focus",this.onFocus.bindAsEventListener(this));
if($("save"+this.movie)!=null){Event.observe($("save"+this.movie),"click",this.onSave.bindAsEventListener(this));
}else{Event.observe($("comment"+this.movie),"blur",this.onSave.bindAsEventListener(this));
}if($("clear"+this.movie)!=null){Event.observe($("clear"+this.movie),"click",this.onClear.bindAsEventListener(this));
}},onFocus:function(A){if($("save"+this.movie)!=null){$("save"+this.movie).src="http://static5.flixster.com/static/images/bt_save_ani.gif";
}},onSave:function(A){var B=false;
if(!(this.user!=null&&this.user!="")){Tracker.trackEvent("Review Widget","Anonymous Review Attempt","Movie Detail");
new View.ErrorPopup("save"+this.movie,{title:"Whoops",content:"<a href='/userAuth.do?displayRegister='>Register</a> or <a href='/userAuth.do?displayLogin='>login</a> to save and share all of your ratings and reviews!"});
return ;
}if($("save"+this.movie)!=null){$("save"+this.movie).src="http://static5.flixster.com/static/images/bt_saved.gif";
}if($("currentComment")!=null){var C=$F("comment"+this.movie).replace(/\n/gi,"<br/>");
$("currentComment").update(C);
}if($("comment"+this.movie).readAttribute("message")!=null){if($F("comment"+this.movie).strip()!=($("comment"+this.movie).readAttribute("message")).strip()){B=true;
}}else{B=true;
}if(B){ReviewManager.save(this.user,this.movie,$F("comment"+this.movie),this.source);
}},onClear:function(A){$("comment"+this.movie).value="";
if($("currentComment")!=null){$("currentComment").update("");
}ReviewManager.save(this.user,this.movie,$F("comment"+this.movie),this.source);
}};
var Images={cache:function(){if(isOldPage){var J=new Image();
J.src="http://static5.flixster.com/static/images/rating/0.0.gif";
var I=new Image();
I.src="http://static5.flixster.com/static/images/rating/1.0.gif";
var H=new Image();
H.src="http://static5.flixster.com/static/images/rating/2.0.gif";
var G=new Image();
G.src="http://static5.flixster.com/static/images/rating/3.0.gif";
var F=new Image();
F.src="http://static5.flixster.com/static/images/rating/4.0.gif";
var E=new Image();
E.src="http://static5.flixster.com/static/images/rating/5.0.gif";
var D=new Image();
D.src="http://static5.flixster.com/static/images/rating/0.5.gif";
var C=new Image();
C.src="http://static5.flixster.com/static/images/rating/1.5.gif";
var B=new Image();
B.src="http://static5.flixster.com/static/images/rating/2.5.gif";
var A=new Image();
A.src="http://static5.flixster.com/static/images/rating/3.5.gif";
var M=new Image();
M.src="http://static5.flixster.com/static/images/rating/4.5.gif";
var L=new Image();
L.src="http://static5.flixster.com/static/images/rating/ni.on.gif";
var K=new Image();
K.src="http://static5.flixster.com/static/images/rating/ws.on.gif";
}}};
Event.observe(window,"load",Images.cache);




