/* modules-widgets
 
@author Jacob at Goby
 @version 09/02/11
@svn goby_-150
*/

function WidgetTab(params)
{if(params)
{this.mgr=params.mgr;this.link=params.link;this.params=params;this.id=params.id;}}
WidgetTab.prototype=new PortalTab(null);WidgetTab.prototype.prepend=false;WidgetTab.prototype.hide=function(){$(this.wrapper).hide();};WidgetTab.prototype.show=function(){$(this.wrapper).show();};WidgetTab.prototype.drawContent=function(className)
{this.wrapper=document.createElement("div");this.wrapper.id=this.params.id+"-widget";var container=this.mgr.getContainer();var wrapper=this.wrapper;var head=document.createElement("div");var foot=document.createElement("div");if(this.params.container_params!=null)
var params=this.params.container_params;else
var params={};if(params.wrapper_class)
$(this.wrapper).addClass(params.wrapper_class);else
$(this.wrapper).addClass((className?className:"widget"));var head=new Border({className:(params.head_class!=null?params.head_class:false),type:params.head_class?'':'head'});var foot=new Border({className:(params.foot_class!=null?params.foot_class:false),type:params.foot_class?'':'foot'});if(this.prepend)
$(container).prepend(wrapper);else
container.appendChild(wrapper);var content=document.createElement("div");this.content=content;this.content.className=(params.body_class!=null?params.body_class:"widget-content");wrapper.appendChild(head);wrapper.appendChild(this.content);wrapper.appendChild(foot);if(this.params.title!=null&&this.params.title)
{this.anchor=document.createElement("a");var header=new Head({type:2,nodes:[this.anchor,document.createTextNode(this.params.title)]});if(params.head_loc!=null)
{switch(params.head_loc)
{case"head":head.appendChild(header);break;default:this.content.appendChild(header);break;}}
else
{this.content.appendChild(header);}
this.header=header;}
else
this.header=null;return this.content;}
WidgetTab.prototype.getLocation=function()
{return this.mgr.getLocation();}
WidgetTab.prototype.getContainer=function()
{return this.content;}
WidgetTab.prototype.close=function()
{if(this.wrapper.parentNode!=null)
this.wrapper.parentNode.removeChild(this.wrapper);else if(this.content.parentNode!=null)
this.content.parentNode.removeChild(this.content);}
WidgetTab.prototype.displayMoreLink=function(params)
{}
function WidgetAd(params)
{this._construct(params);}
WidgetAd.prototype=new WidgetTab(null);WidgetAd.prototype.display=function()
{this.content=this.drawContent('widget');if(this.params.partner!=null&&this.params.partner=="openx")
{try
{var iframe=document.createElement("iframe");iframe.id=this.params.ad_id;iframe.name=this.params.n_id;iframe.src=this.params.source;iframe.setAttribute('width',300);iframe.setAttribute('height',250);iframe.setAttribute('frameBorder','0');iframe.setAttribute('border','0');iframe.setAttribute('scrolling','no');iframe.setAttribute('allowtransparency','true');iframe.setAttribute('style','background-color:transparent');this.content.appendChild(iframe);if(!Goby.get("scriptLoader").isLoaded(this.params.scriptUrl))
{Goby.get("scriptLoader").importFile(this.params.scriptUrl,{remote:true,inline:false,async:true});}}
catch(e)
{}}
else if(this.params.customPosition&&this.params.getID){this.content.appendChild(document.getElementById(this.params.getID));}
else if(this.params.customHtml){this.content.id="widget-ad";this.content.innerHTML=this.params.customHtml;}else{this.content.id="widget-ad";var image=document.createElement("img");this.linkUrl=this.params.linkUrl
image.alt="AD";image.src=this.params.imgUrl;image.widget=this;if(this.params.linkUrl)
{var link=new Link({text:"",href:this.params.linkUrl});link.setAttribute("target","_blank");link.appendChild(image);this.content.appendChild(link);link=null;}
else
{this.content.appendChild(image);}}};function OA_show_CUSTOM(name){if(typeof(OA_output[name])=='undefined'){return;}else{return OA_output[name];}}
function WidgetMedia(params)
{this._construct(params);}
WidgetMedia.prototype=new WidgetTab(null);WidgetMedia.prototype.display=function()
{this.content=this.drawContent();this.content.innerHTML="media widget!";}
WidgetResults=function(params){this.__run(params);}
WidgetResults.prototype=Class({inherits:WidgetTab,methods:{display:function()
{this.content=this.drawContent('widget');this.content.id="ResultTabContainer";if(this.params.useMap)
{var mapItem=document.createElement("div");mapItem.id="map3030303";konsole.log('loading map?!');try
{this.map=WidgetLoader({drag:false,object:'WidgetGoogle',id:'map',params:{drag:false,type:'portal',location:this.mgr.getLocation()}},mapItem);}
catch(e)
{Goby.reportError(e);}}
this.list=new UL({className:'tabs'});this.params.container=this.content;this.params.tabList=this.list;this.resultMgr=new TabMgr(this.params,false);if(Goby.get('pageInfo').pageID=="entity")
{$(this.wrapper).prepend(this.list);$(this.wrapper).prepend(this.header);$(this.content).append(mapItem);}
this.resultMgr.widget=this;this.resultMgr.getLocation=function(){return this.widget.mgr.getLocation();}
this.resultMgr.getMap=function(){return this.widget.getMap();}
this.resultMgr.updateDateMenu=function(dateNode)
{if(Goby.get('pageInfo').pageID=="entity")
this.widget.wrapper.appendChild(dateNode);else
this.widget.content.appendChild(dateNode);}
this.resultMgr.params=this.params;if(this.params.currentTab)
{var tab=this.resultMgr.getTabByID(this.params.currentTab);if(tab)
{tab.params.results=this.params.results;this.resultMgr.displayTab(tab);}}},getMap:function()
{if(this.map)
return this.map.getMap();return false;}},_destruct:function()
{}});function WidgetWeather(params)
{Goby.get("scriptLoader").importStyle(Goby.conf('path.css')+"/widgets/weather.css");this._construct(params);}
WidgetWeather.prototype=new WidgetTab(null);WidgetWeather.prototype.display=function()
{this.content=this.drawContent();var location=this.mgr.getLocation();var request=this.makeRequest({object:this,method:"showWeather"},{locationId:location.id});}
WidgetWeather.prototype.showWeather=function(data)
{if(data==null||data.forecast==null)
{var msg=document.createElement("p");msg.innerHTML="we encountered difficulties connecting to noaa.com";this.content.appendChild(msg);return;}
var holder=document.createElement("ul");holder.id="forecast";for(var i in data.forecast)
{var day=data.forecast[i];var item=document.createElement("li");var dayItem=document.createElement("h6");dayItem.innerHTML=day.day;dayItem.className="fc-day";var dayIco=document.createElement("img");dayIco.src=day.icon;dayIco.className="fc-ico";var dayTmp=document.createElement("div");dayTmp.innerHTML=day.min+"&deg;/"+day.max+"&deg;";dayTmp.className="fc-tmp";item.appendChild(dayItem);item.appendChild(dayIco);item.appendChild(dayTmp);holder.appendChild(item);}
holder.appendChild(getClear());this.content.appendChild(holder);}
function WidgetMedia(params)
{this._construct(params);}
WidgetMedia.prototype=new WidgetTab(null);WidgetMedia.prototype.display=function()
{this.content=this.drawContent();this.content.innerHTML="media widget!";}
function WidgetDescriptions(params)
{this.results=[];this.resultData=[];this.perPage=1;this._construct(params);}
WidgetDescriptions.prototype=new WidgetTab(null);WidgetDescriptions.prototype.resultsPerPage=1;WidgetDescriptions.prototype.display=function()
{this.sources={};this.content=this.drawContent();var j=0;var k=0;var sourceNode=new UL({className:"facet-sources"});var source=false;for(var i in this.params.entries)
{var src=this.params.entries[i];if(!this.sources[src.facets.display_url]&&src.facets.display_url)
{var source=new LI({});source.appendChild(new Link({href:src.facets.source_url,popup:true,text:src.facets.display_url}));var delim=document.createTextNode(', ');source.appendChild(delim);sourceNode.appendChild(source);this.sources[src.facets.display_url]=true;j++;}
if(this.params.entries[i].facets.description)
this.results[k++]=this.params.entries[i];}
sourceNode.truncate(64);var lastnode=sourceNode.childNodes[sourceNode.childNodes.length-1];lastnode.removeChild(lastnode.childNodes[lastnode.childNodes.length-1]);var srcCnt=j;this.min=0;this.resultArea=new UL({className:"descriptions"});this.sourceNode=sourceNode;this.content.appendChild(this.resultArea);this.content.appendChild(getClear());try
{if(srcCnt>1)
this.content.appendChild(this.renderNavigation());}
catch(e)
{konsole.log(e);}
this.displayResults(0,this.perPage);}
WidgetDescriptions.prototype.getMax=function()
{return this.results.length;}
WidgetDescriptions.prototype.renderNavigation=function()
{if(this.getMax()<=this.resultsPerPage)
return new Div({className:"description-bar",nodes:[this.sourceNode,getClear()]});this.links={more:new Link({widget:this,className:"more",text:"show "+(this.getMax()-this.resultsPerPage)+" more",fnc:function()
{if(this.open)
{this.open=false;$(this).removeClass('closed');this.innerHTML="show "+(this.widget.getMax()-this.widget.perPage)+" more";this.widget.removeResults(this.widget.perPage,this.widget.getMax());}
else
{this.open=true;$(this).addClass('closed');this.innerHTML="hide";this.widget.displayResults(this.widget.perPage,this.widget.getMax())}}})};if(this.sourceNode!=null)
return new Div({className:"description-bar",nodes:[this.links.more,new Span({text:'-'}),this.sourceNode,getClear()]});else
return new Div({className:"description-bar",nodes:[this.links.more,getClear()]});}
WidgetDescriptions.prototype.fetchResults=function(dir)
{var max=this.getMax();var min=0;switch(dir)
{case"next":trackEvent([PAGE_ID,'description_next']);this.page++
if(this.page>max)
this.page=0;break;case"prev":trackEvent([PAGE_ID,'description_prev']);this.page--;if(this.page<0)
this.page=max;break;default:this.page=dir;}
this.links.prev.toggleInert(this.page<=0?true:false);this.links.next.toggleInert(this.page>=this.getMax()?true:false);if(this.links.pagedots!=null)
this.links.pagedots.update(this.page);this._displayResults(dir);}
WidgetDescriptions.prototype._displayResults=function(dir)
{$(this.resultArea).children().remove();var start=this.resultsPerPage*this.page;var end=(this.resultsPerPage*this.page)+this.resultsPerPage;var result=this.displayResults(start,end);return result;}
WidgetDescriptions.prototype.removeResults=function(start,end)
{for(var i=start;i<end;i++)
if(this.resultData[i]&&this.resultData[i].parentNode)
this.resultData[i].parentNode.removeChild(this.resultData[i]);}
WidgetDescriptions.prototype.displayResults=function(start,end)
{for(var i=start;i<end;i++)
{this.i=i;try
{if(this.results[i])
{this.resultData[i]=this.displayResult(this.results[i],(i==(end-1)?true:false));this.resultArea.appendChild(this.resultData[i]);}}
catch(e){}}}
WidgetDescriptions.prototype.displayResult=function(result,last)
{var resultContent=new LI({className:"entry"+(last?" "+"entry-last":'')});if(result!=null&&result.facets.description!=null)
{var title=new Link({text:"<span>"+"from "+result.facets.display_url+"</span><div class=\"icon\"></div>",href:result.facets.source_url,fnc:function(){trackEvent([PAGE_ID,'description_website'])},popup:true,className:"facet_url"});var paragraph=new P({className:'facet_description'});var span=new Span({text:result.facets.description.truncate(this.params.len!=null?this.params.len:310,'...',true)+"&nbsp;"});paragraph.appendChild(span);paragraph.appendChild(title);resultContent.appendChild(paragraph);}
return resultContent;}
function PageDots(count,widget)
{var node=document.createElement("ul");this.dots=[];this.widget=widget;this.count=count;for(var i in this)
node[i]=this[i];$(node).css("width",(this.count+1)*20);node.className="pg-dots";return node;}
PageDots.prototype={current:null,update:function(id)
{if(this.current!=null)
$(this.current).removeClass("sel");this.current=this.dots[id];$(this.current).addClass("sel");},display:function()
{for(var j=0;j<=this.count;j++)
{this.dots[j]=document.createElement("li");this.dots[j].innerHTML="<span></span>";this.dots[j].widget=this.widget;this.dots[j].index=j;this.dots[j].onclick=function()
{this.widget.fetchResults(this.index);}
this.appendChild(this.dots[j]);}}}
function WidgetImgList(params)
{if(params!=null)
{Goby.get("scriptLoader").importStyle(Goby.conf('path.css')+"/tabs/photos.css");this._construct(params);}}
WidgetImgList.prototype=new WidgetDescriptions(null);WidgetImgList.prototype.resultsPerPage=6;WidgetImgList.prototype.display=function()
{this.content=this.drawContent('widget-lite');this.min=0;this.links={next:new Link({fnc:function(){if(!this.inert)this.widget.fetchResults('next')},text:"<span></span>",widget:this,className:"pglink next"}),prev:new Link({fnc:function(){if(!this.inert)this.widget.fetchResults('prev')},text:"<span></span>",widget:this,className:"pglink prev"})}
for(var i in this.links)
{this.links[i].toggleInert=function(type)
{this.inert=type;type?$(this).addClass("inert"):$(this).removeClass('inert');}}
this.resultArea=new UL({className:"images"});var callback={"object":this,"method":"loadPhotos"};var data={action:"getPhotos",text:this.params.text,merged:true,type:(this.params.type?this.params.type:'tab'),entityID:(this.params.entityID!=null?this.params.entityID:null),limit:this.params.limit,merged:true,source:window.fetchParameter('source').serialize(),state_code:this.params.state};var wrapper=new Div({className:"imageWrapper",nodes:[this.resultArea]});this.ghostbar=new UL({className:"imageGhosts"});var disclaimer=new Div({className:"disclaimer",nodes:[new Span({text:"not accurate?"}),new Link({text:"report photos",fnc:function(){new Feedback().giveFeedback('2')}})]});$(this.content).prepend(disclaimer);this.content.appendChild(this.links.prev);this.content.appendChild(new Div({className:"imageContainer",nodes:[this.ghostbar,getClear(),wrapper]}));this.content.appendChild(this.links.next);this.content.appendChild(getClear());var request=this.makeRequest(callback,data,false,{container:wrapper});}
WidgetImgList.prototype.getMax=function()
{return Math.ceil((this.results.length)/this.resultsPerPage)-1;}
WidgetImgList.prototype.loadPhotos=function(data)
{data.container=this.content;data.id=this.pointer;data.noInfobox=true;data.limit=this.params.limit;data.type=(this.params.type?this.params.type:'tab');data.invertTitle=(this.params.invertTitle!=null?this.params.invertTitle:false);var j=0;this.results=data.images;this.max=Math.ceil((this.results.length)/this.resultsPerPage)-1;this.data=data;this.fetchResults(0);}
WidgetImgList.prototype._displayResults=function(dir)
{this.ghostbar.innerHTML='';if(dir!=0)
{var ul=this.resultArea;this.resultArea=new UL({className:"images"});ul.parentNode.appendChild(this.resultArea);}
var start=this.resultsPerPage*this.page;var end=(this.resultsPerPage*this.page)+this.resultsPerPage;var result=this.displayResults(start,end);if(ul!=null)
{var x=dir=='next'?565:-565;$(this.resultArea).css("left",x);$(ul).animate({left:-(x)},1000,'easeOutQuad',function()
{$(this).remove();})
$(this.resultArea).animate({left:0},1000,'easeOutQuad');}
return result;}
WidgetImgList.prototype.displayResult=function(result,last)
{if(result)
{result.ghost=new LI({className:"imageGhost"});this.ghostbar.appendChild(result.ghost);return new ServiceImage(result);}
else
return new LI({className:'serviceImage',text:'<span>placeholder</span>'});}
function WidgetImgListLite(params)
{Goby.get("scriptLoader").importStyle(Goby.conf('path.css')+"/tabs/photos.css");this._construct(params);}
WidgetImgListLite.prototype=new WidgetImgList(null);WidgetImgListLite.prototype.resultsPerPage=6;WidgetImgListLite.prototype.display=function()
{this.content=this.drawContent('widget-lite');var callback={"object":this,"method":"loadPhotos"};var data={action:"getPhotos",text:this.params.text,merged:true,type:(this.params.type?this.params.type:'tab'),entityID:(this.params.entityID!=null?this.params.entityID:null),limit:this.params.limit,merged:false,source:window.getParameter('source'),state_code:this.params.state};var request=this.makeRequest(callback,data);}
WidgetImgListLite.prototype.loadPhotos=function(data)
{var services=data.services;this.content.className="photoTab";if((services!=null))
{for(var i in services)
{var service=services[i];var serviceTitle=new Head({type:4,className:service.code,text:""});if(service.verbose!=null)
titleTxt="More&nbsp;Images&nbsp;From&nbsp;"+service.title+"&nbsp;"+(!this.invertTitle?"&#187":'');else
titleTxt="Images From "+service.title;serviceTitle.appendChild(new Div({}));serviceTitle.appendChild(new Link({text:titleTxt,widget:service,fnc:function(){window.open(service.url,"_blank");}}));this.content.appendChild(serviceTitle);if(service.images!=null)
this.content.appendChild(this.displayThumbnailList(service));if(this.invertTitle!=null&&this.invertTitle)
this.content.appendChild(serviceTitle);this.content.appendChild(getClear());}}
else
{this.content.innerHTML="<p class=\"errorMsg\">no images found...</p>";}}
WidgetImgListLite.prototype.displayThumbnailList=function(service)
{var list=new UL({className:"serviceImages"});var IMG_PER_ROW=(this.params.limit?this.params.limit:4);var images=service.images;for(var imgScore=0;imgScore<IMG_PER_ROW;imgScore++)
{var imageData=images[imgScore];if(imageData)
{imageData.code=service.code;imageData.type=this.type;var li=new ServiceImage(imageData);}
else
{var li=new LI({});var container=new Div({className:"loader_image_tab"});li.appendChild(container);}
if(((imgScore)%IMG_PER_ROW==0)&&(imgScore!=0))
{$(li).addClass("eor");$(li).css("margin-right","0");}
list.appendChild(li);}
return list;}
WidgetImgListLite.prototype._destruct=function()
{this.imgCtr=null;}
function WidgetConcierge(params)
{this.currentResultID=0;this._construct(params);}
WidgetConcierge.prototype=new WidgetTab(null);WidgetConcierge.prototype.display=function()
{this.content=this.drawContent();var location=this.mgr.getLocation();this.links={prev:new Link({text:'<span>prev</span>',fnc:function(){this.widget.fetchResult('prev');}}),next:new Link({text:'<span>next</span>',fnc:function(){this.widget.fetchResult('next');}}),body:document.createElement("div")};var parent=this.header.parentNode;var link=document.createElement("a");link.href="http://www.seaportboston.com/Visit-Boston/explore-boston.aspx";link.appendChild(this.header);parent.appendChild(link);this.links.body.className="pglinks";this.links.prev.className="pglink prev";this.links.next.className="pglink next";this.resultBody=document.createElement("div");this.resultBody.className="resultBody";this.links.prev.widget=this;this.links.next.widget=this;var talkNode=new Link({text:"<span>talk to a rep</span>",href:"http://www.seaportboston.com/Visit-Boston/explore-boston.aspx"});talkNode.id="talkNode";var phoneNode=$("<div id=\"phoneNode\"><strong>or</strong> call direct 1-800-SEAPORT</div>").get(0);this.links.body.appendChild(talkNode);this.links.body.appendChild(phoneNode);this.content.appendChild(this.resultBody);this.content.appendChild(this.links.body);this.links.body.appendChild(this.links.prev);this.links.body.appendChild(this.links.next);this.fetchResult();}
WidgetConcierge.prototype.fetchResult=function(type)
{$(this.resultBody).children().remove();var params={};params.widgetID=this.id;params.resultID=(type=="prev"?this.currentResultID--:this.currentResultID++);this.request=this.makeRequest({object:this,method:"loadResult"},params,false,{useLoader:true,loaderParent:this.resultBody,loaderClass:"loader_widget",append:true});return this.request;}
WidgetConcierge.prototype.loadResult=function(resultJson)
{var result=resultJson;var head=document.createElement("h5");var body=document.createElement("p");body.innerHTML=result.facets.description;head.appendChild(new Link({text:result.facets.title,href:result.facets.source_url}));this.resultBody.appendChild(head);this.resultBody.appendChild(body);this.request=null;}
WidgetConcierge.prototype._destruct=function()
{for(var i in this.links)
this.links[i]=null;this.request=null;Goby._kill(this);}
function WidgetThumbnails(params)
{this._construct(params);}
WidgetThumbnails.prototype=new WidgetTab(null);WidgetThumbnails.prototype.display=function()
{this.main=document.createElement("div");this.list=document.createElement("ul");this.nodes=[];this.main.className="main";for(var i in this.params.images)
{var data=this.params.images[i];var node=new LI();node.image=new ImagePreloader(data.thumb,node,{callback:{object:this,method:'fadeIn'}});node.image.alt=data.label;node.data=data;node.widget=this;node.onmouseover=function()
{$(this.image).fadeTo(this.widget.params.speed,1.00);}
node.onmouseout=function()
{$(this.image).fadeTo(this.widget.params.speed,this.widget.params.opacity);}
node.onclick=function()
{this.widget.showcase(this);}
this.list.appendChild(node);this.nodes.push(node);}
this.content=this.drawContent('widget-lite');this.content.appendChild(this.main);this.content.appendChild(this.list);this.showcase(this.nodes[0]);}
WidgetThumbnails.prototype.showcase=function(node)
{var params=node.data;var caption=document.createElement("span");caption.className="caption";caption.appendChild(new Link({href:params.url,text:"<label>"+params.label+"</label>"}));var node=document.createElement("div");node.className="windowpane";var img=new Image();img.src=params.full;$(node).hide();node.appendChild(img);node.appendChild(caption);this.main.appendChild(node);$(node).fadeIn(this.params.speed);if(this.currentNode!=null){$(this.currentNode).fadeOut(this.params.speed,function(){$(this).remove();});}
this.currentNode=node;}
WidgetThumbnails.prototype._destruct()
{this.currentNode=null;this.main=null;Goby._kill(this);}
WidgetThumbnails.prototype.fadeIn=function(img)
{}
function WidgetReviews(params)
{this.results=[];this.resultData=[];this.perPage=3;this._construct(params);}
WidgetReviews.prototype=new WidgetDescriptions(null);WidgetReviews.prototype.resultsPerPage=3;WidgetReviews.prototype.display=function(data)
{this.content=this.drawContent();this.resultArea=new UL({className:"reviews"});var j=0;this.results=[];for(var i in this.params.reviews)
{this.results[j]=new Review(this.params.reviews[i]);if(Goby.get('customer')&&this.params.reviews[i].customer_id==Goby.get('customer').getID())
{this.mine=this.results[j];this.mine.index=j;}
j++;}
this.fetchReviews();this.displayResults(0,3);this.content.appendChild(this.resultArea);this.content.appendChild(getClear());if(this.results.length>this.perPage)
this.content.appendChild(this.renderNavigation());if(Goby.conf('USE_LOGIN'))
{var ratingParams={values:{rating:this.params.rating.mine>0?this.rating.mine:this.params.rating,entityID:this.params.entityID},avg:this.params.overallRating.average>0?this.params.overallRating.average:0,overallTotal:this.params.overallRating.totalNumberOfRatings>0?this.params.overallRating.totalNumberOfRatings:0,total:this.params.overallRating.totalNumberOfRatings>0?this.params.overallRating.totalNumberOfRatings:0};this.form=new ReviewForm(ratingParams,this);this.content.appendChild(this.form);}
return this.content;}
WidgetReviews.prototype.updateRating=function(data){try{this.form.fields.rating.setValue(data.info.mine);if(data.error)
flash(data.error.message);else
{this.form.nodes.avg.update(data.info.avg);this.form.nodes.total.update(data.info.total);this.form.nodes.mine.update(data.info.mine);var ratingText='';if(data.info.total>1){ratingText='&nbsp;ratings,&nbsp;';}else if(data.info.total==1){ratingText='&nbsp;rating,&nbsp;';}else{ratingText='&nbsp;rating&nbsp;';}
this.form.nodes.totalStars.update(ratingText);this.form.nodes.avgStars.update(data.info.avg>1?'&nbsp;stars':'&nbsp;star');this.form.nodes.myStars.update(data.info.mine>1?'&nbsp;stars':'&nbsp;star');if(this.note){try{this.note.remove();}catch(e){}}
if(this.form.totals.parentNode!==this.form.aggregate)
{$(this.form.totals).fadeIn(1000,'easeOutCirc');this.form.aggregate.appendChild(this.form.totals);}
if(this.form.myRating.parentNode!==this.form.aggregate)
{$(this.form.myRating).fadeIn(1000,'easeOutCirc');this.form.aggregate.appendChild(this.form.myRating);}}}
catch(e)
{Goby.reportError(e)}}
WidgetReviews.prototype.displayResult=function(result,isLast)
{return result;}
WidgetReviews.prototype.displayForm=function()
{var form=new ReviewForm({values:{'entityID':this.params.entityID}},this);this.content.appendChild(form);}
WidgetReviews.prototype.addResult=function(data)
{if(data.error)
{flash(data.error.message);}
else
{Goby.get('page').updateRating(data);var review=new Review(data);if(this.mine)
{flash("you have successfully updated your review");this.mine.remove();this.results[this.mine.index]=review;}
else
flash("you have successfully posted a review");this.mine=review;if(this.error)
{this.error.remove();this.error=null;}
$(review).hide();$(review).fadeIn(400);$(this.resultArea).prepend(review);}}
WidgetReviews.prototype.fetchReviews=function()
{var callback={"object":this,"method":"loadReviews"};var data={action:"getReviews",type:"yelp",entityID:this.params.entityID,yelpID:this.params.yelpID};var request=this.makeRequest(callback,data,true);}
WidgetReviews.prototype.loadReviews=function(data)
{if(data!=null)
{if((data.businesses)&&(data.businesses[0]))
var reviews=data.businesses[0].reviews;else if(data.reviews)
var reviews=data.reviews;else
var reviews=false;if(reviews&&reviews.length>0)
{while(reviews.length>0)
{var data=reviews.pop();this.resultArea.appendChild(new YelpReview(data));}}
else if(this.results.length<1)
{this.error=new P({className:"widget-error",text:(Goby.conf('USE_LOGIN')?"be the first to add a review!":'No reviews available')});this.resultArea.parentNode.insertBefore(this.error,this.resultArea);}
else
$(this.results[this.results.length-1]).addClass('last');}}
function Review(reviewData)
{if(reviewData!=null)
{this.data=reviewData;return this.render();}}
Review.prototype={display:function()
{return this;},render:function()
{try
{var img={avatar:new Image()};img.avatar.src=this.data.user_photo_url_small;img.avatar.className="facet_avatar";var p=new P({className:"facet_description",text:this.data.text_excerpt+"&nbsp;"});p.appendChild(new Link({className:"facet_url",text:"from "+this.data.display_url,href:this.data.url,popup:true}));var body=new Div({className:"info"});body.appendChild(p);if(this.data.rating)
{var rating=new UL({className:"facet_rating"});for(var i=1;i<=5;i++){rating.appendChild(new LI({className:(i<=this.data.rating?"on":"off")}));}
body.appendChild(rating);}
var review=new LI({className:"review"});review.appendChild(img.avatar);review.appendChild(body);review.appendChild(getClear());for(var i in this)
review[i]=this[i];return review;}
catch(e)
{konsole.log(e);return new Div();}}}
function YelpReview(reviewData)
{this.data=reviewData;return this.render();}
YelpReview.prototype=new Review(null);YelpReview.prototype.render=function()
{var img={avatar:new Image(),rating:new Image()}
try
{img.avatar.src=this.data.user_photo_url_small;img.rating.src=this.data.rating_img_url;img.avatar.className="facet_avatar";img.rating.className="facet_rating";var review=new LI({className:"review"});review.appendChild(img.avatar);var body=new Div({className:"info"});var p=new P({className:"facet_description",text:this.data.text_excerpt+"&nbsp;"});body.appendChild(p);p.appendChild(new Link({className:"facet_url",text:"more",href:this.data.url,popup:true}));body.appendChild(new Span({className:"facet_author",text:'Posted by <a href="'+this.data.user_url+'">'+this.data.user_name+'</a> on <small class="yelplogo"></div></small>'}));body.appendChild(img.rating);review.appendChild(body);review.appendChild(getClear());p=null;return review;}
catch(e)
{konsole.log(e);}
return new Div();}
function RatingForm(params,admin)
{this.fields={'rating':new RatingField({value:params.values.rating,label:"rating",'name':'rating',default_value:params.avg,submit:true,options:{'1':1,'2':2,'3':3,'4':4,'5':5}}),'entityID':new HiddenField({label:'dude',name:'entityID'})};this.actions={submit:"submit"};var form=this._construct(params,admin);form.display();var ratingText='';if(params.total>1){ratingText='&nbsp;ratings,&nbsp;';}else if(params.total==1){ratingText='&nbsp;rating,&nbsp;';}else{ratingText='&nbsp;rating&nbsp;';}
form.nodes={avg:new Span({text:params.avg,className:"rating-avg"}),total:new Span({text:params.total,className:"rating-total"}),mine:new Span({className:"rating-mine",text:form.fields.rating.getValue()}),avgStars:new Span({text:(params.avg>1?'&nbsp;stars':'&nbsp;star')}),myStars:new Span({text:(form.fields.rating.getValue()>1?'&nbsp;stars':'&nbsp;star')}),totalStars:new Span({text:ratingText})};form.className=form.fields.rating.getValue()>0?form.className+' myRating':form.className;form.myRating=new P({text:"your rating: ",className:"youRate"});form.myRating.appendChild(form.nodes.mine);form.myRating.appendChild(form.nodes.myStars);form.totals=new P({className:"message",nodes:[form.nodes.total,form.nodes.totalStars,new Span({text:"avg. "}),form.nodes.avg,form.nodes.avgStars]});form.note=new P({text:"be the first to rate this listing!",className:'message'});form.aggregate=new Div({className:'rating-aggregate'});form.aggregate.appendChild((params.total<=0&&params.avg<=0)?form.note:form.totals);if(form.fields.rating.getValue())
form.aggregate.appendChild(form.myRating);form.appendChild(form.aggregate);return form;}
RatingForm.prototype=new GrilleForm(null);RatingForm.prototype.title="";RatingForm.prototype.requireLogin=true;RatingForm.prototype.id="rating";RatingForm.prototype.url="widget/reviews/updateRating";RatingForm.prototype.ende=function(data,xtr)
{if(data.error)
flash(data.error.message);else
{if(!this.admin.rating)
this.admin.rating=this.admin.overallRating;if(this.admin.rating.mine>0)
{data.info.total=this.admin.rating.totalNumberOfRatings;data.info.avg=parseFloat(this.admin.rating.rawAverage*this.admin.rating.totalNumberOfRatings+parseInt(data.info.mine))/data.info.total;}
else
{data.info.total=parseInt(this.admin.rating.totalNumberOfRatings)+1;data.info.avg=parseFloat(this.admin.rating.rawAverage*this.admin.rating.totalNumberOfRatings+parseInt(data.info.mine))/data.info.total;}
data.info.avg=Math.round(parseFloat(data.info.avg)/0.5)*0.5;this.nodes.avg.update(data.info.avg);this.nodes.total.update(data.info.total);this.nodes.mine.update(data.info.mine);var ratingText='';if(data.info.total>1){ratingText='&nbsp;ratings,&nbsp;';}else if(data.info.total==1){ratingText='&nbsp;rating,&nbsp;';}else{ratingText='&nbsp;rating&nbsp;';}
this.nodes.totalStars.update(ratingText);this.nodes.avgStars.update(data.info.avg>1?'&nbsp;star':'&nbsp;star');this.nodes.myStars.update(data.info.mine>1?'&nbsp;star':'&nbsp;star');if(this.note){try{this.note.remove();}catch(e){}}
if(this.totals.parentNode!==this.aggregate)
{$(this.totals).fadeIn(1000,'easeOutCirc');this.aggregate.appendChild(this.totals);}
if(this.myRating.parentNode!==this.aggregate)
{$(this.myRating).fadeIn(1000,'easeOutCirc');this.aggregate.appendChild(this.myRating);}
if(!xtr&&typeof this.admin.updateReview=='function'){this.admin.updateReview(data);}}}
function ReviewForm(params,admin)
{this.fields={'rating':new RatingField({label:"rating",'name':'rating',options:{'1':1,'2':2,'3':3,'4':4,'5':5},v:'[int:1]'}),'review':new TextareaField({label:"review",name:'review',default_value:"write a review...",v:'[all:1]'}),'entityID':new HiddenField({label:'dude',name:'entityID'})};this.actions={submit:"submit"};this.makeButton('submit',"post comment",function(){this.form.submit(1);});var form=this._construct(params,admin);form.display();$(form).prepend(form.getCustomerImage());var ratingText='';if(params.total>1){ratingText='&nbsp;ratings,&nbsp;';}else if(params.total==1){ratingText='&nbsp;rating,&nbsp;';}else{ratingText='&nbsp;rating&nbsp;';}
form.nodes={avg:new Span({text:params.avg,className:"rating-avg"}),total:new Span({text:params.total,className:"rating-total"}),mine:new Span({className:"rating-mine",text:form.fields.rating.getValue()}),avgStars:new Span({text:(params.avg>1?'&nbsp;star':'&nbsp;star')}),myStars:new Span({text:(form.fields.rating.getValue()>1?'&nbsp;star':'&nbsp;star')}),totalStars:new Span({text:ratingText})};form.className=form.fields.rating.getValue()>0?form.className+' myRating':form.className;form.myRating=new P({text:"your rating: ",className:"youRate"});form.myRating.appendChild(form.nodes.mine);form.myRating.appendChild(form.nodes.myStars);form.totals=new P({className:"message",nodes:[form.nodes.total,form.nodes.totalStars,new Span({text:"avg. "}),form.nodes.avg,form.nodes.avgStars]});form.note=new P({text:"be the first to rate this listing!",className:'message'});form.aggregate=new Div({className:'rating-aggregate'});form.aggregate.appendChild((params.total<=0&&params.avg<=0)?form.note:form.totals);if(form.fields.rating.getValue())
form.aggregate.appendChild(form.myRating);form.appendChild(form.aggregate);return form;}
ReviewForm.prototype=new GrilleForm(null);ReviewForm.prototype.requireLogin=true;ReviewForm.prototype.title="Write A Review!";ReviewForm.prototype.id="reviewForm";ReviewForm.prototype.url="widget/reviews/submit";ReviewForm.prototype.ende=function(data){this.admin.addResult(data);}
function WidgetFacebook(params)
{this._construct(params);}
WidgetFacebook.prototype=new WidgetTab(null);WidgetFacebook.prototype.display=function()
{this.content=this.drawContent();var facebook_id=74861881347;this.facebookNode=document.createElement('div');this.facebookNode.innerHTML='<fb:fan profile_id="'+facebook_id+'" stream="0" connections="10" logobar="0" width="300"></fb:fan>';this.twitterNode=document.createElement("div");this.twitterNode.id="twitter-widget";new ImagePreloader("http://a3.twimg.com/profile_images/429416913/twitter_logo_bigger.jpg",this.twitterNode,{});$(this.facebookNode).click(function()
{trackEvent([PAGE_ID,'widget-facebook']);});var twitterLink=new Link({"text":"<span>@therealgoby</span>",href:"http://twitter.com/therealgoby",fnc:function(){trackEvent([PAGE_ID,'widget-twitter'])}});this.content.appendChild(this.facebookNode);this.content.appendChild(this.twitterNode);this.twitterNode.appendChild(twitterLink);}
function WidgetPopular(params)
{Goby.get("scriptLoader").importStyle(Goby.conf('path.css')+"/widgets/popular.css");this._construct(params);}
WidgetPopular.prototype=new WidgetTab(null);WidgetPopular.prototype.display=function()
{this.content=this.drawContent('widget-lite');if(this.params.locations!=null)
this.load(this.params.locations);else
var request=this.makeRequest({object:this,method:"load"},{locationId:location.id});}
WidgetPopular.prototype.load=function(data)
{var node=document.createElement("ul");for(var i in data)
{var li=new LI();var link=new Link({text:data[i].label,fnc:function()
{if(this.widget.current===this)
{this.close();this.widget.current=null;}
else
this.open();}});link.widget=this;link.open=function()
{$(this.parentNode).addClass('sel');this.widget.setCurrent(this);this.p=document.createElement("p");this.p.innerHTML=this.data.content;var url=getFormattedUrl({locationName:this.data.label,locationType:'CITY'},'location');var linkWrapper=document.createElement("div");linkWrapper.className="moreResults";linkWrapper.appendChild(new Link({text:'<span>explore this area</span>',href:url}));this.parentNode.appendChild(this.p);this.p.appendChild(linkWrapper);this.p.appendChild(getClear());}
link.close=function()
{$(this.parentNode).removeClass('sel');this.parentNode.removeChild(this.p);}
link.li=li;link.data=data[i];li.appendChild(link);node.appendChild(li);}
this.content.appendChild(node);}
WidgetPopular.prototype.setCurrent=function(node)
{(this.current!=null?this.current.close():'');this.current=node;}
function WidgetSearchbox(params)
{Goby.get("scriptLoader").importStyle(Goby.conf('path.css')+params.style);this._construct(params);}
WidgetSearchbox.prototype=new WidgetTab(null);WidgetSearchbox.prototype.display=function()
{this.content=this.drawContent('widget');try
{this.form=new SearchboxForm({values:{},fields:this.params.fields},this);var searchbox=new Searchbox(this.form,this.form.inputs);this.form.display();}
catch(e)
{konsole.log(e);}
this.content.appendChild(this.form);}
function WidgetProperties(params)
{this.limit=20;this._construct(params);}
WidgetProperties.prototype=new WidgetTab(null);WidgetProperties.prototype.display=function()
{this.content=this.drawContent('widget-lite');if(this.params.properties&&this.params.properties[0])
{try
{this.i=0;var propertySets=this.params.properties;var listItems=[];for(var i in propertySets)
{for(var name in propertySets[i])
{if(this.limit<this.i)
break;var node=propertySets[i][name];if(node.value.join)
listItems.push(new LI({text:"<strong>"+node.name+":</strong>&nbsp;"+(node.value.join(',')).truncate(128,'...',true)}));else if(isString(node.value))
listItems.push(new LI({text:"<strong>"+node.name+":</strong>&nbsp;"+(node.value).truncate(128,'...',true)}));else
listItems.push(new LI({text:"<strong>"+node.name+":</strong>&nbsp;"+(node.value).toString().truncate(128,'...',true)}));this.i++;}}
var col1=new UL();col1.className='col1';var col2=new UL();col2.className='col2';var half=(listItems.length/2);for(var i in listItems)
{if(i<half)
col1.appendChild(listItems[i]);else
col2.appendChild(listItems[i]);}
this.content.appendChild(col1);this.content.appendChild(col2);}
catch(e)
{konsole.log(e);}
this.content.appendChild(getClear());}
else
{this.content.appendChild(new P({text:"there are no available properties"}));}}
function WidgetCategoryTree(params)
{params.title="categories";this._construct(params);this.id="categories";this.resultData=null;this.title="categories";}
WidgetCategoryTree.prototype=new WidgetTab(null);WidgetCategoryTree.prototype.id="categories";WidgetCategoryTree.prototype.title="categories";WidgetCategoryTree.prototype.prepend=true;WidgetCategoryTree.prototype.display=function()
{this.content=this.drawContent('widget-lite');var data=this.params;try
{var params={categoryID:data.category.id,categoryName:data.category.name,locationID:data.location.id,locationName:data.location.name,date:data.date.id}
this.makeRequest({object:this,'method':'load'},params,false);}
catch(e)
{konsole.log(e);}}
WidgetCategoryTree.prototype.load=function(data)
{var categoryNode=this.recurseCats(data.categories);this.content.appendChild(categoryNode);var category=data.category;var item=new Div({nodes:[new Link({text:"view all categories",fnc:function(){Goby.get('searchbox').getField('what').openPanel()}}),new Small({text:'&nbsp;&#187;'})]});this.content.appendChild(item);}
WidgetCategoryTree.prototype.recurseCats=function(data)
{var list=new UL({});for(var i in data)
{var category=data[i];if(category.count<1)
continue;if(category.id==Goby.get('category').getID())
var node=new Span({text:category.display_name,className:"sel"});else
var node=new Link({text:category.display_name,href:category.link});var item=new LI({nodes:[node]});if(category.children)
item.appendChild(this.recurseCats(category.children));list.appendChild(item);node=null;item=null;}
return list;}
var WidgetDateSearch=function(params){this.__run(params);}
WidgetDateSearch.prototype=Class({inherits:WidgetTab,vars:{title:'calendar'},methods:{display:function()
{var content=this.drawContent('widget');var params=this.params;if(!Goby.get('scriptLoader').importFile(Goby.conf('path.js')+"/lib/jquery-ui/",{async:true,remote:true,callback:{object:this,method:'load',pass:true}}))
this.load();},load:function()
{$(this.content).datepicker({inline:false,minDate:new Date(),gotoCurrent:true,onSelect:function(dateText,inst)
{var date=$(this).datepicker('getDate');var dateNode=new DateNode({id:(date.valueOf()/1000).toString(),name:dateText});var url=serializeLink({location:Goby.get('location'),category:Goby.get('category'),date:dateNode});window.open(url,"_self");}});}}});function WidgetShoutbox(params)
{this.id="shoutbox";this.params=params;return this._construct(params);}
WidgetShoutbox.prototype=new WidgetTab(null);WidgetShoutbox.prototype.display=function()
{this.content=this.drawContent('widget');this.list=new UL({className:'tabs'});this.content.id="shoutbox";this.params.container=this.content;this.params.tabList=this.list;this.resultMgr=new TabMgr(this.params,false);this.resultMgr.widget=this;this.resultMgr.params=this.params;if(this.params.currentTab)
{var tab=this.resultMgr.getTabByID(this.params.currentTab);if(tab)
{tab.params.results=this.params.results;this.resultMgr.displayTab(tab);}}}
WidgetShoutbox.prototype.displayTab=function(tabID)
{this.resultMgr.displayTab(this.resultMgr.getTabByID(tabID));}
function WidgetComments(params)
{return this._construct(params);}
WidgetComments.prototype=new WidgetTab(null);WidgetComments.prototype.display=function()
{this.content=this.drawContent('widget-lite');this.comments=[];var form=new CommentForm({values:this.params.fields},this)
this.counter=new Span({text:0,className:'comment-counter'});this.header.appendChild(this.counter);this.content.appendChild(form);this.content.appendChild(getClear());this.list=new UL({className:"comment-list"});this.content.appendChild(this.list);this.params.fields.action="list";this.makeRequest({object:this,'method':'loadComments'},this.params.fields,false);}
WidgetComments.prototype.getData=function()
{this.params.fields.action=null;return this.params.fields;}
WidgetComments.prototype.deleteComment=function(comment)
{var comments=[];while(this.comments.length>0)
{var tmp=this.comments.pop();if(tmp!==comment)
comments.push(tmp);}
this.comments=comments;this.updateCount(this.comments.length);}
WidgetComments.prototype.appendComment=function(comment,u,prep)
{this.comments.push(comment);if(u)
this.updateCount(this.comments.length);if(prep)
$(this.list).prepend(comment);else
$(this.list).append(comment);}
WidgetComments.prototype.updateCount=function(cnt)
{this.count=cnt;$(this.counter).text(cnt);}
WidgetComments.prototype.loadComments=function(data)
{this.content.setAttribute("count",(data?data.comments.length:0));if(data&&data.comments&&data.comments.length>0)
for(var i in data.comments)
this.appendComment(new CommentNode(data.comments[i],this),false,false);this.updateCount(this.comments.length);}
function WidgetEvents(params)
{this.results=[];this.resultData=[];this.perPage=5;this._construct(params);this.i=0;Goby.set('page',this);}
WidgetEvents.prototype=new WidgetDescriptions(null);WidgetEvents.prototype.resultsPerPage=5;WidgetEvents.prototype.display=function()
{this.resultArea=new UL({className:"events"});this.results=this.params.results;this.max=this.results.length;this.categories=this.params.categories;this.content=this.drawContent();this.content.appendChild(this.resultArea);this.content.appendChild(getClear());this.content.appendChild(this.renderNavigation());this.displayResults(0,this.resultsPerPage);try
{trackCustomVar([5,'venue',Goby.get("page").title,'3']);}
catch(e){konsole.log(Goby.get('page'));}}
WidgetEvents.prototype.getModule=function()
{return{misc:{services:true,googleImage:true}}}
WidgetEvents.prototype.displayResult=function(result,last)
{try
{var result=new Results.Event(result,this);var node=result.display();$(node).addClass(this.i%2==0?'data1':'data2');return node;}
catch(e)
{Goby.reportError(e);}}
WidgetEvents.prototype.getCategory=function(id)
{return this.categories[id];}
WidgetEvents.prototype.getImageMode=function()
{return this.params.imageType;}
WidgetResultSet=function(param0,param1,param2,param3){this.__run(param0,param1,param2,param3)};WidgetResultSet.prototype=Class({_construct:function(params,mgr)
{try
{window.setParameters();this.categorySet={};this.modules={};this.results=[];this.sponsored=[];this.init=false;this.category=new Category(params.category.id,params.category.name,params.category);this.location=new Location(params.location);this.date=new DateNode(params.date);this.widgetinfo=params.widgets;this.widgetData=params.widgetData;if(window.areDeclared())
$(this.getContainer()).addClass("loading");window.setResultSet(this);Goby.set('category',this.category);Goby.set('location',this.location);this.setFormat(params.format);this.params=params;}
catch(e)
{}},inherits:WidgetTab,methods:{getLocation:function(){return this.location;},display:function(params)
{konsole.log(params,'result level parameters');if(params.error)
{$("#entries .exception").remove();this.exception=new Exception(params.error);this.exception.display(this.getContainer());return;}
this.nodes={sort:document.createElement('fieldset'),pg:new UL({className:"pagination",id:"pgFoot"}),filters:$("#filterContent").get(0),pgHead:new UL({className:"pagination",id:"pgHead"})};this.params=params;this.nodes.sort.id="sort";this.nodes.filters.appendChild(this.nodes.sort);$('#pgFoot').replaceWith(this.nodes.pg);$("#pgHead").replaceWith(this.nodes.pgHead);$(this.nodes.filters).append(this.nodes.sort);var pag=params.pagination;this.filteredResults=pag.filteredResults;pag.headContainer=this.nodes.pgHead;this.ctrl={filters:new ResultCtrl.FilterMgr(this.nodes.filters,this.params.pagination.filterSet,this),sort:new ResultCtrl.SortMgr(this.nodes.sort,this.params.pagination.sort,this),page:new ResultCtrl.Pagination(this.nodes.pg,pag,this)};if(window.areDeclared())
{this.init=true;this.fetchResults(this.params);}
else
this.loadResults(this.params);this.displayWidgets(this.params);this.loadWidgets();},getResults:function(params)
{for(var i in params)
this.deserializeParameter(i,params[i]);this.fetchResults();},getCurrentPage:function()
{return window.getParameter('page').serialize();},getResultCount:function()
{return this.filteredResults;},getContainer:function()
{if(!this.container)
this.container=$("#entries").get(0);return this.container;},getWidgetAd:function()
{try{return this.widgets.getWidget('ad');}catch(e){}},fetchResults:function()
{$(this.getContainer()).removeClass("loading");this.request=new Ajax(Goby.conf('path.ajax')+'widget/results',{object:this,method:'loadResults'},{sort:this.getParameter('sort').serialize(),page:this.getCurrentPage(),categoryID:this.category.id,locationID:this.location.id,categoryName:this.category.name,locationName:this.location.name,date:this.date.id,lat:this.location.lat,lng:this.location.lng,filters:this.getParameter('filters').serialize(),action:'getResults',isTeaser:false,format:this.getMode(),encode:1},"GET",{useLoader:true,loaderParent:this.getContainer(),loaderClass:"loader_new_results",append:false,parentSize:true});},removeResults:function()
{if(this.sponsored&&this.sponsored.length>0)
while(this.results.length>0)
this.results.pop().remove();if(this.results.length>0)
while(this.results.length>0)
try{this.results.pop().remove();}catch(e){}
this.getMap()?this.getMap().resetMarkers():null;if(this.init)
$('.entry').remove();},setCoordinates:function()
{},triggerGACustomVars:function(resultData)
{if(resultData.sponsored.length)
{var partner=resultData.sponsored[0].facets.display_url.replace(/\.(com|net|org)/,"");trackCustomVar([5,partner+'_sponsored_result',partner+'_'+Goby.get('category').name,3]);}},getCategory:function(id){if(id&&this.categorySet[id]!=null){return this.categorySet[id]}else{return this.category;}},addCategories:function(data){for(var i in data)this.categorySet[i]=data[i];},addModules:function(modules){for(var i in modules.references)this.modules[i]=modules.instances[modules.references[i]];},getModule:function(id,type,display_url)
{if(this.modules[id]!=null)
{var result=this.modules[id];}
else
{return null;}
result.structure.alias="entryContent";var scaffold={alias:'resultTemplate',className:"entry"+(result.misc.className?" "+result.misc.className:'')}
scaffold.children={};scaffold.children['content']=result.structure;result.scaffold=scaffold;return result;},loadResults:function(data)
{this.removeResults();if(data.error||!data.entries)
{if(this.exception)
this.exception.close();this.filteredResults=0;this.ctrl.pg.selectPage(this.getCurrentPage());this.exception=new Exception(data.error);this.exception.display(this.getContainer());return;}
else if(this.exception!=null)
this.exception.close();this.request=null;this.addCategories(data.categories);this.addModules(data.modules);this.filteredResults=data.pagination.filteredResults;for(var id in this.ctrl)
this.ctrl[id].update(this.getParameter(id));if(this.init)
{for(var i in data.sponsored)
{if(data.sponsored[i].facets!=undefined)
{this.sponsored[i]=new SponsoredResult(data.sponsored[i],this);this.sponsored[i].display();}}
var map=this.getMap();if(map)
map.resetMarkers();var _result=null;for(var i in data.entries)
{var result=new Result(data.entries[i],this);result.showieIndex=parseInt(i)+1;result.prev=_result;this.results[i]=result;result.display();if(this.init&&this.getMap())
this.getMap().setPoint(result);var _result=result;}
var _result=null;if(map)
map.showAllPoints();}
else
{for(var i in data.entries)
{this.results[i]=new StaticResult(data.entries[i],this);this.results[i].showieIndex=parseInt(i)+1;this.results[i].display();if(this.init&&this.getMap())
this.getMap().setPoint(this.results[i]);}
if(data.sponsored.length)
{for(var i in data.sponsored)
{this.sponsored[i]=new StaticSponsoredResult(data.sponsored[i],this);this.sponsored[i].display();}}
this.init=true;}
this.triggerGACustomVars(this);},getParameter:function(id)
{return window.getParameter(id);},deserializeParameter:function(type,param)
{window.setParameter(new Parameter(type,null,param));},setFormat:function(format)
{if(!this.mode)
this.defaultFormat=this.mode;this.mode=format;switch(format)
{case"small":this.imageMode="resultSmall";break;case"default":default:this.imageMode="result";break;}},toggleMode:function(mode)
{var _mode=this.getMode();this.setFormat(mode);$(this.getContainer()).removeClass(_mode);$("#main").removeClass(_mode);$('#entry_sponsors').removeClass(_mode);$(this.getContainer()).addClass(mode);$("#main").addClass(mode);$('#entry_sponsors').addClass(mode);if(this.defaultFormat!="small"&&this.widgetData&&!this.category.isKeyword())
{this.toggleWidgets(mode,true);this.toggleWidgets(_mode,false);}
if(this.sponsored.length>0)
for(var i in this.sponsored)
this.sponsored[i].updatePhoto();for(var i in this.results)
this.results[i].updatePhoto();},getImageMode:function()
{return this.imageMode;},setPin:function(point)
{this.location.lat=point.lat();this.location.lng=point.lng();var params={"sort":new Parameter("sort",null,{label:'distance',dir:'ASC'}),'page':new Parameter("page",0)};window.bookmarkPage(params);var ser={};for(var i in params)
ser[i]=params[i].serialize();this.getResults(ser);},getMode:function(){return this.mode;},loadWidgets:function()
{this.widgetinfo.tabs.map.params={'results':this.results,'callback':{object:this,method:'setPin'},'type':'small','drag':this.widgetinfo.tabs.map.params.drag}
this.widgets=new WidgetMgr(this.widgetinfo);},getMap:function()
{try{return this.widgets.getWidget('map').getMap();}catch(e){}},displayWidgets:function()
{var filterToggle=new ToggleLink({className:"",id:"filterToggle",content:{on:'<span class="arrow"></span><span>show options</span>',off:'<span class="arrow"></span><span>hide options</span>'},init:(this.getMode()=="small"?true:false),widget:this,targetNode:this.nodes.filters,useSlide:true,callback:function(show)
{if(show)
$(this.targetNode).removeClass('hidden');else
$(this.targetNode).addClass('hidden');trackEvent([PAGE_ID,show?'show':'hide'+"_options"]);this.widget.toggleMode(show?'small':'default');}});$('#filterToggle').replaceWith(filterToggle);},toggleWidgets:function(mode,on)
{if(mode=="small"&&on&&this.widgetData)
{if(this.widgetssmall)
this.widgetssmall.show();else
{this.widgetssmall=WidgetLoader(this.widgetData,this.nodes.filters.id);this.widgetssmall.show();}}
else if(on)
{if(this.widgetssmall)
this.widgetssmall.hide();}}},_destruct:function()
{window.unsetResultSet(this);this.ctrl.pg._destruct();for(var i in this.nodes)
{this.nodes[i].remove();this.nodes[i]=null;}
for(var i in this)
this[i]=null;}});function WidgetActionMenu(params,result)
{this.result=result;this.params=params;var node=this._construct(params);this.container=params.container;return node;}
WidgetActionMenu.prototype=new WidgetTab(null);WidgetActionMenu.prototype.display=function()
{trackEvent(['flyout_panel','flyout_open']);var affiliateDiv=new Div({className:'affiliate'});var affiliate=new FacetAffiliate(this.result);if(affiliate.getValue())
affiliateDiv.appendChild(affiliate.render());var saveDiv=new Div({className:'save-node'});var saveModule=new BookmarkSelect({container:saveDiv,className:"selectGhost"},this.result);saveModule.addOption(null,{label:"SAVE",value:-1});saveModule.positionWidth=290;saveModule.display();this.content=new Div
({className:this.params.className,nodes:[new Div({className:"flyout_save",text:"",nodes:[saveDiv]}),this.renderSocialLists(),getClear(),affiliateDiv,getClear(),new Div({className:"rule"}),this.renderShare(),getClear()]});this.content=new BorderWrapper({node:this.content,className:"flyout_menu"});this.container.appendChild(this.content);};WidgetActionMenu.prototype.hide=function(node)
{$(this.content).hide();};WidgetActionMenu.prototype.show=function(node)
{if(this.content)
$(this.content).show();};WidgetActionMenu.prototype.share=function(option)
{switch(option.value)
{case"email":trackEvent([PAGE_ID,'share_email'],2);var body="I found "+option.title+" here on Goby.com:\n"
+option.url+"\n\n"
+"This site has lots of great ideas for things to do. You should check it out!";window.location="mailto:?subject="+encodeURIComponent(option.title)+"&body="
+encodeURIComponent(body);return false;break;case"facebook":postEntityToNewsFeed({link:option.url,title:option.title});return false;break;case"twitter":var href="http://twitter.com/?status="+encodeURIComponent("Check this out (via Goby.com): "+option.title+"\n"+option.url);window.open(href,"_blank");trackEvent([PAGE_ID,'share_twitter_old'],2);return true;break;default:break;}};WidgetActionMenu.prototype.renderShare=function(node)
{var container=new Div({className:"flyout_share"});var headline=new Head({type:3,text:"share"});var social=new UL
({className:"flyout_social",nodes:[new LI({className:"facebook",nodes:[new Link({widget:this,text:'<small class="icon"></small><span class="txt">facebook</span>',fnc:function(e)
{trackEvent(['flyout_panel','share_facebook_start']);this.widget.share({value:'facebook',title:this.widget.result.getFacet('title').value,url:Goby.conf('url.goby')+this.widget.result.getLink()});}})]}),new LI({className:"twitter",nodes:[new Link({widget:this,text:'<small class="icon"></small><span class="txt">twitter</span>',fnc:function(e)
{trackEvent(['flyout_panel','share_twitter_old']);this.widget.share({value:'twitter',title:this.widget.result.getFacet('title').value,url:Goby.conf('url.goby')+this.widget.result.getLink()});}})]}),new LI({className:"email",nodes:[new Link({widget:this,text:'<small class="icon"></small><span class="txt">email</span>',fnc:function(e)
{trackEvent(['flyout_panel','share_email']);this.widget.share({value:'email',title:this.widget.result.getFacet('title').value,url:Goby.conf('url.goby')+this.widget.result.getLink()});}})]})]});container.appendChild(headline);container.appendChild(social);return container;};WidgetActionMenu.prototype.renderSocialLists=function(node)
{var container=new Div({className:"flyout_socialLists"});var systemlist1=new Link({widget:this,text:"I want to go",fnc:function(e)
{trackEvent(['flyout_panel','want_to_go']);this.widget.saveToSocialLists({systemListID:2});}});var systemlist2=new Link({widget:this,text:"I'm going",fnc:function(e)
{trackEvent(['flyout_panel','going']);this.widget.saveToSocialLists({systemListID:3});}});var systemlist3=new Link({widget:this,text:"I've been",fnc:function(e)
{trackEvent(['flyout_panel','been']);this.widget.saveToSocialLists({systemListID:4});}});container.appendChild(systemlist1);container.appendChild(systemlist2);container.appendChild(systemlist3);return container;};WidgetActionMenu.prototype.saveToSocialLists=function(option)
{if(Goby.conf('USE_LOGIN'))
{if(!Goby.promptLogin({object:this,method:'show'},"bookmark"))
{return false;}
else
{this.saveToList(option.systemListID);}}}
WidgetActionMenu.prototype.saveToList=function(systemListID)
{var data={systemListID:systemListID,entityID:this.result.getID()};var request=new AjaxRequest(AJAX_PATH+'user/createSystemBookmark',{object:this,method:"finish"},data,"POST");request.makeRequest();}
WidgetActionMenu.prototype.finish=function(data)
{if(this.result&&this.result.type!="entity")
{flash(data.msg);Goby.get("loginToolbar").updateSaved();if(!data.error&&this.bookmarkList)
{this.bookmarkList.count++;}
if(data.link&&!data.error)
{}}}
var Portal={};PortalResultSet=function(params){return this.__run(params);}
PortalResultSet.prototype=Class({_construct:function(params)
{konsole.log(params);this.results=[];this.sponsored=[];this.init=false;this.params=params;this.mgr=params.mgr;this.link=params.link;this.id=params.id;params.date=(params.date?params.date:{id:''});params.date.id="next 7 days";this.category=new Category(params.category.id,params.category.name,params.category);this.date=new DateNode(params.date);},inherits:WidgetResultSet,vars:{mode:'teaser',categorySet:{}},methods:{display:function()
{this.container=document.createElement("div");this.container.id="ResultTab-"+this.params.category.id;this.container.className='portalItem';this.ctrl={sort:new ResultCtrl.SortMgr(null,{"date":{"label":"date","method":"date","dir":"ASC","facet":"date","isDefault":true}},this)};if(this.params.entries)
this.loadResults(this.params);else
this.getResults({});return this.container;},close:function()
{if(this.hasSynopsis())
this.synopsis.remove();try
{$(this.link.parentNode).removeClass("sel");this.mgr.getContainer().removeChild(this.getContainer());}
catch(e)
{}
this.removeResults();this.dateMenu.remove();this.container=null;this._destruct();},fetchResults:function()
{var container=this.getMap()?this.getMap().getContainer():this.getContainer();if(this.mgr.getLocation)
this.location=this.mgr.getLocation();this.request=new Ajax(Goby.conf('path.ajax')+'widget/results',{object:this,method:'loadResults'},{page:0,categoryID:this.category.id,locationID:this.location.id,categoryName:this.category.name,locationName:this.location.name,date:this.date.id,mode:'static',action:'getResults',limit:5,isTeaser:true,format:this.getMode(),encode:1},"GET",{useLoader:true,loaderParent:container,loaderClass:this.getMap()?"loader_map":"loader_widget",append:false,parentSize:this.getMap()?true:false});},loadResults:function(data)
{var last=null;this.request=null;for(var i in data.entries)
this.results.push(new Results.Teaser(data.entries[i],this));this.results=this.ctrl.sort.updateResults(this.results);var totalResults=this.results.length;for(i=0;i<totalResults;i++)
{var r=this.results[i];r.showieIndex=parseInt(i)+1;r.prev=last;this.results.push(r);r.display();$(r.resultTemplate).fadeIn(100*parseInt(i));if(this.getMap())
this.getMap().setPoint(r);var last=r;}
this.renderDateMenu();try{this.getMap()?this.getMap().showAllPoints():null;}catch(e){Goby.reportError(e);}},getMap:function(){return(this.mgr.getMap)?this.mgr.getMap():null;},renderDateMenu:function()
{var dateMenu=document.createElement("ul");for(var i in this.params.dates)
{var location=this.mgr.getLocation(true);var date=this.params.dates[i];date.start=0;date.end=0;var li=new LI({id:"result-datelink-"+date.id});var a=new Link({href:serializeLink({location:location,category:this.params.category,date:new DateNode(date)}),text:(date.id=="anytime"?"<span>all nearby <strong>"+this.params.title+"</strong></span>":"<span>"+date.text+"</span>")});li.appendChild(a);dateMenu.appendChild(li);}
this.dateMenu=new Div({className:'date-list'});this.dateMenu.appendChild(dateMenu);try{this.mgr.updateDateMenu(this.dateMenu);}
catch(e){}},getType:function()
{return(Goby.get('pageInfo').pageID=="entity")?"whats-nearby":"result";}},_destruct:function()
{this.container=null;this.content=null;this.removeResults();}});WidgetBookmarkSet=function(param0,param1,param2,param3){this.__run(param0,param1,param2,param3)};WidgetBookmarkSet.prototype=Class({_construct:function(params)
{try
{window.setParameters();this.results=[];this._results=new List();this.init=false;for(var i in params)
{if(i=="widgetinfo")
this.widgets=params[i];else if(i=="location")
this.location=new Location(params[i]);else
this[i]=params[i];}
this.widgetinfo=params.widgets;this.user=new Profile(params.user);if(window.areDeclared())
$(this.getContainer()).addClass("loading");if(params.widgets2)
this.widget_=WidgetLoader(params.widgets2,"main");this.setFormat(params.format);this.params=params;}
catch(e)
{Goby.reportError(e);}},vars:{sortFormat:'select',mode:'default',_results:[],result:'bookmark'},inherits:WidgetResultSet,methods:{addModules:function(){},addCategories:function(){},isAggregate:function()
{return(this.getID()==Goby.conf('bookmarks.all.id')||this.getID()==Goby.conf('bookmarks.all.slug')?true:false);},getID:function()
{return this.id;},getUser:function()
{return this.user;},isOwner:function(user)
{return this.isUser(user);},isMine:function()
{return this.isOwner(Goby.get("customer"));},isUser:function(user)
{return(user!=null&&this.getUser().getID()==user.getID()?true:false);},fetchResults:function(params){this.loadResults(params);},getResults:function(params)
{$(this.getContainer()).removeClass('loading');this.removeResults();for(var i in params)
this.deserializeParameter(i,params[i]);var currentResults=this.getResultSet().toStack();currentResults=this.ctrl.filters.updateResults(currentResults);currentResults=this.ctrl.sort.updateResults(currentResults);currentResults=this.ctrl.page.updateResults(currentResults);_result=null;for(var i in currentResults)
{currentResults[i].showieIndex=parseInt(i)+1;currentResults[i].display();currentResults[i].prev=_result;this.getMap()?this.getMap().setPoint(currentResults[i]):null;_result=currentResults[i];}
_result=null;this.results=currentResults;this.getMap()?this.getMap().showAllPoints():null;for(var id in this.ctrl)
this.ctrl[id].update(this.getParameter(id));},loadResults:function(data)
{if(data.error||!data.entries)
{if(this.exception)
this.exception.close();this.filteredResults=0;this.pg.selectPage(this.getCurrentPage());this.exception=new Exception(data.error);this.exception.display(this.getContainer());return;}
else if(this.exception!=null)
this.exception.close();this.request=null;this.filteredResults=data.pagination.filteredResults;var map=this.getMap();for(var i in data.entries)
{var result=new Results.Bookmark(data.entries[i],this);this._results.add(result.getID(),result);}
this.getResults(window.serializeParameters());},getResultSet:function()
{return this._results;},getResultCount:function()
{return this.ctrl.filters.getResultCount();},erase:function(){},edit:function()
{var popup=Goby.get("loginToolbar").displayPopup(false,null);var form=new BookmarkListForm({values:{listID:this.getID(),description:this.description,listName:this.title}},this);form.display();popup.appendChild(form);popup.popup.recalcPosition();form.popup=popup.popup;},exit:function(data)
{if(data.valid)
{$(this.getContainer()).fadeOut(500);window.location=data.url;}
else
{flash(data.msg?data.msg:"Error deleting bookmark list.");trackEvent([PAGE_ID,'delete_list_failed']);}},destroy:function(node)
{var bookmarkSet=Goby.get("bookmarkSet");var request=new AjaxRequest('bookmark_lists.php',{object:this,method:"exit"},{action:"destroy",listID:bookmarkSet.getID()},"POST");request.makeRequest({useLoader:true,className:"loader_bookmark_delete",loaderTxt:"deleting...",loaderParent:node});},removeResult:function(result)
{this._results.remove(result.getID());this.ctrl.page.selectPage(this.getParameter('page').serialize());},toggleMode:function(mode)
{if(mode==this.getMode())
return;var _mode=this.getMode();this.setFormat(mode);this.nodes.reg={toolbar:$("#resultToolbar"),filters:$("#filters"),slide:$("#slide-wrapper")}
if(mode=="reorder")
{for(var i in this.ctrl)
this.ctrl[i].hide();this.widgets.hide();this.widget_.hide();if(navigator.isIE())
$("#list-actions").hide();else
$("#list-actions").fadeOut(200,'easeOutSine');if(!Goby.get('scriptLoader').importFile(Goby.conf('path.js')+"/lib/jquery-ui/",{async:true,remote:true,callback:{object:this,method:'reorderResults',pass:true}}))
this.reorderResults();}
else
{this.widgets.show();this.widget_.show();if(navigator.isIE())
$("#list-actions").show();else
$("#list-actions").fadeIn(200,'easeOutSine');this._results.reset();while(this._results.valid())
{this._results.getCurrent().remove();this._results.next();}
for(var i in this.ctrl)
this.ctrl[i].show();for(var i in this.nodes.reorder)
this.nodes.reorder[i].remove();this.getResults();}},reorderResults:function()
{this.removeResults();this.sortable=$(this.getContainer()).sortable();this._results.reset();var i=1;while(this._results.valid())
{var result=this._results.getCurrent();result.showieIndex=i++;result.display();if(index==this._results.length-1)
result.setLast();this._results.next();}
this.nodes.reorder={info:new Div({id:"instructions",nodes:[new P({text:"<span>drag and drop the bars to re-order the bookmarks in your lists...<br /><br />when you're h-a-p-p-y click done!</span>"})]}),toolbar:new Div({className:'resultToolbar',id:"reorderToolbar",nodes:[new UL({nodes:[new LI({nodes:[new Link({text:"<span>done</span>",fnc:function(){this.widget.saveOrder(this)},widget:this})],className:'button-commit'}),new LI({className:'button-cancel',nodes:[new Link({text:"cancel",fnc:function(){this.widget.toggleMode('default')},widget:this})]})],id:"commit-menu"}),new Head({text:"<span>re-order bookmarks</span>",type:2})]})};$("#sidebar").append(this.nodes.reorder.info);$("#header-info-content").append(this.nodes.reorder.toolbar);$("div.ui-sortable").bind('mouseleave',function(){document.body.style.cursor="auto";});$("div.ui-sortable div.draggable").bind('mouseover',function(){document.body.style.cursor="move";});},saveOrder:function(node)
{var container=this.getContainer();var orderList=[];var order=0;this._tmpList=new List();for(var i=0;i<container.childNodes.length;i++)
{if(container.childNodes[i].result==null)
continue;var result=container.childNodes[i].result;result.tmp_order=order++;orderList.push(result.getID());this._tmpList.add(result.getID(),result);}
var data={listID:this.getID(),bookmarks:orderList};this.getMap().reformat({type:'small'});var request=new AjaxRequest(AJAX_PATH+"bookmarkList/reorder",{object:this,method:"commitOrder"},data,"POST");request.makeRequest({loaderParent:this.getContainer(),loaderClass:"loader_new_results",useLoader:true,parentSize:true});},commitOrder:function(data)
{if(data.valid)
{this._results.clear();this._results=this._tmpList;while(this._results.valid())
{var result=this._results.getCurrent();if(result.tmp_order!=null)
result.score=this._results.length-result.tmp_order;this._results.next();}
if(this.sortable!=null)
this.sortable.sortable("destroy");this.toggleMode('default');}
else
flash('there was a problem reordering your fun feed, please try again');}}});WidgetFunfeedSet=function(param0,param1,param2,param3){this.__run(param0,param1,param2,param3)};WidgetFunfeedSet.prototype=Class({inherits:WidgetResultSet,_construct:function(params)
{try
{window.setParameters(['section','page']);this.results=[];this._results=new List();this.subscriptions=[];this._subscriptions=new List();this._subscriptionHash=new List();this.init=false;this.forceFetch=false;if(params.pagination.defaultLocation)
this.defaultLocation=new Location(params.pagination.defaultLocation);for(var i in params)
{if(i=="widgetinfo")
this.widgets=params[i];else
this[i]=params[i];}
this.widgetinfo=params.widgetinfo;this.user=new Profile(params.user);window.setResultSet(this);if(window.areDeclared())
$(this.getContainer()).addClass("loading");this.setFormat(params.format);this.params=params;this.nodes={headers:false};}
catch(e)
{Goby.reportError(e);}},vars:{compiledLink:'#section=funfeed',sortFormat:'select',mode:'default',_results:[],result:'funfeed',personalizeSections:{add:{label:'add feeds',options:[{icon:'URL',title:'events / places',description:'personalize with your favorite categories, from hiking trails to live music',method:'addEvents',alias:'events'},{icon:'URL',title:'venues',description:'track all the events going on at your favorite venues',method:'addVenues',alias:'venue'},{icon:'URL',title:'music artists / bands',description:'add your favorite artist and get alerts when they\'re in town',method:'addArtist',alias:'artist'}]},manage:{label:'manage feeds',options:[{icon:'URL',title:'reorder /  delete',description:'manage the order that your feeds are displayed in',method:'reorder',alias:'reorder'},{icon:'URL',title:'default location',description:'set the default location for your recommendations',method:'changeLocation',alias:'location'}]},notifications:{label:'notifications',options:[{icon:'URL',title:'notifications',description:'manage your email and app notification settings',method:'notifications',alias:'notifyapp'}]}},lastFFSet:false},methods:{display:function(results)
{if(results.error)
{$("#entries .exception").remove();this.exception=new Exception(results.error);this.exception.display(this.getContainer());return;}
if(this.lastFFSet)
$(this.getContainer()).html(this.lastFFSet)
this.resultSet=results;if(window.getParameter('section').serialize()=='funfeed')
{this.init=true;this.fetchResults(this.params);this.forceFetch=false;}
else if(!window.areDeclared())
{this.loadResults(this.params);}else{this.processResults(this.params);}
this.loadWidgets();this.displayWidgets(this.params);},addModules:function(){},addCategories:function(){},getID:function()
{return this.id;},getUser:function()
{return this.user;},isOwner:function(user)
{return this.isUser(user);},isMine:function()
{return this.isOwner(Goby.get("customer"));},isAggregate:function()
{return false;},isUser:function(user)
{return(user!=null&&this.getUser().getID()==user.getID()?true:false);},getResultSet:function(resultType)
{if(resultType=='venue')
return this._venues;else
return this._results;},getResultCount:function(resultType)
{if(resultType=='venue')
return this.venues.length;else
return this.results.length;},fetchResults:function()
{$(this.getContainer()).removeClass("loading");this.request=new Ajax(Goby.conf('path.ajax')+'widget/funfeed',{object:this,method:'loadResults'},{action:'getFeed',customer_id:this.params.profile.customer_id,date:'next-7-days',locationId:this.defaultLocation.getID()},"GET",{useLoader:true,loaderParent:this.getContainer(),loaderClass:"loader_new_results",append:false,parentSize:true});},fetchFeedData:function()
{this.request=new Ajax(Goby.conf('path.ajax')+'widget/funfeed',{object:this,method:'processResults'},{action:'getFeed',date:'next-7-days',locationId:this.defaultLocation.getID()},"GET",{useLoader:false,loaderParent:this.getContainer(),loaderClass:"loader_new_results",append:false,parentSize:true});},getResults:function(params)
{for(var i in params)
this.deserializeParameter(i,params[i]);if(params.section!=null&&this.getMode()!=params.section){this.toggleMode(params.section);return false;}else if(this.getMode()=='addVenues'&&params.page!=null){if(params.page>0)
this.displayNearbyVenues(params.page);else
this.toggleMode(params.section,true);return false;}else if(this.getMode()!='funfeed'){return false;}
this.clearContainers({sidebar:false});$(this.getContainer()).removeClass('loading');this.removeResults();var currentSubscriptions=this.getSubscriptionsSet().toStack();var currentResults=[];var allResults=[];_result=null;for(var i in currentSubscriptions)
{currentSubscriptions[i].display();currentResults=currentSubscriptions[i].getResults().toStack();for(var i in currentResults)
{currentResults[i].showieIndex=0;currentResults[i].prev=_result;_result=currentResults[i];}
allResults=allResults.concat(currentResults);}
_result=null;this.subscriptions=currentSubscriptions;this.results=allResults;this.getMap()?this.getMap().showAllPoints():null;$('#feed-count').html(this.resultCount+' results near '+this.defaultLocation.getFullName());this.lastFFSet=$(this.getContainer()).html();},processResults:function(data)
{if(data.error||!data.entries)
{if(this.exception)
this.exception.close();this.filteredResults=0;this.exception=new Exception(data.error);this.exception.display(this.getContainer());return;}
else if(this.exception!=null)
this.exception.close();this.request=null;this.subscriptions=[];this._subscriptionHash=new List();this._subscriptions=new List();var _childSubscriptionHash=new List();this.resultCount=data.pagination.resultCnt;for(var i in data.entries)
{var subscription=new Results.FunfeedSubscription(data.entries[i],this,false);var built=subscription.buildSubscription(data.entries[i]);if(built)
{_childSubscriptionHash=new List();for(var x in subscription.children)
{if(subscription.children[x].active=true)
_childSubscriptionHash.add(subscription.children[x].id,subscription.children[x]);}
this._subscriptionHash.add(subscription.id,{subscription:subscription,children:_childSubscriptionHash});this.subscriptions.push(subscription);this._subscriptions.add(i,subscription);if(subscription.type=='artists')
{this.artistChildren=[];this._artistChildren=new List();for(var i in subscription.children)
{var entertainer=new Results.FunfeedSubscription(subscription.children[i],this,false);var subBuilt=entertainer.buildEntertiner(subscription.children[i]);if(subBuilt)
{this.artistChildren.push(entertainer);this._artistChildren.add(i,entertainer);}}}}}},loadResults:function(data)
{this.processResults(data);var map=this.getMap();$(".return_funfeed").hide();this.getResults(window.serializeParameters());},getSubscriptionsSet:function()
{return this._subscriptions;},getMode:function(){return(this.mode==undefined)?this.defaultFormat:this.mode;},defaultFormat:'funfeed',toggleMode:function(mode,force)
{force=(force==null)?false:force;if(mode==this.getMode()&&!force)
return;var _mode=this.getMode();this.setFormat(mode);var params={"section":new Parameter("section",null,mode)};window.setParameter(params.section);this.compiledLink=window.compileLink(params,null);window.bookmarkPage(params);this.nodes.reg={toolbar:$("#resultToolbar"),filters:$("#filters"),slide:$("#slide-wrapper")};this.clearContainers();try{this.widgets.hide();}catch(e){}
$("#filterContent").hide();if(this.sortable!=null)
this.sortable.sortable("destroy");$(".personalize_funfeed").hide();$(".return_funfeed").show();$(this.getContainer()).removeClass("loading");switch(mode)
{case"personalize":$('#title').html('personalize fun feed');$('#title').addClass('personalize');$(this.getContainer()).addClass('personalize');this.personalize();break;case"addEvents":$('#title').html('add events / places');$('#title').addClass('personalize');this.addEventPlaces();break;case"addVenues":$('#title').html('venues near '+this.defaultLocation.getFullName());$('#title').addClass('personalize');this.addVenues();break;case"addArtist":$('#title').html('music artist / band');$('#title').addClass('personalize');this.addArtist();break;case"changeLocation":$('#title').html('default location');$('#title').addClass('personalize');this.changeLocation();break;case"notifications":$('#title').html('notifications');$('#title').addClass('personalize');this.notifications();break;case"reorder":$('#title').html('reorder / delete');$('#title').addClass('personalize');if(!Goby.get('scriptLoader').importFile(Goby.conf('path.js')+"/lib/jquery-ui/",{async:true,remote:true,callback:{object:this,method:'reorderResults',pass:true}}))
this.reorderResults();break;default:$('#title').html('goby <strong>fun feed</strong>');$('#title').removeClass('personalize');$(".personalize_funfeed").show();$(".return_funfeed").hide();this.widgets.show();$("#filterContent").show();this.display(this.resultSet);break;}},notifications:function()
{var customer=Goby.get('customer');this.emailForm=new EmailForm({id:'emailNotifyform',values:{email_feed:customer.email_feed.toString()},list:null},this);this.appAlertForm=new AppNotifyForm({id:'appNotifyform',values:{funfeed_alert:(customer.mobile_feed.toString()=='false')?'0':customer.funfeed_alert_day.toString()},list:null},this);this.nodes.notifications={email:new Div({id:"emailNotifications",nodes:[new Div({className:'resultToolbar',nodes:[new Div({className:'icon'}),new Head({text:'email',className:'email-notification-header'}),new UL({nodes:[new LI({nodes:[new Link({text:"<span>save</span>",href:'#section=notifications',fnc:function(){this.widget.saveEmailNofitications(this)},widget:this})],className:'button-commit'})],id:"commit-menu"})]}),new Div({className:'alertMessage',text:'receive a weekly email of your fun feed recommendations'}),this.emailForm]}),appalert:new Div({id:"appNotifications",nodes:[new Div({className:'resultToolbar',nodes:[new Div({className:'icon'}),new Head({text:'app alerts',className:'app-notification-header'}),new UL({nodes:[new LI({nodes:[new Link({text:"<span>save</span>",href:'#section=notifications',fnc:function(){this.widget.saveAppNofitications(this)},widget:this})],className:'button-commit'})],id:"commit-menu"})]}),new Div({className:'alertMessage',text:"select the day you'd like to receive an alert on your phone of your fun feed recommendations"}),this.appAlertForm]})};this.emailForm.display();this.appAlertForm.display();$("#header-info-content").append(this.nodes.notifications.email);$("#header-info-content").append(this.nodes.notifications.appalert);$("#header-info-content").show();},saveEmailNofitications:function(node)
{var data={email_feed:node.widget.emailForm.getEmailValue()};var callback={"object":this,"method":"notificationSaved"};var adtlParams={useLoader:false,append:false};this.request=new AjaxRequest(AJAX_PATH+"user/update",callback,data);this.request.makeRequest(adtlParams);},saveAppNofitications:function(node)
{if(node.widget.appAlertForm.getAppAlertValue()==0)
var data={mobile_feed:0};else
var data={mobile_feed:1,funfeed_day_alert:node.widget.appAlertForm.getAppAlertValue()};var callback={"object":this,"method":"notificationSaved"};var adtlParams={useLoader:false,append:false};this.request=new AjaxRequest(AJAX_PATH+"funfeed/setMobileAlert",callback,data);this.request.makeRequest(adtlParams);},notificationSaved:function(response)
{Goby.set('customer',new Profile(response.customer));flash("Your alert settings have successfully been updated!");},changeLocation:function()
{this.nodes.changeLocation={toolbar:new Div({nodes:[new Div({className:'locationMsg',text:"We'll send you personalized recommendations around your selected city."}),new Div({className:'resultToolbar',id:"showDefaultLocation",nodes:[new Div({className:'textbox_container',id:'',text:'<label id="search_where_label" for="venue_where_box" class="search_label">Location: </label>'}),new Div({className:'textbox_container',id:'',text:'<span class="defaultloc">'+this.defaultLocation.getFullName()+'</span>'}),new Div({nodes:[new Link({href:'#section=changeLocation',text:"edit",fnc:function(){$('#showDefaultLocation').hide();$('#searchDefaultLocation').show();},widget:this})],className:'edit-link'})]}),new Div({className:'resultToolbar',id:"searchDefaultLocation",display:'none',nodes:[new Div({className:'textbox_container',id:'changeLocation_container',text:'<form name="changeDefaultLoc" action="#section=changeLocation" method="post"><label id="search_where_label" for="venue_where_box" class="search_label">Location: </label><div class="textbox asleep clearfix"><div class="textbox_left_tab"></div><input type="text" value="" id="venue_where_box" name="locationName" /><div class="textbox_delete"></div><a class="hidden" href="#section=changeLocation" id="link_venue_where"></a><input type="hidden" id="venue_where_id" name="locationID" value=""  title="location" /><div class="textbox_right_tab"></div></div><input type="hidden" id="venue_where_type" name="venue_where_type" value=""  title="inert" />'}),new UL({nodes:[new LI({nodes:[new Link({href:'#section=changeLocation',text:"<span>set default location</span>",fnc:function(){this.widget.preSearchDefaultLocation(this);},widget:this})],className:'button-commit'}),new LI({className:'button-cancel',nodes:[new Link({text:"cancel",fnc:function(){$('#showDefaultLocation').show();$('#searchDefaultLocation').hide();},widget:this,href:'#section=changeLocation'})]})],id:"commit-menu"})]})]})};$("#header-info-content").append(this.nodes.changeLocation.toolbar);$("#header-info-content").show();this.location_searchbox=new Searchbox((document.forms.changeDefaultLoc!=null?document.forms.changeDefaultLoc:window.parent.document.forms.changeDefaultLoc),{where:new FFWhereVenue(document.getElementById(browseMap.venueWhere.input),{})});this.location_searchbox.fields.where.setID(this.defaultLocation.getID());this.location_searchbox.fields.where.setValue(this.defaultLocation.getFullName());this.location_searchbox.fields.where.setLocationType(this.defaultLocation.locationType);},preSearchDefaultLocation:function()
{if(this.location_searchbox.getLocationID()>0)
{this.setDefaultLocation({bypass:true});}
else
{var callback={"object":this,"method":"setDefaultLocation"};var adtlParams={useLoader:false,append:false};var data={locationID:0,locationName:$(this.location_searchbox.fields.where).val(),locationType:undefined};this.request=new AjaxRequest(AJAX_PATH+"search/validate",callback,data);this.request.makeRequest(adtlParams);}},setDefaultLocation:function(params)
{if(params.bypass==true)
{var data={action:'setLocation',locationId:this.location_searchbox.getLocationID()};}
else
{var data={action:'setLocation',locationId:params.where.node.node_id};$(this.location_searchbox.fields.where).val(params.where.node.node_value);}
this.request=new Ajax(Goby.conf('path.ajax')+'widget/funfeed',{object:this,method:'updateDefaultLocation'},data,"GET",{useLoader:true,loaderParent:this.getContainer(),loaderClass:"loader_new_results",append:false,parentSize:true});},updateDefaultLocation:function()
{this.defaultLocation=new Location({'id':this.location_searchbox.fields.where.getID(),'name':this.location_searchbox.fields.where.getValue(),'type':this.location_searchbox.fields.where.getLocationType()});this.clearContainers();this.changeLocation();},addArtist:function()
{this.artistForm=new ArtistForm({id:'artistForm',values:{},widget:this},this);this.nodes.addArtist={toolbar:new Div({className:'resultToolbar',id:"addArtistSearchbar",nodes:[this.artistForm]})};$("#header-info-content").append(this.nodes.addArtist.toolbar);$("#header-info-content").show();this.artistForm.display();this.artistForm.artistName.deletebox.href=this.compiledLink.hash;this._artistChildren.reset();while(this._artistChildren.valid())
{var entertainer=this._artistChildren.getCurrent();entertainer.displayArtists(false);if(index==this._artistChildren.length-1)
entertainer.setLast();this._artistChildren.next();}},addVenues:function()
{this.venueForm=new VenueForm({id:'venueForm',values:{},widget:this},this);this.nodes.addVenues={toolbar:new Div({nodes:[new Div({className:'resultToolbar',id:"addVenueSearchbar",nodes:[this.venueForm]})]})};$("#header-info-content").append(this.nodes.addVenues.toolbar);$("#header-info-content").show();this.venueForm.display();this.venueForm.fields.venueLocationSearch.updateValues({node_id:this.defaultLocation.getID(),node_value:this.defaultLocation.getFullName(),type:this.defaultLocation.locationType});this.venueForm.fields.venueFilter.setValue('all');this.venueForm.fields.venueLocationSearch.deletebox.href=this.compiledLink.hash;this.venueForm.fields.venueFilter.deletebox.href=this.compiledLink.hash;this.venueForm.searchVenue(false);},searchVenueLocation:function(params)
{var filterValue=this.venueForm.fields.venueFilter.getValue();if(filterValue=='all')
filterValue=false;if(params.bypass==true)
{var data={action:'getNearbyVenues',locationId:this.venueForm.fields.venueLocationSearch.getID(),filter:filterValue};}
else
{var data={action:'getNearbyVenues',locationId:params.where.node.node_id,filter:filterValue};}
this.request=new Ajax(Goby.conf('path.ajax')+'widget/funfeed',{object:this,method:'processNearbyVenues'},data,"GET",{useLoader:false,append:false,parentSize:true});},processNearbyVenues:function(data)
{var location=this.venueForm.fields.venueLocationSearch.getValue();$('#title').html('venues near '+location+'');this._venues=new List();this.venues=[];if(data['com.byledge.database.containers.Venue'])
{if(data['com.byledge.database.containers.Venue'].entityId)
{var venue=new Results.Venue(data['com.byledge.database.containers.Venue'],this);this._venues.add(i,venue);this.venues.push(venue);}else{for(var i in data['com.byledge.database.containers.Venue'])
{var venue=new Results.Venue(data['com.byledge.database.containers.Venue'][i],this);this._venues.add(i,venue);this.venues.push(venue);}}}
this.nodes.addVenues={pg:new UL({className:"pagination",id:"pgFoot"})};var pag={filteredResults:this._venues.length,totalResults:this._venues.length,resultsPerPage:10,resultType:'venue'};this.ctrl={page:new ResultCtrl.Pagination(this.nodes.addVenues.pg,pag,this)};this.ctrl.page.selectPage(0);this.ctrl.page.renderPages();this.displayNearbyVenues(0);if(this.ctrl.page.getPageCnt()>1)
{$('#pgFoot').replaceWith(this.nodes.addVenues.pg);$('#pgFoot').show();}
else
{$('#pgFoot').replaceWith('<ul id="pgFoot" class="pagination"></ul>');$('#pgFoot').hide();}
var params={section:new Parameter("section",null,this.getMode()),page:new Parameter("page",null,0)};window.setParameter(params.section);window.setParameter(params.page);window.compileLink(params,null);window.bookmarkPage(params);},displayNearbyVenues:function(page)
{this.ctrl.page.renderPages();var currentResults=this.getResultSet('venue').toStack();currentResults=this.ctrl.page.updateResults(currentResults);$(this.getContainer()).empty();if(currentResults.length>0)
{for(var i in currentResults)
{currentResults[i].display();}}
else
{var emptyResponse=new P({text:'no venues near this location'});this.getContainer().appendChild(emptyResponse);}},addEventPlaces:function()
{this.request=new Ajax(Goby.conf('path.ajax')+'widget/funfeed',{object:this,method:'loadCategories'},{action:'getCategories'},"GET",{useLoader:true,loaderParent:this.getContainer(),loaderClass:"loader_new_results",append:false,parentSize:true});this.nodes.addeventplaces={info:new Div({id:"instructions",className:"addevent",nodes:[new Head({text:"DID YOU KNOW?"}),new P({text:"You can customize each of your feeds with<br/>sub-categories that match your personal interests."}),new P({text:"examples of different <strong>live music</strong> feeds:"}),new Div({text:'<span class="num"></span><strong>live music</strong><p>hip hop<br/>electronic<br/>rock and roll<br/>indie</p>',className:'opt1'}),new Div({text:'<span class="num"></span><strong>live music</strong><p>classical<br/>jazz<br/>blues<br/>world</p>',className:'opt2'})]}),toolbar:new Div({className:'resultToolbar',id:"addEventToolbar",nodes:[new UL({nodes:[new LI({nodes:[new Link({text:"<span>done</span>",fnc:function(){this.widget.saveAddEvents(this)},widget:this})],className:'button-commit'})],id:"commit-menu"})]}),instructions:new Div({className:'resultToolbar',id:"addEventInstructions",nodes:[new UL({nodes:[new LI({nodes:[new Link({text:"<span>done</span>",fnc:function(){this.widget.saveAddEvents(this)},widget:this})],className:'button-commit'})],id:"commit-menu"})]})};$('#slide-wrapper').append(this.nodes.addeventplaces.info);$('#slide-wrapper').show();},loadCategories:function(data)
{this.categories=[];this._categories=new List();for(var i in data.Category)
{var category=new Results.FunfeedSubscription(data.Category[i],this);category.buildCategory(data.Category[i]);if(category)
{this.categories.push(category);this._categories.add(i,category);}}
this.getContainer().appendChild(this.nodes.addeventplaces.instructions);this._categories.reset();while(this._categories.valid())
{var category=this._categories.getCurrent();category.displayAddEvents(false);if(index==this._categories.length-1)
category.setLast();this._categories.next();}
this.getContainer().appendChild(this.nodes.addeventplaces.toolbar);},saveAddEvents:function(node)
{this.forceFetch=true;var container=this.getContainer();var addFeeds={};var removeFeeds=[];var parentID;var childID;var feedSet=node.widget;$('input.feedToggle').each(function(index){if($(this).is(':checked'))
{parentID=$(this).val();addFeeds[parentID]=[];$('input[name='+this.name+']:checked').each(function(index){childID=$(this).val();if(childID!=parentID)
addFeeds[parentID].push(childID);});if(addFeeds[parentID].length==0)
addFeeds[parentID]=[parentID];}
else
{parentID=$(this).val();if(feedSet.hasSubscription(parentID))
{removeFeeds.push(this.settings.subscription.getFeedID());}}});var data={toAdd:addFeeds,toRemove:removeFeeds};var request=new AjaxRequest(AJAX_PATH+"funfeed/addEvents",{object:this,method:"commitAddEvent"},data,"POST");request.makeRequest({loaderParent:this.getContainer(),loaderClass:"loader_new_results",useLoader:true,parentSize:true});},commitAddEvent:function(data)
{if(data.valid)
{this.fetchFeedData();this.clearContainers();this.toggleMode('personalize');}
else
flash('there was a problem sorting your list, try again');},personalize:function()
{this.removeResults();var personalizeNode=new Div({className:'personalizeJump',id:"personalizeJump"});var section='';var personalizeSection='';var subSection='';for(var i in this.personalizeSections)
{section=this.personalizeSections[i];personalizeSection=new Div({className:'personalizeSection',nodes:[new Head({text:section.label,type:2})]});var last='';for(var i in section.options)
{last=(section.options.length==parseInt(i)+1.0)?' last':'';subSection=new Div({className:'subSection '+section.options[i].alias+last,nodes:[new Div({className:'icon'}),new Div({className:'sectionInfo',nodes:[new Div({className:'editbtn',action:section.options[i].method,onclick:function(){Goby.get("funfeedSet").toggleMode($(this).prop('action'));},nodes:[new Span({text:'edit'})]}),new Head({text:section.options[i].title,type:3,action:section.options[i].method,onclick:function(){Goby.get("funfeedSet").toggleMode($(this).prop('action'));}}),new P({text:section.options[i].description})]})]});personalizeSection.appendChild(subSection);}
personalizeNode.appendChild(personalizeSection);}
this.getContainer().appendChild(personalizeNode);},clearContainers:function(params)
{var sidebar=(params&&params.sidebar!=undefined)?params.sidebar:true;$(this.getContainer()).empty();$('#header-info-content').empty();if(sidebar)
$('#slide-wrapper').empty();$('#pgFoot').empty();$(this.getContainer()).removeClass('personalize');},reorderResults:function()
{this.sortable=$(this.getContainer()).sortable();$('#entries').css('position','static');this._results.reset();this._subscriptions.reset();var i=1;while(this._subscriptions.valid())
{var subscription=this._subscriptions.getCurrent();subscription.displayReorder(false);if(index==this._subscriptions.length-1)
subscription.setLast();this._subscriptions.next();}
this.nodes.reorder={info:new Div({id:"instructions",nodes:[new P({text:"<span>drag and drop the bars to re-order the bookmarks in your lists...<br /><br />when you're h-a-p-p-y click done!</span>"})]}),toolbar:new Div({className:'resultToolbar',id:"reorderToolbar",nodes:[new UL({nodes:[new LI({nodes:[new Link({text:"<span>done</span>",fnc:function(){this.widget.saveOrder(this)},widget:this})],className:'button-commit'}),new LI({className:'button-cancel',nodes:[new Link({text:"cancel",fnc:function(){this.widget.toggleMode('personalize');},widget:this,href:'#section=personalize'})]})],id:"commit-menu"})]})};$('#slide-wrapper').append(this.nodes.reorder.info);$('#slide-wrapper').show();$('#header-info-content').append(this.nodes.reorder.toolbar);},removeResults:function()
{if(this.results.length>0)
while(this.results.length>0)
try{this.results.pop().remove();}catch(e){}
if(this.subscriptions&&this.subscriptions.length>0)
while(this.subscriptions.length>0)
try{this.subscriptions.pop().remove();}catch(e){}
this.getMap()?this.getMap().resetMarkers():null;},removeResult:function(result)
{this._results.remove(result.getID());},removeSubscription:function(subscription)
{this._subscriptions.remove(subscription.getFeedID());},saveOrder:function(node)
{this.forceFetch=true;var container=this.getContainer();var orderList=[];var order=0;this._tmpList=new List();for(var i=0;i<container.childNodes.length;i++)
{if(container.childNodes[i].subscription==null)
continue;var subscription=container.childNodes[i].subscription;subscription.tmp_order=order++;orderList.push(subscription.getFeedID());this._tmpList.add(subscription.getFeedID(),subscription);}
var data={funfeedIds:orderList};var request=new AjaxRequest(AJAX_PATH+"funfeed/reorder",{object:this,method:"commitOrder"},data,"POST");request.makeRequest({loaderParent:this.getContainer(),loaderClass:"loader_new_results",useLoader:true,parentSize:true});},commitOrder:function(data)
{if(data.valid)
{this.fetchFeedData();this.clearContainers();this.toggleMode('personalize');}
else
flash('there was a problem sorting your list, try again');},hasSubscription:function(id,child)
{if(child)
{if(this._subscriptionHash.valid(id))
return this._subscriptionHash.get(id).children.valid(child);else
return false;}
return this._subscriptionHash.valid(id);},getSubscription:function(id,child)
{if(child)
{if(this._subscriptionHash.valid(id))
if(this._subscriptionHash.get(id).children.valid(child))
return this._subscriptionHash.get(id).children.get(child);else
return false;}
if(this._subscriptionHash.valid(id))
return this._subscriptionHash.get(id);return false;}}});function WidgetGoogle(params)
{this._construct(params);}
WidgetGoogle.prototype=new WidgetTab(null);WidgetGoogle.prototype.display=function()
{this.drawContent(this.params.type=="streetview"?'widget-lite':'widget');Goby.get("MapLoader").loadMap({object:this,method:"renderMap"});}
WidgetGoogle.prototype.renderStreet=function()
{var location=(this.params.location?this.params.location:this.mgr.getLocation());var streetview=new google.maps.StreetViewPanorama(this.content,{position:new google.maps.LatLng(location.lat,location.lng),pov:{heading:270,pitch:0,zoom:0}});}
WidgetGoogle.prototype.renderMap=function()
{try
{if(this.params.type=="streetview")
return this.renderStreet();var location=(this.params.location?this.params.location:this.mgr.getLocation());this.mapNode=new Div({className:'map_item'});this.content.appendChild(this.mapNode);this.map=new mapHandler({type:this.params.type?this.params.type:"portal",results:this.params.results?this.params.results:null,location:location,noDrag:(this.params.drag?false:true),container:this.mapNode,widget:this,size:{x:300,y:260},callback:this.params.callback});this.map.widget=this;if(this.params.drag)
this.content.appendChild(new P({id:"map-pin-instructions",text:"<small class='ico'></small>drag pin to reorder list!"}));if(this.params.results)
for(var i in this.params.results)
this.setPoint(this.params.results[i]);}
catch(e)
{Goby.reportError(e);}}
WidgetGoogle.prototype.showAllPoints=function(result){this.map.showAllPoints();}
WidgetGoogle.prototype.setPoint=function(result){this.map.setPoint(result);}
WidgetGoogle.prototype.getMap=function(){return this.map;}
WidgetGoogle.prototype.getNode=function(id)
{switch(id)
{case"big":return document.getElementById("map");break;case"small":default:return this.mgr.getContainer();break;}}
WidgetGoogle.prototype.changeSize=function(label)
{$(this.getNode(label)).prepend(this.wrapper);this.map.reformat({size:(label=='big'?{x:945,y:480}:{x:300,y:260}),type:label});if(this.mgr.mui)
this.mgr.mui.toggle();}
WidgetGoogle.prototype.pinCallback=function()
{}
WidgetGoogle.prototype.resetCenter=function(data)
{if(this.map)
{this.map.resetCenter({'lat':data.lat,'lng':data.lng});}}
var WidgetInterstitial=function(params){this.__run(params)}
WidgetInterstitial.prototype=Class({_construct:function(params)
{this.params=params;},inherits:WidgetTab,methods:{display:function()
{var obj=new window[this.params.object](this.params.objectParams,this);this.popup=new PopupMask({content:obj});obj.popup=this.popup;this.popup.display();},close:function(data)
{this.popup.close();},displayMsg:function(data,isError)
{flash(data.message);if(!isError)
this.popup.close();}}});
