Component.TextCounter=Class.create({initialize:function(A){this.element=$(A);
this.target=$(this.element.readAttribute("text"));
this.limit=parseInt(this.target.readAttribute("maxlength"));
this.target.observe("keyup",this.onKeyUp.bindAsEventListener(this));
},onKeyUp:function(A){this.element.update(this.limit-this.target.value.length);
}});
Component.TextDefault=Class.create({initialize:function(A){this.field=$(A);
this.message=this.field.readAttribute("message");
if(!TextUtils.hasText($F(this.field))){this.field.value=this.message;
}Event.observe($(this.field),"focus",this.onFocus.bind(this));
Event.observe($(this.field),"blur",this.onBlur.bind(this));
},onFocus:function(A){if($F(this.field)==this.message){this.field.value="";
}},onBlur:function(A){if(!TextUtils.hasText($F(this.field))){this.field.value=this.message;
}}});
Component.SingleClickForm=Class.create(Component.Form,{initialize:function($super,A){$super(A);
this.counter=0;
},onSubmit:function(A){if(this.counter>0){alert("Please wait -- we're working on your request.");
A.stop();
return false;
}else{this.counter++;
return true;
}}});




Component.ChatBox=Class.create({initialize:function(A){this.element=$(A);
this.element.observe("refresh:click",this.onRefresh.bindAsEventListener(this));
this.onRefresh();
},onRefresh:function(A){this.chatContainer=$(this.element.readAttribute("container"));
this.chatContainer.update("<p class='loading'>Loading chat...</p>");
new Ajax.Request(this.element.readAttribute("talkUrl"),{method:"get",onSuccess:this.onSuccess.bind(this)});
},onSuccess:function(A){this.chatContainer.update(A.responseText);
new Component.Binder(this.chatContainer);
}});
Component.ChatPostButton=Class.create(Component.Button,{onClick:function(B){B.stop();
this.form=this.element.up("form");
var A=Form.serialize(this.form);
new Ajax.Request(this.form.action,{method:"post",parameters:A,onSuccess:this.processPost.bind(this),onFail:this.processPost.bind(this)});
Tracker.tag("TalkCommentPostComment");
},processPost:function(A){this.element.fire("refresh:click");
this.textarea=this.form.down("textarea");
this.textarea.value="";
this.textCounter=this.form.down("span[component=TextCounter]");
if(this.textCounter){this.textCounter.update(this.textarea.readAttribute("maxlength"));
}}});
Component.ChatRefreshButton=Class.create(Component.Button,{onClick:function(A){A.stop();
this.element.fire("refresh:click");
}});
Component.ChatDeleteLink=Class.create(Component.Link,{onClick:function(B){B.stop();
if(confirm("Are you sure you want to delete this comment?")){var C=this.element.readAttribute("action");
var D=this.element.readAttribute("comment");
var A="talkAction="+C+"&commentId="+D;
new Ajax.Request("/talk.sv",{parameters:A,onSuccess:this.processDelete.bind(this),onFail:this.processDelete.bind(this)});
Tracker.tag("TalkCommentDeleteComment");
}},processDelete:function(){this.element.fire("refresh:click");
}});
Component.ChatPhotoLink=Class.create(Component.Link,{onClick:function(){if($("imageId")){var A=$("imageId").value;
var B="\n<a href='http://www.flixster.com/photos?p="+A+"'>http://www.flixster.com/photos?p="+A+"</a>\n";
$("photoComment").value=$("photoComment").value+B;
}else{alert("Whoops, please select a photo first.");
}}});
Component.ChatVideoLink=Class.create(Component.Link,{onClick:function(){if($("videoId")){var B=$("videoId").innerHTML;
var A="\n<a href='http://www.flixster.com/videos?videoId="+B+"'>http://www.flixster.com/videos?videoId="+B+"</a>\n";
$("videoComment").value=$("videoComment").value+A;
}else{alert("Whoops, please select a video first.");
}}});
Component.ChatFlagLink=Class.create(Component.Link,{onClick:function(A){A.stop();
this.comment=this.element.readAttribute("comment");
this.user=this.element.readAttribute("user");
$("flagComment").value=$("comment"+this.comment).innerHTML;
$("flagUserId").value=this.user;
$("warnUserForm").submit();
}});




Component.NeverEndingQuizMultipleChoiceAnswer=Class.create({initialize:function(A){this.element=$(A);
$(A).observe("click",this.onClick.bindAsEventListener(this));
$(A).observe("mouseover",this.onMouseover.bindAsEventListener(this));
$(A).observe("mouseout",this.onMouseout.bindAsEventListener(this));
this.choice=$(A).readAttribute("choice");
},onClick:function(B){var A=B.element().readAttribute("id");
$("choiceId").setAttribute("value",A);
console.debug("choiceId ="+A,$("choiceId"),B.element());
B.stop();
B.target.fire("nemq:answer",{answer:this.choice});
var C=Form.serialize($("answerForm"));
new Ajax.Request("/quiz.sv",{parameters:C,onComplete:function(D){$("quizAnswer").update(D.responseText);
quizQuestionWidget.handleNextQuestion();
}});
},onMouseover:function(A){this.element.addClassName("hover");
},onMouseout:function(A){this.element.removeClassName("hover");
}});
var doFlash=false;
var quizQuestionWidget={STATES:{READY:0,LOADING_BATCH:1,BATCH_FAILURE:7,BATCH_TIMEOUT:8,LOADING_QUESTION:2,QUESTION_FAILURE:9,QUESTION_TIMEOUT:10,EMPTY:3,DISABLED:4,RATING_QUESTION:5,REGISTRATION:6},index:-1,options:{throttle:2,regprompt:false},questions:new Array(),rateLastQuestion:false,handleBatch:function(){if(this.state==quizQuestionWidget.STATES.DISABLED){this.paint();
return ;
}this.state=this.STATES.LOADING_BATCH;
this.paint();
var A="gameAction=getNextBatch";
new Ajax.Request("/quiz.sv",{parameters:A,onSuccess:this.onBatchSuccess.bind(this),onFailure:this.onBatchFailure.bind(this),onTimeout:this.onBatchTimeout.bind(this)});
},handleResetBatch:function(){this.index=-1;
this.rateLastQuestion=false;
this.questions.clear();
this.state=this.STATES.LOADING_BATCH;
this.paint();
var A="gameAction=getNextBatch&strict=1";
new Ajax.Request("/quiz.sv",{parameters:A,onSuccess:this.onBatchSuccess.bind(this),onFailure:this.onBatchFailure.bind(this),onTimeout:this.onBatchTimeout.bind(this)});
},onBatchSuccess:function(A){A.responseText.evalScripts();
if(this.questions.length>this.index+1){this.handleNextQuestion();
}else{this.handleEmpty();
}},onBatchFailure:function(A){this.state=this.STATES.BATCH_FAILURE;
this.paint();
},onBatchTimeout:function(A){this.state=this.STATES.BATCH_TIMEOUT;
this.paint();
},handleNextQuestion:function(){if(this.state==quizQuestionWidget.STATES.DISABLED){this.paint();
return ;
}if(this.rateLastQuestion){var B=new Date();
if(this.options.throttle>0&&B.getMilliseconds()%this.options.throttle==0){this.rateLastQuestion=false;
this.state=this.STATES.RATING_QUESTION;
this.paint();
return ;
}}if(this.state!=this.STATES.REGISTRATION&&this.options.regprompt&&(this.index%100==9||this.index%100==19)){Tracker.tag("NEMQAnonRegPrompt"+this.index);
this.state=this.STATES.REGISTRATION;
this.paint();
if(this.index%100==19){this.options.regprompt=false;
}if(this.index%100==19){$("regmessage").innerHTML="OK, this is the last time we'll ask.  Would you like to save?";
}return ;
}this.state=this.STATES.LOADING_QUESTION;
this.paint();
if(this.index+1<this.questions.length){this.index+=1;
var A="gameAction=getNextQuestion&questionId="+this.questions[this.index];
if(quizQuestionWidget.firstChoice!=null&&this.index==0){A+="&choiceId="+quizQuestionWidget.firstChoice;
}new Ajax.Request("/quiz.sv",{parameters:A,onComplete:this.onQuestionSuccess.bind(this),onFailure:this.onQuestionFailure.bind(this),onTimeout:this.onQuestionTimeout.bind(this)});
}else{setTimeout(this.handleBatch.bind(this),1000);
}},onQuestionSuccess:function(A){new Component.Binder($("quizQuestion").update(A.responseText));
this.state=this.STATES.READY;
this.paint();
if(this.index>0){document.fire("ads:refresh");
if(!currentUser.isLoggedIn()){Tracker.tag("NEMQAnon");
}else{Tracker.tag("NEMQ");
}doFlash=false;
}},onQuestionFailure:function(A){this.state=this.STATES.QUESTION_FAILURE;
this.paint();
},onQuestionTimeout:function(A){this.state=this.STATES.QUESTION_TIMEOUT;
this.paint();
},reportBadQuestion:function(A){var B="gameAction=reportBadQuestion&questionId="+A;
new Ajax.Updater("badQuestionLink","/quiz.sv",{parameters:B});
},handleEmpty:function(){this.state=this.STATES.EMPTY;
this.paint();
},handleDisable:function(){this.state=this.STATE.DISABLED;
this.paint();
},paint:function(){switch(this.state){case this.STATES.READY:$("quizBatchLoading").hide();
$("quizQuestionLoading").hide();
$("quizEmpty").hide();
$("quizDisabled").hide();
$("quizRating").hide();
$("quizRegistration").hide();
$("quizQuestion").show();
break;
case this.STATES.LOADING_BATCH:$("quizQuestionLoading").hide();
$("quizEmpty").hide();
$("quizQuestion").hide();
$("quizDisabled").hide();
$("quizRating").hide();
$("quizRegistration").hide();
$("quizBatchLoading").show();
break;
case this.STATES.BATCH_FAILURE:$("quizBatchLoading").update("The request to retrieve a batch of quiz questions failed.  Please refresh your browser and try again.");
break;
case this.STATES.BATCH_TIMEOUT:$("quizBatchLoading").update("The request to retrieve a batch of quiz questions timed out.  Please refresh your browser and try again.");
break;
case this.STATES.LOADING_QUESTION:$("quizBatchLoading").hide();
$("quizEmpty").hide();
$("quizQuestion").hide();
$("quizDisabled").hide();
$("quizRating").hide();
$("quizRegistration").hide();
$("quizQuestionLoading").show();
break;
case this.STATES.QUESTION_FAILURE:$("quizQuestionLoading").update("The request to a quiz question failed.  Please refresh your browser and try again.");
break;
case this.STATES.QUESTION_TIMEOUT:$("quizQuestionLoading").update("The request to retrieve a quiz question timed out.  Please refresh your browser and try again.");
break;
case this.STATES.EMPTY:$("quizBatchLoading").hide();
$("quizQuestionLoading").hide();
$("quizQuestion").hide();
$("quizDisabled").hide();
$("quizRating").hide();
$("quizRegistration").hide();
$("quizEmpty").show();
break;
case this.STATES.DISABLED:$("quizBatchLoading").hide();
$("quizQuestionLoading").hide();
$("quizQuestion").hide();
$("quizEmpty").hide();
$("quizRating").hide();
$("quizRegistration").hide();
$("quizDisabled").show();
break;
case this.STATES.RATING_QUESTION:Element.setStyle("th2up",{border:"1px solid #fff"});
Element.setStyle("th2down",{border:"1px solid #fff"});
$("quizBatchLoading").hide();
$("quizQuestionLoading").hide();
$("quizQuestion").hide();
$("quizEmpty").hide();
$("quizDisabled").hide();
$("quizRegistration").hide();
$("quizRating").show();
break;
case this.STATES.REGISTRATION:$("quizBatchLoading").hide();
$("quizQuestionLoading").hide();
$("quizQuestion").hide();
$("quizEmpty").hide();
$("quizDisabled").hide();
$("quizRegistration").show();
break;
}}};
var quizAnswerWidget={handleEnter:function(B,A){if(B.keyCode==Event.KEY_RETURN&&A=="movies"){this.handleMovieSearch();
return false;
}else{if(B.keyCode==Event.KEY_RETURN&&A=="actors"){this.handleActorSearch();
return false;
}else{return true;
}}},handleMovieSearch:function(){$("submitBtn").disabled=true;
var A="gameAction=searchMovies&"+Form.Element.serialize($("msearch"));
new Ajax.Request("/quiz.sv",{parameters:A,onComplete:this.processSearch.bind(this)});
},handleActorSearch:function(){$("submitBtn").disabled=true;
var A="gameAction=searchActors&"+Form.Element.serialize($("asearch"));
new Ajax.Request("/quiz.sv",{parameters:A,onComplete:this.processSearch.bind(this)});
},processSearch:function(A){$("submitBtn").disabled=false;
$("searchResults").update(A.responseText);
},handleSkipAnswer:function(B){var A="gameAction=submitAnswer&questionId="+B;
new Ajax.Request("/quiz.sv",{parameters:A,onComplete:this.processAnswer.bind(this)});
quizQuestionWidget.handleNextQuestion();
},handleAnswer:function(B){var A=Form.serialize($("answerForm"));
new Ajax.Request("/quiz.sv",{parameters:A,onComplete:this.processAnswer.bind(this)});
quizQuestionWidget.handleNextQuestion();
},processAnswer:function(A){$("quizAnswer").update(A.responseText);
},enable:function(){$("submitBtn").enable();
}};
var quizRatingWidget={THUMBS_UP:1,THUMBS_DOWN:2,THUMBS_NONE:3,message:"Saved - Thanks!",handleUp:function(C,B,A){$(B+"message").update(this.message);
Element.setStyle(B+"up",{border:"1px solid #000"});
Element.setStyle(B+"down",{border:"1px solid #ffc"});
this.handleVote(C,this.THUMBS_UP);
if(A){quizQuestionWidget.handleNextQuestion();
}},handleDown:function(C,B,A){$(B+"message").update(this.message);
Element.setStyle(B+"up",{border:"1px solid #ffc"});
Element.setStyle(B+"down",{border:"1px solid #000"});
this.handleVote(C,this.THUMBS_DOWN);
if(A){quizQuestionWidget.handleNextQuestion();
}},handleVote:function(C,A){var B="rateAction=rateQuestion&questionId="+C+"&thumbsId="+A;
new Ajax.Request("/rate.sv",{parameters:B});
}};
var quizInviteWidget={handleInvite:function(){if(!TextUtils.isValidEmail($F("email"))){alert("Please enter a valid email address.");
return ;
}var A=Form.serialize($("inviteForm"));
$("inviteBtn").disabled=true;
$("email").disabled=true;
new Ajax.Request("/invite/action/manual/send",{parameters:A,asynchronous:true,onComplete:this.processInvite.bind(this)});
Tracker.tag("AjaxQuizInvitation");
},processInvite:function(A){Element.show($("inviteSentMessage"));
$("email").value="Email another";
$("email").disabled=false;
$("inviteBtn").disabled=false;
},handleFocus:function(){Element.hide($("inviteSentMessage"));
if($F("email")=="Email a friend to play"||$F("email")=="Email another"){$("email").value="";
}}};
var quizPlayersWidget={STATES:{OFF:0,PLAYERS_ON:1,FRIENDS_ON:2},playersDirty:true,friendsDirty:true,state:0,handlePlayers:function(){if(this.state==this.STATES.PLAYERS_ON){this.state=this.STATES.OFF;
}else{this.state=this.STATES.PLAYERS_ON;
}if(this.state==this.STATES.PLAYERS_ON&&this.playersDirty){var A="refreshPlayers=";
new Ajax.Request("/quiz.sv",{parameters:A,onComplete:this.processPlayers.bind(this)});
}this.paint();
},processPlayers:function(A){$("players").update(A.responseText);
this.playersDirty=false;
setTimeout(function(){quizPlayersWidget.playersDirty=true;
},60000);
},refreshFriends:function(){var A="refreshFriends=";
new Ajax.Request("/quiz.sv",{parameters:A,onComplete:this.processFriends.bind(this)});
},handleFriends:function(){if(this.state==this.STATES.FRIENDS_ON){this.state=this.STATES.OFF;
}else{this.state=this.STATES.FRIENDS_ON;
}if(this.state==this.STATES.FRIENDS_ON&&this.friendsDirty){var A="refreshFriends=";
new Ajax.Request("/quiz.sv",{parameters:A,onComplete:this.processFriends.bind(this)});
}this.paint();
},processFriends:function(A){$("friends").update(A.responseText);
this.friendsDirty=false;
setTimeout(function(){quizPlayersWidget.friendsDirty=true;
},60000);
},paint:function(){switch(this.state){case this.STATES.OFF:$("players").hide();
$("friends").hide();
Element.removeClassName("playersLink","selected");
Element.removeClassName("friendsLink","selected");
break;
case this.STATES.PLAYERS_ON:$("friends").hide();
Element.removeClassName("friendsLink","selected");
$("players").show();
Element.addClassName("playersLink","selected");
break;
case this.STATES.FRIENDS_ON:$("players").hide();
Element.removeClassName("playersLink","selected");
$("friends").show();
Element.addClassName("friendsLink","selected");
break;
}}};
function showq(){var A="";
for(i=0;
i<quizQuestionWidget.questions.length;
i++){A+="["+quizQuestionWidget.questions[i]+"]";
}A+="{position = "+quizQuestionWidget.index+"}";
$("q").update(A);
}var ChatLink={visible:true,toggle:function(){ChatLink.visible=!ChatLink.visible;
if(ChatLink.visible){$("chatShowHideLink").update("Hide All");
$("quizChatComments").show();
}else{$("chatShowHideLink").update("Show Comments");
$("quizChatComments").hide();
}}};
Component.QuizQuestionForm=Class.create(Component.Form,{onSubmit:function(A){if(!TextUtils.hasText($F(this.element.down("textarea")))){A.stop();
new View.ErrorPopup(this.element,{title:"Whoops",content:"Don't forget to provide a question :)"});
return false;
}else{this.element.down("input[type=submit]").disable();
return true;
}}});
var QuestionContentTypeWidget=Class.create();
QuestionContentTypeWidget.prototype={initialize:function(){Event.observe($("contentType"),"change",this.handleChange.bind(this));
},handleChange:function(){$("contentI").hide();
$("contentA").hide();
$("contentV").hide();
switch($F("contentType")){case"I":$("contentI").show();
break;
case"A":$("contentA").show();
break;
case"V":$("contentV").show();
break;
}}};
var QuestionAnswerTypeWidget=Class.create();
QuestionAnswerTypeWidget.prototype={initialize:function(){Event.observe($("answerType"),"change",this.handleChange.bind(this));
},handleChange:function(){$("answerC").hide();
$("answerM").hide();
$("answerP").hide();
switch($F("answerType")){case"C":$("answerC").show();
break;
case"M":$("answerM").show();
break;
case"P":$("answerP").show();
break;
}}};
var SearchWidget=Class.create();
SearchWidget.prototype={STATES:{READY:0,SEARCHING:1},setOptions:function(A){this.options={parent:"search",action:"searchMovies",url:"/myoq.sv"};
Object.extend(this.options,A||{});
},initialize:function(A){this.setOptions(A);
this.search=$A($(this.options.parent).getElementsByClassName("search")).first();
Event.observe(this.search,"focus",this.handleFocus.bind(this));
Event.observe(this.search,"blur",this.handleBlur.bind(this));
Event.observe(this.search,"keypress",this.handleEnter.bind(this));
this.text=this.search.value;
this.button=$A($(this.options.parent).getElementsByClassName("jbutton")).first();
Event.observe(this.button,"click",this.handleSearch.bind(this));
this.results=$A($(this.options.parent).getElementsByClassName("results")).first();
this.loading=$A($(this.options.parent).getElementsByClassName("loading")).first();
},handleFocus:function(){if($F(this.search)==this.text){this.search.value="";
}},handleBlur:function(){if(!TextUtils.hasText($F(this.search))){this.search.value=this.text;
}},handleEnter:function(A){if(A.keyCode==Event.KEY_RETURN){this.handleSearch();
Event.stop(A);
return false;
}else{return true;
}},handleSearch:function(){var A="quizAction="+this.options.action+"&"+Form.Element.serialize(this.search);
new Ajax.Request(this.options.url,{parameters:A,onComplete:this.processSearch.bind(this)});
this.state=this.STATES.SEARCHING;
this.paint();
},processSearch:function(A){$(this.results).update(A.responseText);
this.state=this.STATES.READY;
this.paint();
},paint:function(){switch(this.state){case this.STATES.READY:$(this.loading).hide();
$(this.results).show();
break;
case this.STATES.SEARCHING:$(this.results).hide();
$(this.loading).show();
break;
}}};
var buttonToggle=0;
function flashSaveButton(){if($("saveButton")){if(doFlash){if(buttonToggle==0){$("saveButton").style.background="#ffffff";
$("saveButton").style.color="#dd3333";
buttonToggle=1;
}else{$("saveButton").style.background="#dd3333";
$("saveButton").style.color="#ffffff";
buttonToggle=0;
}}setTimeout("flashSaveButton()",1000);
}}Component.Overlay=Class.create({initialize:function(A){this.element=$(A);
this.element.observe("link:click",this.onClose.bind(this));
},onShow:function(A){this.overlay=new Element("div");
this.element.insert(this.overlay);
new View.Overlay(this.overlay,this.options);
new Component.Binder(this.overlay);
this.overlay.addClassName("overlayComponent");
this.overlay.setStyle({height:this.element.offsetHeight-20+"px"});
},onClose:function(A){this.overlay.remove();
}});
Component.AdOverlay=Class.create(Component.Overlay,{initialize:function($super,A){$super(A);
var B=this.element.readAttribute("ids");
if(B!=""){this.ids=B.strip().split(" ");
}this.counter=0;
document.observe("ads:refresh",this.onShow.bind(this));
},onShow:function($super,A){this.counter++;
if(this.counter==3&&this.ids!=null&&this.ids.size()>0){this.options={placement:this.ids.shift()};
$super(A);
setTimeout(this.onClose.bind(this),30000);
this.counter=0;
}}});
View.Overlay=Class.create(View.TemplateView,{template:new Template("<div class='overlayMessage'>A message from our sponsor(will automatically close in 30 seconds)</div><iframe src='/static/ads/ad.html?tag=Flixster_NEMQ_440x364&pid=#{placement}' width=440 height=385 marginwidth=0 marginheight=0 frameborder=0 scrolling=no></iframe><a class='overlayLink' component='Link' href='#'>Close</a><img style='visibility:hidden;width:0px;height:0px;' src='/api/v1/analytics.pixel?tag=#{placement}&event=Impression&auth_user="+currentUser.id+">")});




var swfButtonIndex=0;
function getFlashMovieObject(A){if(window.document[A]){return window.document[A];
}if(navigator.appName.indexOf("Microsoft Internet")==-1){if(document.embeds&&document.embeds[A]){return document.embeds[A];
}}else{return document.getElementById(A);
}}function getPlayer(C,D){if(C==""){var A=getFlashMovieObject("bebo_player");
C=A.GetVariable("_root.vars");
}function B(F,E){if(E=="button"){swfButtonIndex++;
idName="bebo_player_button"+swfButtonIndex;
swfWidth=20;
swfHeight=20;
swfName="/static/mp3_player_button";
C="songurl="+C;
}else{idName="bebo_player";
swfWidth=404;
swfHeight=354;
swfName="/static/mp3_player";
}F.document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+swfWidth+'" height="'+swfHeight+'" id="'+idName+'" align="middle">');
F.document.write('<param name="allowScriptAccess" value="sameDomain" />');
F.document.write('<param name="FlashVars" value="'+C+'" />');
F.document.write('<param name="movie" value="'+swfName+'.swf" />');
F.document.write('<param name="quality" value="high" />');
F.document.write('<param name="bgcolor" value="#000000" />');
F.document.write('<embed src="'+swfName+'.swf" quality="high" FlashVars="'+C+'" bgcolor="#000000" width="'+swfWidth+'" height="'+swfHeight+'" name="'+idName+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
F.document.write("</object>");
}if(D){winww=404;
winhh=354;
LeftPosition=(screen.width)?(screen.width-winww)/2:100;
TopPosition=(screen.height)?(screen.height-winhh)/2:100;
settings="width="+winww+",height="+winhh+",top="+TopPosition+",left="+LeftPosition+",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
win=open("","bebo_player",settings);
win.document.write("<head>");
win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />');
win.document.write("<title>"+D+"</title>");
win.document.write("</head>");
win.document.write('<body bgcolor="#000000" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">');
B(win);
win.document.write("</body>");
win.document.write("</html>");
win.focus();
}else{if(C.substr(0,4).toLowerCase()=="http"){B(window,"button");
}else{B(window);
}}}function playTrack(C){if(C){var A=1;
while(getFlashMovieObject("bebo_player_button"+A)){var B=getFlashMovieObject("bebo_player_button"+A);
tmpVar=B.GetVariable("_root.haskey");
if(tmpVar!="play"){tmpVar=B.GetVariable("_root.songurl");
if(C==tmpVar){B.SetVariable("_root.control","play");
break;
}}A++;
}}}function stopTrack(C){var A=1;
while(getFlashMovieObject("bebo_player_button"+A)){var B=getFlashMovieObject("bebo_player_button"+A);
tmpVar=B.GetVariable("_root.haskey");
if(tmpVar=="play"){tmpVar=B.GetVariable("_root.songurl");
if(C!=tmpVar){B.SetVariable("_root.control","stop");
}}A++;
}}



var ModalPosition=Object.extend(Class.create(),{CENTERED:-1});
ModalPosition.prototype={initialize:function(A,C,B){this.elementName=A;
this.xPosition=C||0;
this.yPosition=B||0;
},isElementAligned:function(){return this.elementName!=null;
},x:function(){if(this.isElementAligned()){return Position.page($(this.elementName))[0];
}else{return this.xPosition;
}},isXCoordinate:function(){return !this.isElementAligned()&&this.xPosition>=0;
},y:function(){if(this.isElementAligned()){return Position.page($(this.elementName))[1];
}else{return this.yPosition;
}},isYCoordinate:function(){return !this.isElementAligned()&&this.yPosition>=0;
}};
var ModalWindow=Class.create();
ModalWindow.prototype={STATES:{READY:0,LOADING:1,PROCESSING:2,LOADED:3},DEFAULT_POSITION:new ModalPosition(null,ModalPosition.CENTERED,ModalPosition.CENTERED),effect:null,initialize:function(B,C,A){this.url=B;
this.params=C;
this.modalPosition=A!=null?A:this.DEFAULT_POSITION;
this.options=Object.extend({window:"modalWindow",content:"modalContent",blanket:"modalBlanket",loading:"modalLoading"},arguments[3]||{});
this.state=this.STATES.READY;
this.boundPositionFunction=this.position.bind(this);
},show:function(){Event.observe(window,"scroll",this.boundPositionFunction);
Event.observe(window,"resize",this.boundPositionFunction);
this.state=this.STATES.LOADING;
this.paint();
if(this.url.length>0){new Ajax.Request(this.url,{parameters:this.params,onComplete:this.load.bind(this)});
}else{this.state=this.STATES.LOADED;
this.paint();
}},load:function(A){$(this.options.content).update(A.responseText);
this.state=this.STATES.LOADED;
this.paint();
},close:function(){$(this.options.window).style.top="0px";
$(this.options.window).style.left="0px";
this.state=this.STATES.READY;
this.paint();
Event.stopObserving(window,"scroll",this.boundPositionFunction);
Event.stopObserving(window,"resize",this.boundPositionFunction);
},paint:function(){switch(this.state){case this.STATES.READY:Element.hide($(this.options.window));
Element.hide($(this.options.content));
Element.hide($(this.options.loading));
Element.hide($(this.options.blanket));
break;
case this.STATES.LOADING:var A=Position.Window.getDeltas();
var B=Position.Window.size();
$(this.options.blanket).style.width=(A.x+B.width)+"px";
$(this.options.blanket).style.height=(A.y+B.height)+"px";
new Effect.Appear($(this.options.blanket),{from:0,to:0.5,duration:0.3});
Element.hide($(this.options.content));
Element.show($(this.options.loading));
Element.show($(this.options.window));
this.position();
break;
case this.STATES.PROCESSING:break;
case this.STATES.LOADED:Element.hide(this.options.loading);
Element.show(this.options.window);
Element.show(this.options.content);
this.position();
break;
}},position:function(){var B=Position.Window.getDeltas();
var D=Position.Window.size();
$(this.options.blanket).style.width=(B.x+D.width)+"px";
$(this.options.blanket).style.height=(B.y+D.height)+"px";
var F=Position.Window.getDeltas();
var A=Position.Window.size();
var J=Element.getDimensions($(this.options.window));
var G=$(this.options.window).cumulativeOffset();
var E=0;
var C=0;
if(this.modalPosition.isElementAligned()||this.modalPosition.isYCoordinate()){var H=this.modalPosition.y();
if(J.height+H<A.height){C=F.y+H;
}else{if(G[1]>F.y+H){C=F.y+H;
}else{if(G[1]+J.height<F.y+A.height-H){C=F.y+A.height-J.height-H;
}}}}else{if(this.modalPosition.y()==ModalPosition.CENTERED){if(J.height<A.height){C=F.y+(A.height-J.height)/2;
}else{if(G[1]>F.y){C=F.y+(A.height-J.height)/2;
}else{if(G[1]+J.height+20<F.y+A.height){C=F.y+A.height-J.height-20;
}}}}}if(this.modalPosition.isElementAligned()||this.modalPosition.isXCoordinate()){var I=this.modalPosition.x();
if(J.width+I<A.width){E=F.x+I;
}else{if(G[0]>F.x+I){E=F.x+I;
}else{if(G[0]+J.width<F.x+A.width-I){E=F.x+A.width-J.width-I;
}}}}else{if(this.modalPosition.x()==ModalPosition.CENTERED){if(J.width<A.width){E=F.x+(A.width-J.width)/2;
}else{if(G[0]>F.x){E=F.x+(A.width-J.width)/2;
}else{if(G[0]+J.width+20<F.x+A.width){E=F.x+A.width-J.width-20;
}}}}}if(G[0]==0&&G[1]==0){$(this.options.window).style.top=C+"px";
$(this.options.window).style.left=E+"px";
}else{if(C>0){if(this.effect!=null){this.effect.cancel();
}this.effect=new Effect.Move($(this.options.window),{x:E,y:C,mode:"absolute",duration:0.6});
}}},resize:function(B,A){if(!TextUtils.endsWithAlpha(B+"")){B+="px";
}if(!TextUtils.endsWithAlpha(A+"")){A+="px";
}$(this.options.window).style.width=B;
$(this.options.content).style.height=A;
},grow:function(C,A){var E=TextUtils.stripNonNumeric($(this.options.window).style.width);
var D=parseInt(E)+C;
var F=TextUtils.stripNonNumeric($(this.options.content).style.height);
var B=parseInt(F)+A;
this.resize(D,B);
}};




