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);
}};




Date.parseFunctions={count:0};
Date.parseRegexes=[];
Date.formatFunctions={count:0};
Date.prototype.dateFormat=function(B){if(Date.formatFunctions[B]==null){Date.createNewFormat(B);
}var A=Date.formatFunctions[B];
return this[A]();
};
Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;
Date.formatFunctions[format]=funcName;
var code="Date.prototype."+funcName+" = function(){return ";
var special=false;
var ch="";
for(var i=0;
i<format.length;
++i){ch=format.charAt(i);
if(!special&&ch=="\\"){special=true;
}else{if(special){special=false;
code+="'"+String.escape(ch)+"' + ";
}else{code+=Date.getFormatCode(ch);
}}}eval(code.substring(0,code.length-3)+";}");
};
Date.getFormatCode=function(A){switch(A){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";
case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";
case"j":return"this.getDate() + ";
case"l":return"Date.dayNames[this.getDay()] + ";
case"S":return"this.getSuffix() + ";
case"w":return"this.getDay() + ";
case"z":return"this.getDayOfYear() + ";
case"W":return"this.getWeekOfYear() + ";
case"F":return"Date.monthNames[this.getMonth()] + ";
case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";
case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";
case"n":return"(this.getMonth() + 1) + ";
case"t":return"this.getDaysInMonth() + ";
case"L":return"(this.isLeapYear() ? 1 : 0) + ";
case"Y":return"this.getFullYear() + ";
case"y":return"('' + this.getFullYear()).substring(2, 4) + ";
case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";
case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";
case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";
case"G":return"this.getHours() + ";
case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";
case"H":return"String.leftPad(this.getHours(), 2, '0') + ";
case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";
case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";
case"O":return"this.getGMTOffset() + ";
case"T":return"this.getTimezone() + ";
case"Z":return"(this.getTimezoneOffset() * -60) + ";
default:return"'"+String.escape(A)+"' + ";
}};
Date.parseDate=function(A,C){if(Date.parseFunctions[C]==null){Date.createParser(C);
}var B=Date.parseFunctions[C];
return Date[B](A);
};
Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;
var regexNum=Date.parseRegexes.length;
var currentGroup=1;
Date.parseFunctions[format]=funcName;
var code="Date."+funcName+" = function(input){\n"+"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n"+"var d = new Date();\n"+"y = d.getFullYear();\n"+"m = d.getMonth();\n"+"d = d.getDate();\n"+"var results = input.match(Date.parseRegexes["+regexNum+"]);\n"+"if (results && results.length > 0) {";
var regex="";
var special=false;
var ch="";
for(var i=0;
i<format.length;
++i){ch=format.charAt(i);
if(!special&&ch=="\\"){special=true;
}else{if(special){special=false;
regex+=String.escape(ch);
}else{obj=Date.formatCodeToRegex(ch,currentGroup);
currentGroup+=obj.g;
regex+=obj.s;
if(obj.g&&obj.c){code+=obj.c;
}}}}code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"+"{return new Date(y, m, d, h, i, s);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"+"{return new Date(y, m, d, h, i);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n"+"{return new Date(y, m, d, h);}\n"+"else if (y > 0 && m >= 0 && d > 0)\n"+"{return new Date(y, m, d);}\n"+"else if (y > 0 && m >= 0)\n"+"{return new Date(y, m);}\n"+"else if (y > 0)\n"+"{return new Date(y);}\n"+"}return null;}";
Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");
eval(code);
};
Date.formatCodeToRegex=function(B,A){switch(B){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};
case"j":case"d":return{g:1,c:"d = parseInt(results["+A+"], 10);\n",s:"(\\d{1,2})"};
case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};
case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};
case"w":return{g:0,c:null,s:"\\d"};
case"z":return{g:0,c:null,s:"(?:\\d{1,3})"};
case"W":return{g:0,c:null,s:"(?:\\d{2})"};
case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+A+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};
case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+A+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};
case"n":case"m":return{g:1,c:"m = parseInt(results["+A+"], 10) - 1;\n",s:"(\\d{1,2})"};
case"t":return{g:0,c:null,s:"\\d{1,2}"};
case"L":return{g:0,c:null,s:"(?:1|0)"};
case"Y":return{g:1,c:"y = parseInt(results["+A+"], 10);\n",s:"(\\d{4})"};
case"y":return{g:1,c:"var ty = parseInt(results["+A+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};
case"a":return{g:1,c:"if (results["+A+"] == 'am') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};
case"A":return{g:1,c:"if (results["+A+"] == 'AM') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};
case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+A+"], 10);\n",s:"(\\d{1,2})"};
case"i":return{g:1,c:"i = parseInt(results["+A+"], 10);\n",s:"(\\d{2})"};
case"s":return{g:1,c:"s = parseInt(results["+A+"], 10);\n",s:"(\\d{2})"};
case"O":return{g:0,c:null,s:"[+-]\\d{4}"};
case"T":return{g:0,c:null,s:"[A-Z]{3}"};
case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};
default:return{g:0,c:null,s:String.escape(B)};
}};
Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");
};
Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(this.getTimezoneOffset()/60),2,"0")+String.leftPad(this.getTimezoneOffset()%60,2,"0");
};
Date.prototype.getDayOfYear=function(){var A=0;
Date.daysInMonth[1]=this.isLeapYear()?29:28;
for(var B=0;
B<this.getMonth();
++B){A+=Date.daysInMonth[B];
}return A+this.getDate()-1;
};
Date.prototype.getWeekOfYear=function(){var B=this.getDayOfYear()+(4-this.getDay());
var A=new Date(this.getFullYear(),0,1);
var C=(7-A.getDay()+4);
document.write(C);
return String.leftPad(((B-C)/7)+1,2,"0");
};
Date.prototype.isLeapYear=function(){var A=this.getFullYear();
return((A&3)==0&&(A%100||(A%400==0&&A)));
};
Date.prototype.getFirstDayOfMonth=function(){var A=(this.getDay()-(this.getDate()-1))%7;
return(A<0)?(A+7):A;
};
Date.prototype.getLastDayOfMonth=function(){var A=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;
return(A<0)?(A+7):A;
};
Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;
return Date.daysInMonth[this.getMonth()];
};
Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";
case 2:case 22:return"nd";
case 3:case 23:return"rd";
default:return"th";
}};
String.escape=function(A){return A.replace(/('|\\)/g,"\\$1");
};
String.leftPad=function(D,B,C){var A=new String(D);
if(C==null){C=" ";
}while(A.length<B){A=C+A;
}return A;
};
Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];
Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];
Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
Date.y2kYear=50;
Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};
Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};




PollModalConstants={FETCH_WINDOW_WIDTH:250,FETCH_WINDOW_HEIGHT:185,ASSOCIATE_WINDOW_MIN_WIDTH:280,LARGE_IMAGE_DIMENSION:400,SMALL_IMAGE_DIMENSION:150,MARGIN:10,ASSOCIATION_HEIGHT_PRE_SEARCH:190,ASSOCIATION_HEIGHT_ADJUSTMENT_FOR_SEARCH:60,ASSOCIATION_HEIGHT_ADJUSTMENT_PER_ITEM:21};
var PollFormWidget=Class.create();
PollFormWidget.prototype={SAMPLE_POLL_QUESTION:"e.g. What is the best zombie movie?",DATE_PATTERN:Date.patterns.ShortDatePattern,DATE_PATTERN_DESCRIPTION:"mm/dd/yyyy",initialize:function(C,F,E,B,A,D){this.SERVER=C;
this.pollId=F;
this.numChoices=E;
this.MIN_NUM_CHOICES=B;
this.MAX_NUM_CHOICES=A;
this.MAX_CLOSE_YEAR=D;
new DefaultTextWidget($("pollQuestion"),this.SAMPLE_POLL_QUESTION);
new TextCounter($("pollQuestion"),200,$("counter"),"Sorry, please keep your description under 100 characters. Thanks.");
new SearchWidget({parent:"associationA",action:"searchActors"});
new SearchWidget({parent:"associationM",action:"searchMovies"});
if(E<A){Event.observe("addChoice","click",this.handleAddChoice.bindAsEventListener(this));
}Event.observe("pollType","change",this.handleChangeType.bindAsEventListener(this));
Event.observe("closingHour","focus",function(){$("closingButton").click();
});
Event.observe("closingDay","focus",function(){$("closingButton").click();
});
Event.observe("closingDay","change",function(){$("closingButton").click();
});
Event.observe("pollCreateForm","submit",this.handleSubmit.bindAsEventListener(this));
},getAlphaSequenceEquivalent:function(A){return String.fromCharCode(64+A);
},updatePollIdIfNecessary:function(A){if(this.pollId.length==0){this.pollId=A;
$("pollId").value=A;
}},handleChangeType:function(){switch($F("pollType")){case"":case"GEN":case"OTH":$("associationM").hide();
$("associationA").hide();
break;
case"MOV":$("associationA").hide();
$("associationM").show();
break;
case"ACT":$("associationM").hide();
$("associationA").show();
break;
}},handleAllowImageAdd:function(A){this.sequenceForImageOperation=A;
$("imageFetchIframe").src="/polls/image/fetch?sequence="+A+(this.pollId.length>0?"&pollId="+this.pollId:"");
this.imageUploadModalWindow=new ModalWindow("","",new ModalPosition("imageAdd"+A));
this.resizeModalWindow(PollModalConstants.FETCH_WINDOW_WIDTH,PollModalConstants.FETCH_WINDOW_HEIGHT);
this.imageUploadModalWindow.show();
Event.observe("imageUploadCloseLink","click",this.imageUploadModalWindow.close.bindAsEventListener(this.imageUploadModalWindow));
},handleFetchImage:function(){var B=$("imageFetchIframe").contentWindow.document;
if(B.getElementById("uploadType").checked){if(B.getElementById("imageFile").value.length==0){alert("Please specify an image to upload.");
}else{try{B.getElementById("pollImageForm").submit();
}catch(C){alert("The image you chose for upload cannot be accessed. Please choose a valid image.");
}}}else{if(B.getElementById("urlType").checked){var A=B.getElementById("imageUrl").value;
if(A.length==0){alert("You selected the URL option but provided no URL. Please specify the desired image's URL.");
}else{if(!TextUtils.isValidUrl(A)){alert("Sorry, you have entered an invalid URL.");
}else{B.getElementById("pollImageForm").submit();
}}}}},previewFetchedImage:function(B){var A="pollImageId="+B;
new Ajax.Request("/polls/service/image-preview",{parameters:A,onSuccess:this.onImagePreviewSuccess.bind(this),onTimeout:this.onImagePreviewTimeout.bind(this),onFailure:this.onImagePreviewFailure.bind(this)});
},onImagePreviewSuccess:function(A){$("imagePreview"+this.sequenceForImageOperation).update(A.responseText);
$("imagePreview"+this.sequenceForImageOperation).style.display="block";
$("imageAdd"+this.sequenceForImageOperation).style.display="none";
$("imageRemove"+this.sequenceForImageOperation).style.display="block";
},onImagePreviewTimeout:function(A){$("imagePreview"+this.sequenceForImageOperation).update('<div class="error">Whoops, your request timed out. Please check your network connection and try again.</div>');
},onImagePreviewFailure:function(A){$("imagePreview"+this.sequenceForImageOperation).update('<div class="error">Whoops, our servers coughed.  Please try again.</div>');
},handleImageRemove:function(C){this.sequenceForImageOperation=C;
if(confirm("Really remove this image from the poll?")){var A=$("imagePreview"+C).innerHTML;
$("imagePreview"+C).update('<div class="confirmation"><img src="http://static5.flixster.com/static/images/wait.gif" alt="Deleting image..." />Deleting image...</div><br/><br/>'+A);
var B="pollId="+this.pollId+"&sequence="+C;
new Ajax.Request("/polls/service/image-remove",{parameters:B,onSuccess:this.onImageRemoveSuccess.bind(this),onTimeout:this.onImageRemoveTimeout.bind(this),onFailure:this.onImageRemoveFailure.bind(this)});
}},onImageRemoveSuccess:function(A){$("imagePreview"+this.sequenceForImageOperation).update("");
$("imagePreview"+this.sequenceForImageOperation).style.display="none";
$("imageAdd"+this.sequenceForImageOperation).style.display="block";
$("imageRemove"+this.sequenceForImageOperation).style.display="none";
},onImageRemoveTimeout:function(A){var B=$("imagePreview"+this.sequenceForImageOperation).innerHTML;
$("imagePreview"+this.sequenceForImageOperation).update('<div class="error">Whoops, your request timed out. Please check your network connection and try again.</div>'+B);
},onImageRemoveFailure:function(A){var B=$("imagePreview"+this.sequenceForImageOperation).innerHTML;
$("imagePreview"+this.sequenceForImageOperation).update('<div class="error">Whoops, our servers coughed.  Please try again.</div>'+B);
},handleAssociateImage:function(A){$("imageFetchIframe").contentWindow.document.getElementById("pollImageForm").submit();
this.imageUploadModalWindow.close();
},resizeModalWindow:function(B,A){$("imageFetchIframe").style.width=B+"px";
$("imageFetchIframe").style.height=A+"px";
this.imageUploadModalWindow.resize(B+2*PollModalConstants.MARGIN,A+2*PollModalConstants.MARGIN);
},growModalWindow:function(C,B){var E=$("imageFetchIframe").style.width.substr(0,$("imageFetchIframe").style.width.length-2);
var F=parseInt(E)+C;
var A=$("imageFetchIframe").style.height.substr(0,$("imageFetchIframe").style.height.length-2);
var D=parseInt(A)+B;
this.resizeModalWindow(F,D);
},handleAddChoice:function(){var B=this.numChoices+1;
var A=document.createElement("div");
Element.addClassName(A,"choice");
Element.addClassName(A,"clearfix");
A.update('<div class="label">'+this.getAlphaSequenceEquivalent(B)+"</div>"+'<input type="text" name="choiceBody'+B+'" id="choiceBody'+B+'" value="" maxlength="100"/>'+'<div class="image">'+'<div id="imagePreview'+B+'" style="display:none;"></div>'+'<div class="imageLinkDiv" id="imageAdd'+B+'" onclick="pollFormWidget.handleAllowImageAdd('+B+');">'+'<span class="jlink imageAdd">Add an image</span>'+"</div>"+'<div class="imageLinkDiv" id="imageRemove'+B+'" onclick="pollFormWidget.handleImageRemove('+B+');" style="display:none;">'+'<span class="jlink imageRemove">Remove image</span>'+"</div>"+"</div>");
$("choices").appendChild(A);
this.numChoices++;
$("numChoices").value=this.numChoices;
if(this.numChoices==this.MAX_NUM_CHOICES){$("addChoice").style.display="none";
}},handleSubmit:function(B){var K=null;
if($F("pollQuestion").blank()||$F("pollQuestion")==this.SAMPLE_POLL_QUESTION){K="Please enter your poll's question";
}else{if($F("pollQuestion").length<5){K="Your question must be at least 5 characters long.";
}}for(var I=1;
I<=this.MIN_NUM_CHOICES&&K==null;
I++){if($F("choiceBody"+I).blank()&&$("imagePreview"+I).style.display=="none"){var C=this.getAlphaSequenceEquivalent(I);
K="Please enter text or add an image for answer choice ("+C+")";
}}var G=this.MIN_NUM_CHOICES;
for(var I=this.MIN_NUM_CHOICES+1;
I<=this.numChoices&&K==null;
I++){if((!$F("choiceBody"+I).blank())||$("imagePreview"+I).style.display!="none"){if(I-G==1){G++;
}else{var N=this.getAlphaSequenceEquivalent(G+1);
var A=this.getAlphaSequenceEquivalent(I);
K="You must enter text or add an image for answer choice ("+N+") since you have done so for answer choice ("+A+")";
}}}if(K==null){if($F("pollType").blank()){K="Please select what your poll's about from the dropdown under Details.";
}else{if($F("pollType")=="MOV"){var D=false;
var J=$A($("associationM").getElementsByTagName("input"));
for(I=0;
I<J.length;
I++){var F=J[I];
if(F.checked){D=true;
break;
}}if(!D){K="Whoops, you mentioned this poll is about a single movie, but forgot to tell us which";
}}else{if($F("pollType")=="ACT"){var D=false;
var H=$A($("associationA").getElementsByTagName("input"));
for(I=0;
I<H.length;
I++){var M=H[I];
if(M.checked){D=true;
break;
}}if(!D){K="Whoops, you mentioned this poll is about a single actor, but forgot to tell us which";
}}}}}if(K==null&&$("closingButton").checked){var L=$F("closingDay");
if(L.blank()){K="Whoops, you mentioned this poll should close, but forgot to tell us the close date";
}else{var E=Date.parseDate(L,this.DATE_PATTERN);
if(E==null){K="Please specify the close date in the format "+this.DATE_PATTERN_DESCRIPTION;
}else{if(E.getTime()+($F("closingHour")*60*60*1000)<=new Date().getTime()){K="Please specify a close date that occurs in the future.";
}else{if(E.getFullYear()>this.MAX_CLOSE_YEAR){K="Sorry, the latest year your poll may close is "+this.MAX_CLOSE_YEAR;
}}}}}if(K!=null){alert(K);
Event.stop(B);
return false;
}$("numChoices").value=G;
return true;
}};
var SearchWidget=Class.create();
SearchWidget.prototype={STATES:{READY:0,SEARCHING:1},setOptions:function(A){this.options={parent:"search",action:"searchMovies",url:"/polls/service/search-associations"};
Object.extend(this.options,A||{});
},initialize:function(A){this.setOptions(A);
try{this.search=$A($(this.options.parent).getElementsByClassName("search")).first();
Event.observe(this.search,"focus",this.handleFocus.bindAsEventListener(this));
Event.observe(this.search,"blur",this.handleBlur.bindAsEventListener(this));
Event.observe(this.search,"keypress",this.handleEnter.bindAsEventListener(this));
this.text=this.search.value;
this.button=$A($(this.options.parent).getElementsByClassName("jbutton")).first();
Event.observe(this.button,"click",this.handleSearch.bindAsEventListener(this));
this.results=$A($(this.options.parent).getElementsByClassName("results")).first();
this.loading=$A($(this.options.parent).getElementsByClassName("loading")).first();
}catch(B){}},handleFocus:function(){if($F(this.search)==this.text){this.search.value="";
}},handleBlur:function(){if($F(this.search).blank()){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="searchType="+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 PollImageFetchWidget=Class.create();
PollImageFetchWidget.prototype={initialize:function(A,B){Event.observe("galleryLink","click",function(){window.open("/polls/image/browse");
});
Event.observe("imageFile","click",function(){$("uploadType").click();
});
Event.observe("imageFile","focus",function(){$("uploadType").click();
});
Event.observe("imageUrl","focus",function(){if($F("imageUrl")=="http://"){$("imageUrl").value="";
}$("urlType").click();
});
Event.observe("imageUrl","blur",function(){if($F("imageUrl").blank()){$("imageUrl").value="http://";
}});
Event.observe("fetchImage","click",parent.pollFormWidget.handleFetchImage.bindAsEventListener(parent.pollFormWidget));
Event.observe("uploadType","click",this.onUploadClick.bindAsEventListener(this));
Event.observe("urlType","click",this.onUrlClick.bindAsEventListener(this));
var C=$("errors").innerHTML.strip();
if(C.length>0){alert(C);
}},onUploadClick:function(A){$("imageFile").style.color="black";
$("imageUrl").style.color="gray";
},onUrlClick:function(A){$("imageFile").style.color="gray";
$("imageUrl").style.color="black";
}};
var PollImageAssociateSearchWidget=Class.create();
PollImageAssociateSearchWidget.prototype=Object.extend(new SearchWidget(),{numMatches:-1,handleSearch:function(){if(this.numMatches==-1){parent.pollFormWidget.growModalWindow(0,PollModalConstants.ASSOCIATION_HEIGHT_ADJUSTMENT_FOR_SEARCH);
this.numMatches=0;
}var A="searchType="+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);
var B=A.responseText.match(/li.+li/g);
var C=B==null?0:A.responseText.match(/li.+li/g).length;
parent.pollFormWidget.growModalWindow(0,(C-this.numMatches)*PollModalConstants.ASSOCIATION_HEIGHT_ADJUSTMENT_PER_ITEM);
this.numMatches=C;
this.state=this.STATES.READY;
this.paint();
}});
var PollImageAssociateWidget=Class.create();
PollImageAssociateWidget.prototype={initialize:function(E,D,C){parent.pollFormWidget.updatePollIdIfNecessary(E);
var B=C==0?PollModalConstants.LARGE_IMAGE_DIMENSION:PollModalConstants.SMALL_IMAGE_DIMENSION;
B=Math.max(B,PollModalConstants.ASSOCIATE_WINDOW_MIN_WIDTH);
var A=PollModalConstants.ASSOCIATION_HEIGHT_PRE_SEARCH+(C==0?PollModalConstants.LARGE_IMAGE_DIMENSION:PollModalConstants.SMALL_IMAGE_DIMENSION);
parent.pollFormWidget.resizeModalWindow(B,A);
new PollImageAssociateSearchWidget({parent:"associationA",action:"searchActors"});
new PollImageAssociateSearchWidget({parent:"associationM",action:"searchMovies"});
parent.pollFormWidget.previewFetchedImage(D);
Event.observe("associateImage","click",parent.pollFormWidget.handleAssociateImage.bindAsEventListener(parent.pollFormWidget));
}};
var PollPreviewWidget=Class.create();
PollPreviewWidget.prototype={initialize:function(B){this.cacheBindMethods();
for(var A=1;
A<=B;
A++){Event.observe("choice"+A,"mouseover",this.boundHandleHighlightChoice);
Event.observe("choice"+A,"mouseout",this.boundHandleUnhighlightChoice);
Event.observe("choice"+A,"click",function(){alert("You must publish your poll before you can vote on it.");
});
}},cacheBindMethods:function(){this.boundHandleHighlightChoice=this.handleHighlightChoice.bindAsEventListener(this);
this.boundHandleUnhighlightChoice=this.handleUnhighlightChoice.bindAsEventListener(this);
},findChoiceContainer:function(B){var A=Event.element(B);
if(!Element.hasClassName(A,"choice")){A=$(A).up("div.choice");
}return A;
},handleHighlightChoice:function(B){var A=this.findChoiceContainer(B);
if(A!=null){Element.addClassName(A,"hovering");
}},handleUnhighlightChoice:function(B){var A=this.findChoiceContainer(B);
if(A!=null){Element.removeClassName(A,"hovering");
}}};
var PollThumbsWidget=Object.extend(Class.create(),{VOTES:{THUMBS_UP:1,THUMBS_DOWN:2,THUMBS_NONE:3}});
PollThumbsWidget.prototype={setOptions:function(A,B){this.options={widget:"thumbs"};
this.stats={score:0,votes:0};
Object.extend(this.options,A||{});
Object.extend(this.stats,B||{});
},initialize:function(F,C,E,B,D,A){this.pollId=F;
this.vote=C;
this.isLoggedIn=E;
this.setOptions(B,D);
this.postClickSuccessCallback=A;
this.up=$A($(this.options.widget).getElementsByClassName("up")).first();
this.down=$A($(this.options.widget).getElementsByClassName("down")).first();
this.score=$A($(this.options.widget).getElementsByClassName("score")).first();
Event.observe(this.up,"click",this.handleUp.bindAsEventListener(this));
Event.observe(this.down,"click",this.handleDown.bindAsEventListener(this));
this.paint();
},handleUp:function(){if(!this.isLoggedIn){alert("You must login or register to rate this poll.");
return ;
}switch(this.vote){case PollThumbsWidget.VOTES.THUMBS_UP:this.vote=PollThumbsWidget.VOTES.THUMBS_NONE;
this.stats.score-=1;
this.stats.votes-=1;
break;
case PollThumbsWidget.VOTES.THUMBS_DOWN:this.vote=PollThumbsWidget.VOTES.THUMBS_UP;
this.stats.score+=1;
break;
case PollThumbsWidget.VOTES.THUMBS_NONE:this.vote=PollThumbsWidget.VOTES.THUMBS_UP;
this.stats.score+=1;
this.stats.votes+=1;
break;
}this.paint();
var B="pollId="+this.pollId+"&vote="+this.vote;
var A={parameters:B};
if(this.postClickSuccessCallback!=null){A["onSuccess"]=this.postClickSuccessCallback;
}new Ajax.Request("/polls/service/rate",A);
},handleDown:function(){if(!this.isLoggedIn){alert("You must login or register to rate this poll.");
return ;
}switch(this.vote){case PollThumbsWidget.VOTES.THUMBS_UP:this.vote=PollThumbsWidget.VOTES.THUMBS_DOWN;
this.stats.score-=1;
break;
case PollThumbsWidget.VOTES.THUMBS_DOWN:this.vote=PollThumbsWidget.VOTES.THUMBS_NONE;
this.stats.votes-=1;
break;
case PollThumbsWidget.VOTES.THUMBS_NONE:this.vote=PollThumbsWidget.VOTES.THUMBS_DOWN;
this.stats.votes+=1;
break;
}this.paint();
var B="pollId="+this.pollId+"&vote="+this.vote;
var A={parameters:B};
if(this.postClickSuccessCallback!=null){A["onSuccess"]=this.postClickSuccessCallback;
}new Ajax.Request("/polls/service/rate",A);
},paint:function(){Element.removeClassName(this.up,"on");
Element.removeClassName(this.down,"on");
Element.removeClassName(this.up,"off");
Element.removeClassName(this.down,"off");
switch(this.vote){case PollThumbsWidget.VOTES.THUMBS_UP:Element.removeClassName(this.up,"off");
Element.removeClassName(this.down,"on");
Element.addClassName(this.up,"on");
Element.addClassName(this.down,"off");
break;
case PollThumbsWidget.VOTES.THUMBS_DOWN:Element.removeClassName(this.up,"on");
Element.removeClassName(this.down,"off");
Element.addClassName(this.up,"off");
Element.addClassName(this.down,"on");
break;
case PollThumbsWidget.VOTES.THUMBS_NONE:Element.removeClassName(this.up,"on");
Element.removeClassName(this.down,"on");
Element.addClassName(this.up,"off");
Element.addClassName(this.down,"off");
break;
}this.score.update((this.stats.votes<=0?0:Math.round(100*(this.stats.score/this.stats.votes)))+"%");
}};
var PollForceRateWidget=Class.create();
PollForceRateWidget.prototype={initialize:function(B){var A=function(){$("nextPollForm").submit();
};
new PollThumbsWidget(B,PollThumbsWidget.VOTES.THUMBS_NONE,true,{widget:"forceRate"},null,A);
new ModalWindow("").show();
Event.observe("skipForceRate","click",A);
}};
var PollVoteWidget=Object.extend(Class.create(),{POLL_ORDER:{NEW_POLL:"_new",PREVIOUS_POLL:"_previous"}});
PollVoteWidget.prototype={initialize:function(C,D,I,K,B,E,H,G,J,A){this.pollOrder=C;
this.pollId=D;
this.numChoices=K;
this.isClosed=B;
this.isLoggedIn=E;
this.cacheBindMethods();
this.showingResults=C==PollVoteWidget.POLL_ORDER.PREVIOUS_POLL;
this.ratingWidget=new PollThumbsWidget(D,A,E,{widget:this.qualifyElement("rating")},J);
this.totalNumVotes=0;
this.choiceVoteCounts=new Array(K);
for(var F=1;
F<=K;
F++){this.choiceVoteCounts[F-1]=parseInt(this.$("choice"+F).readAttribute("numVotes"));
this.totalNumVotes+=this.choiceVoteCounts[F-1];
Event.observe(this.qualifyElement("cancel"+F),"click",this.handleCancelVote.bindAsEventListener(this));
}if(C==PollVoteWidget.POLL_ORDER.NEW_POLL){if(E){Event.observe("skip","click",this.handleSkip.bindAsEventListener(this));
}Event.observe("toggleShowResults","click",this.handleToggleShowResults.bindAsEventListener(this));
if(I!=null){this.handleShowSharePoll();
}else{if(E){Event.observe("showSharePoll","click",this.handleShowSharePoll.bindAsEventListener(this));
}}}if(H){Event.observe(this.qualifyElement("shareAll"),"click",this.handleSelectAllFriends.bindAsEventListener(this));
Event.observe(this.qualifyElement("shareBtn"),"click",this.handleShareWithFriends.bindAsEventListener(this));
}Event.observe(this.qualifyElement("sendUrl"),"click",this.highlightSendUrl.bindAsEventListener(this));
Event.observe(this.qualifyElement("sendUrl"),"focus",this.highlightSendUrl.bindAsEventListener(this));
if(I!=null){this.selectChoice(this.$("choice"+I));
this.toggleShowResults();
}else{if(B){this.toggleShowResults();
}else{this.enableVoting();
}}if(G&&C==PollVoteWidget.POLL_ORDER.NEW_POLL){$("message").style.display="block";
}},qualifyElement:function(A){return A+this.pollOrder;
},$:function(A){return $(this.qualifyElement(A));
},cacheBindMethods:function(){this.boundHandleHighlightChoice=this.handleHighlightChoice.bindAsEventListener(this);
this.boundHandleUnhighlightChoice=this.handleUnhighlightChoice.bindAsEventListener(this);
this.boundHandleVote=this.handleVote.bindAsEventListener(this);
},highlightSendUrl:function(A){this.$("sendUrl").select();
},selectChoice:function(A){this.selectedChoice=A;
Element.addClassName(A,"selected");
$(A).down("div.label").down("div.voteOption").update("My Vote");
},unselectChoice:function(){Element.removeClassName(this.selectedChoice,"selected");
$(this.selectedChoice).down("div.label").down("div.voteOption").update("Vote!");
this.selectedChoice=null;
this.enableVoting();
},enableVoting:function(){for(var A=1;
A<=this.numChoices;
A++){Event.observe(this.qualifyElement("choice"+A),"mouseover",this.boundHandleHighlightChoice);
Event.observe(this.qualifyElement("choice"+A),"mouseout",this.boundHandleUnhighlightChoice);
Event.observe(this.qualifyElement("choice"+A),"click",this.boundHandleVote);
}Element.addClassName(this.$("choices"),"votingEnabled");
},disableVoting:function(){for(var A=1;
A<=this.numChoices;
A++){Event.stopObserving(this.qualifyElement("choice"+A),"mouseover",this.boundHandleHighlightChoice);
Event.stopObserving(this.qualifyElement("choice"+A),"mouseout",this.boundHandleUnhighlightChoice);
Event.stopObserving(this.qualifyElement("choice"+A),"click",this.boundHandleVote);
}Element.removeClassName(this.$("choices"),"votingEnabled");
},findChoiceContainer:function(B){var A=Event.element(B);
if(!Element.hasClassName(A,"choice")){A=$(A).up("div.choice");
}return A;
},hideMessage:function(){$("message").style.display="none";
},displayMessage:function(A){$("message").update(A);
$("message").style.display="block";
},displayErrorMessage:function(A){this.displayMessage('<div class="alert_error">'+A+"</div>");
},displaySystemErrorMessage:function(A){this.displayMessage('<div class="alert_error" style="height:30px;">'+A+"</div>");
},displayShareMessage:function(B,A){this.$("shareMessage").update(B);
this.$("shareMessage").style.display="block";
if(A){new Effect.Pulsate(this.qualifyElement("shareMessage"),{duration:3});
}},displayShareErrorMessage:function(A){this.displayShareMessage('<div class="error">'+A+"</div>",true);
},displayShareBusyMessage:function(A){this.displayShareMessage('<div class="busy"><img src="http://static5.flixster.com/static/images/wait.gif" alt="Loading..."/> '+A+"</div>",false);
},handleHighlightChoice:function(B){var A=this.findChoiceContainer(B);
if(A!=null){Element.addClassName(A,"hovering");
}},handleUnhighlightChoice:function(B){var A=this.findChoiceContainer(B);
if(A!=null){Element.removeClassName(A,"hovering");
}},handleVote:function(B){if(!this.isLoggedIn){alert("Sorry, you must be a registered user to vote on polls. Please sign in or register.");
}else{var A=this.findChoiceContainer(B);
if(A!=null){this.disableVoting();
document.body.style.cursor="wait";
this.selectedChoice=A;
var C="cancel=false&choiceId="+A.readAttribute("choiceId");
new Ajax.Request("/polls/service/vote",{parameters:C,onSuccess:this.onVoteSuccess.bind(this),onTimeout:this.onVoteTimeout.bind(this),onFailure:this.onVoteFailure.bind(this)});
}}},onVoteSuccess:function(A){var B=A.responseText.strip();
if(B.indexOf("forceRate")==0){document.body.style.cursor="default";
new PollForceRateWidget(this.pollId);
}else{$("nextPollForm").submit();
}},onVoteTimeout:function(A){document.body.style.cursor="default";
this.displaySystemErrorMessage("Whoops, your vote request timed out. Please check your network connection and try again.");
Element.removeClassName(this.selectedChoice,"hovering");
this.selectedChoice=null;
this.enableVoting();
},onVoteFailure:function(A){document.body.style.cursor="default";
this.displaySystemErrorMessage("Whoops, our servers coughed.  Please try again.");
Element.removeClassName(this.selectedChoice,"hovering");
this.selectedChoice=null;
this.enableVoting();
},handleCancelVote:function(A){document.body.style.cursor="wait";
if(this.pollOrder==PollVoteWidget.POLL_ORDER.PREVIOUS_POLL){$("cancelPreviousVoteForm").submit();
}else{var B="cancel=true&pollId="+this.pollId;
new Ajax.Request("/polls/service/vote",{parameters:B,onSuccess:this.onVoteCancelSuccess.bind(this),onTimeout:this.onVoteCancelTimeout.bind(this),onFailure:this.onVoteCancelFailure.bind(this)});
}},onVoteCancelSuccess:function(A){document.body.style.cursor="default";
if(this.showingResults){this.toggleShowResults();
}this.totalNumVotes--;
this.$("totalNumVotes").update(this.totalNumVotes+" time"+(this.totalNumVotes==1?"":"s"));
var B=this.selectedChoice.readAttribute("sequence");
this.choiceVoteCounts[B-1]--;
this.unselectChoice();
this.displayMessage(A.responseText);
},onVoteCancelTimeout:function(A){document.body.style.cursor="default";
this.displaySystemErrorMessage("Whoops, your request to cancel your vote timed out. Please check your network connection and try again.");
},onVoteCancelFailure:function(A){document.body.style.cursor="default";
this.displaySystemErrorMessage("Whoops, our servers coughed.  Please try again.");
},handleToggleShowResults:function(A){if(this.isLoggedIn){this.hideMessage();
}this.toggleShowResults();
},handleShowSharePoll:function(A){$("shareFriends").style.display="inline";
Element.hide($("showSharePoll"));
},toggleShowResults:function(){if(this.pollOrder==PollVoteWidget.POLL_ORDER.PREVIOUS_POLL){this.updateStats();
}else{this.showingResults=!this.showingResults;
$("toggleShowResults").update(this.showingResults?"Hide results":"View results");
if(this.showingResults){this.updateStats();
if(this.isLoggedIn&&!this.isClosed&&this.selectedChoice==null){this.displayMessage('<div class="warning">'+'<div class="header">You haven\'t taken this poll yet.</div>'+'<div class="body">Make your selection below.</div></div>');
}}}for(var A=1;
A<=this.numChoices;
A++){this.$("results"+A).style.display=this.showingResults?"block":"none";
}},updateStats:function(){for(var B=1;
B<=this.numChoices;
B++){var C=Math.max(0,this.choiceVoteCounts[B-1]);
this.$("count"+B).update(C);
var A=(this.totalNumVotes<=0?0:Math.round(100*(C/this.totalNumVotes)))+"%";
this.$("percentage"+B).update(A);
this.$("bar"+B).style.width=A;
}},handleSkip:function(){document.body.style.cursor="wait";
var A="currentPollId="+this.pollId;
if(this.selectedChoice!=null){A+="&answered=true";
}new Ajax.Request("/polls/service/next-poll",{parameters:A,onSuccess:this.onSkipSuccess.bind(this),onTimeout:this.onSkipTimeout.bind(this),onFailure:this.onSkipFailure.bind(this)});
},onSkipSuccess:function(A){document.body.style.cursor="default";
var B=A.responseText.strip();
if(B.indexOf("<div class")==0){this.displayErrorMessage(B);
}else{window.location=B;
}},onSkipTimeout:function(A){document.body.style.cursor="default";
this.displaySystemErrorMessage("Whoops, your request timed out. Please check your network connection and try again.");
},onSkipFailure:function(A){document.body.style.cursor="default";
this.displaySystemErrorMessage("Whoops, our servers coughed.  Please try again.");
},handleSelectAllFriends:function(A){FormUtils.checkAll(this.$("shareForm").friend);
},handleShareWithFriends:function(A){var D=this.$("shareForm").friend;
var B=false;
for(i=0;
i<D.length;
i++){if(D[i].checked){B=true;
break;
}}if(B||D.checked){this.$("shareBtn").disabled=true;
this.displayShareBusyMessage("Inviting selected friends...");
var C=Form.serialize(this.qualifyElement("shareForm"));
new Ajax.Request("/polls/service/share",{parameters:C,onSuccess:this.onShareSuccess.bind(this),onTimeout:this.onShareTimeout.bind(this),onFailure:this.onShareFailure.bind(this)});
}else{alert("Whoops, you forgot to choose the friends to share with.");
}},onShareSuccess:function(A){this.$("shareBtn").disabled=false;
this.displayShareMessage(A.responseText,true);
},onShareTimeout:function(A){this.$("shareBtn").disabled=false;
this.displayShareErrorMessage("Whoops, your request timed out. Please check your network connection and try again.");
},onShareFailure:function(A){this.$("shareBtn").disabled=false;
this.displayShareErrorMessage("Whoops, our servers coughed.  Please try again.");
}};
var UserPollsWidget=Class.create();
UserPollsWidget.prototype={initialize:function(A){if(A.length>0){$("message").style.display="block";
if($("created"+A)){new Effect.Highlight("created"+A,{duration:3});
}}},displayMessage:function(A){$("message").update(A);
$("message").style.display="block";
new Effect.Highlight("message",{duration:3});
},displayErrorMessage:function(A){this.displayMessage('<div class="error">'+A+"</div>");
},deletePoll:function(B){if(confirm("Really delete this poll? This operation cannot be undone.")){this.pollIdToDelete=B;
var A="pollId="+B;
new Ajax.Request("/polls/service/delete",{parameters:A,onSuccess:this.onDeleteSuccess.bind(this),onTimeout:this.onDeleteTimeout.bind(this),onFailure:this.onDeleteFailure.bind(this)});
}},onDeleteSuccess:function(A){Element.addClassName($("created"+this.pollIdToDelete),"deleted");
this.displayMessage('<div class="info" style="height:43px;">'+'<div class="header">Your poll has been successfully deleted.</div></div>');
},onDeleteTimeout:function(A){this.displayErrorMessage("Whoops, your request timed out. Please check your network connection and try again.");
},onDeleteFailure:function(A){this.displayErrorMessage("Whoops, our servers coughed.  Please try again.");
}};




