VinesAutocomplete.implement({getTemplate:function(f){var n,a,j,k,g,c,d,e,b,i,m,l,h;switch(f.type){case"movie":n=new Element("li");j=new Element("div",{"class":"body"}).inject(n);if(f.image){g=new Element("img",{src:f.image,"class":"image"}).inject(j)}d=new Element("div",{"class":"info"}).inject(j);b=new Element("span",{text:f.name,"class":"name"}).inject(d);if(f.release_year){year=new Element("span",{text:f.release_year+" ","class":"year"}).inject(d)}if(f.type){m=new Element("span",{text:f.type,"class":"type"}).inject(d)}switch(f.result_type){case"alias":h=new Element("span",{text:"(alias)","class":"alias"}).inject(d);break;case"exact":n.addClass("exact");break;default:break}return n;case"show":n=new Element("li");j=new Element("div",{"class":"body"}).inject(n);if(f.image){g=new Element("img",{src:f.image,"class":"image"}).inject(j)}d=new Element("div",{"class":"info"}).inject(j);b=new Element("span",{text:f.name,"class":"name"}).inject(d);if(f.release_year){year=new Element("span",{text:f.release_year+" ","class":"year"}).inject(d)}if(f.type){m=new Element("span",{text:"TV "+f.type,"class":"type"}).inject(d)}switch(f.result_type){case"alias":h=new Element("span",{text:"(alias)","class":"alias"}).inject(d);break;case"exact":n.addClass("exact");break;default:break}return n;default:return false}}});window.addEvent("domready",function(){var a=$("box_office_wager_pod");if(!a){return}var b=function(){var c=a.getElement("form");if(!c){return}c.addEvent("submit",function(g){g.stop();var d=new Element("div",{"class":"mask"}).inject(c);d.addEvent("click",function(h){h.stop()});var f=new Request.HTML({url:c.get("action"),update:a,onSuccess:function(){b();var e=$("box_office_wager_submitted_pod");if(!e){return}var h=new Element("p",{"class":"prompt",html:"<span>Thanks</span>Check back on Sunday to see where you stand on the leaderboards."}).inject(e.getElement(".bd"),"top")},onFailure:function(){alert("There was a problem submitting your guesses. Please try again.");d.destroy()}}).post(c)})};b()});
