
(function(a){a.fn.bxSlider=function(b){function Z(b,c,d,e){var f=[];var g=d;var h=false;if(e=="backward"){b=a.makeArray(b);b.reverse()}while(g>0){a.each(b,function(b,d){if(g>0){if(!h){if(b==c){h=true;f.push(a(this).clone());g--}}else{f.push(a(this).clone());g--}}else{return false}})}return f}function Y(){var a=i.outerHeight()*b.displaySlideQty;return a}function X(){var a=i.outerWidth()*b.displaySlideQty;return a}function W(b,c){if(c=="left"){var d=a(".pager",h).eq(b).position().left}else if(c=="top"){var d=a(".pager",h).eq(b).position().top}return d}function V(){if(!b.infiniteLoop&&b.hideControlOnEnd){if(x==F){a(".bx-prev",h).hide()}else{a(".bx-prev",h).show()}if(x==G){a(".bx-next",h).hide()}else{a(".bx-next",h).show()}}}function U(c,e,f,g){p=a('<a href="" class="bx-start"></a>');if(c=="text"){r=e}else{r='<img src="'+e+'" />'}if(f=="text"){s=g}else{s='<img src="'+g+'" />'}if(b.autoControlsSelector){a(b.autoControlsSelector).append(p)}else{h.append('<div class="bx-auto"></div>');a(".bx-auto",h).html(p)}p.click(function(){if(b.ticker){if(a(this).hasClass("stop")){d.stopTicker()}else if(a(this).hasClass("start")){d.startTicker()}}else{if(a(this).hasClass("stop")){d.stopShow(true)}else if(a(this).hasClass("start")){d.startShow(true)}}return false})}function T(){var c=a("img",g.eq(x)).attr("title");if(c!=""){if(b.captionsSelector){a(b.captionsSelector).html(c)}else{a(".bx-captions",h).html(c)}}else{if(b.captionsSelector){a(b.captionsSelector).html("  ")}else{a(".bx-captions",h).html("  ")}}}function S(c){var e=g.length;if(b.moveSlideQty>1){if(g.length%b.moveSlideQty!=0){e=Math.ceil(g.length/b.moveSlideQty)}else{e=g.length/b.moveSlideQty}}var f="";if(b.buildPager){for(var i=0;i<e;i++){f+=b.buildPager(i,g.eq(i*b.moveSlideQty))}}else if(c=="full"){for(var i=1;i<=e;i++){f+='<a href="" class="pager-link pager-'+i+'">'+i+"</a>"}}else if(c=="short"){f='<span class="bx-pager-current">'+(b.startingSlide+1)+"</span> "+b.pagerShortSeparator+' <span class="bx-pager-total">'+g.length+"</span>"}if(b.pagerSelector){a(b.pagerSelector).append(f);n=a(b.pagerSelector)}else{var j=a('<div class="bx-pager"></div>');j.append(f);if(b.pagerLocation=="top"){h.prepend(j)}else if(b.pagerLocation=="bottom"){h.append(j)}n=a(".bx-pager",h)}n.children().click(function(){if(b.pagerType=="full"){var a=n.children().index(this);if(b.moveSlideQty>1){a*=b.moveSlideQty}d.goToSlide(a)}return false})}function R(c,e,f,g){var i=a('<a href="" class="bx-next"></a>');var j=a('<a href="" class="bx-prev"></a>');if(c=="text"){i.html(e)}else{i.html('<img src="'+e+'" />')}if(f=="text"){j.html(g)}else{j.html('<img src="'+g+'" />')}if(b.prevSelector){a(b.prevSelector).append(j)}else{h.append(j)}if(b.nextSelector){a(b.nextSelector).append(i)}else{h.append(i)}i.click(function(){d.goToNextSlide();return false});j.click(function(){d.goToPreviousSlide();return false})}function Q(c){if(b.pagerType=="full"&&b.pager){a("a",n).removeClass(b.pagerActiveClass);a("a",n).eq(c).addClass(b.pagerActiveClass)}else if(b.pagerType=="short"&&b.pager){a(".bx-pager-current",n).html(x+1)}}function P(){g.not(":eq("+x+")").fadeTo(b.speed,0).css("zIndex",98);g.eq(x).css("zIndex",99).fadeTo(b.speed,1,function(){E=false;if(jQuery.browser.msie){g.eq(x).get(0).style.removeAttribute("filter")}b.onAfterSlide(x,g.length,g.eq(x))})}function O(){e.hover(function(){if(t){d.stopTicker(false)}},function(){if(t){d.startTicker(false)}})}function N(){h.find(".bx-window").hover(function(){if(t){d.stopShow(false)}},function(){if(t){d.startShow(false)}})}function M(){if(b.startImage!=""){startContent=b.startImage;startType="image"}else{startContent=b.startText;startType="text"}if(b.stopImage!=""){stopContent=b.stopImage;stopType="image"}else{stopContent=b.stopText;stopType="text"}U(startType,startContent,stopType,stopContent)}function L(a,c,d){if(b.mode=="horizontal"){if(b.tickerDirection=="next"){e.animate({left:"-="+c+"px"},d,"linear",function(){e.css("left",a);L(a,A,b.tickerSpeed)})}else if(b.tickerDirection=="prev"){e.animate({left:"+="+c+"px"},d,"linear",function(){e.css("left",a);L(a,A,b.tickerSpeed)})}}else if(b.mode=="vertical"){if(b.tickerDirection=="next"){e.animate({top:"-="+c+"px"},d,"linear",function(){e.css("top",a);L(a,B,b.tickerSpeed)})}else if(b.tickerDirection=="prev"){e.animate({top:"+="+c+"px"},d,"linear",function(){e.css("top",a);L(a,B,b.tickerSpeed)})}}}function K(){if(b.auto){if(!b.infiniteLoop){if(b.autoDirection=="next"){o=setInterval(function(){x+=b.moveSlideQty;if(x>G){x=x%g.length}d.goToSlide(x,false)},b.pause)}else if(b.autoDirection=="prev"){o=setInterval(function(){x-=b.moveSlideQty;if(x<0){negativeOffset=x%g.length;if(negativeOffset==0){x=0}else{x=g.length+negativeOffset}}d.goToSlide(x,false)},b.pause)}}else{if(b.autoDirection=="next"){o=setInterval(function(){d.goToNextSlide(false)},b.pause)}else if(b.autoDirection=="prev"){o=setInterval(function(){d.goToPreviousSlide(false)},b.pause)}}}else if(b.ticker){b.tickerSpeed*=10;a(".pager",h).each(function(b){A+=a(this).width();B+=a(this).height()});if(b.tickerDirection=="prev"&&b.mode=="horizontal"){e.css("left","-"+(A+y)+"px")}else if(b.tickerDirection=="prev"&&b.mode=="vertical"){e.css("top","-"+(B+z)+"px")}if(b.mode=="horizontal"){C=parseInt(e.css("left"));L(C,A,b.tickerSpeed)}else if(b.mode=="vertical"){D=parseInt(e.css("top"));L(D,B,b.tickerSpeed)}if(b.tickerHover){O()}}}function J(){if(b.nextImage!=""){nextContent=b.nextImage;nextType="image"}else{nextContent=b.nextText;nextType="text"}if(b.prevImage!=""){prevContent=b.prevImage;prevType="image"}else{prevContent=b.prevText;prevType="text"}R(nextType,nextContent,prevType,prevContent)}function I(){if(b.mode=="horizontal"||b.mode=="vertical"){var c=Z(g,0,b.moveSlideQty,"backward");a.each(c,function(b){e.prepend(a(this))});var d=g.length+b.moveSlideQty-1;var f=g.length-b.displaySlideQty;var h=d-f;var i=Z(g,0,h,"forward");if(b.infiniteLoop){a.each(i,function(b){e.append(a(this))})}}}function H(){I(b.startingSlide);if(b.mode=="horizontal"){e.wrap('<div class="'+b.wrapperClass+'" style="width:'+l+'px; position:relative;"></div>').wrap('<div class="bx-window" style="position:relative; overflow:hidden; width:'+l+'px;"></div>').css({width:"999999px",position:"relative",left:"-"+y+"px"});e.children().css({width:j,"float":"left",listStyle:"none"});h=e.parent().parent();g.addClass("pager")}else if(b.mode=="vertical"){e.wrap('<div class="'+b.wrapperClass+'" style="width:'+v+'px; position:relative;"></div>').wrap('<div class="bx-window" style="width:'+v+"px; height:"+m+'px; position:relative; overflow:hidden;"></div>').css({height:"999999px",position:"relative",top:"-"+z+"px"});e.children().css({listStyle:"none",height:w});h=e.parent().parent();g.addClass("pager")}else if(b.mode=="fade"){e.wrap('<div class="'+b.wrapperClass+'" style="width:'+v+'px; position:relative;"></div>').wrap('<div class="bx-window" style="height:'+w+"px; width:"+v+'px; position:relative; overflow:hidden;"></div>');e.children().css({listStyle:"none",position:"absolute",top:0,left:0,zIndex:98});h=e.parent().parent();g.not(":eq("+x+")").fadeTo(0,0);g.eq(x).css("zIndex",99)}if(b.captions&&b.captionsSelector==null){h.append('<div class="bx-captions"></div>')}}var c={mode:"horizontal",infiniteLoop:true,hideControlOnEnd:false,controls:true,speed:500,easing:"swing",pager:false,pagerSelector:null,pagerType:"full",pagerLocation:"bottom",pagerShortSeparator:"/",pagerActiveClass:"pager-active",nextText:"next",nextImage:"",nextSelector:null,prevText:"prev",prevImage:"",prevSelector:null,captions:false,captionsSelector:null,auto:false,autoDirection:"next",autoControls:false,autoControlsSelector:null,autoStart:true,autoHover:false,autoDelay:0,pause:3e3,startText:"start",startImage:"",stopText:"stop",stopImage:"",ticker:false,tickerSpeed:5e3,tickerDirection:"next",tickerHover:false,wrapperClass:"bx-wrapper",startingSlide:0,displaySlideQty:1,moveSlideQty:1,randomStart:false,onBeforeSlide:function(){},onAfterSlide:function(){},onLastSlide:function(){},onFirstSlide:function(){},onNextSlide:function(){},onPrevSlide:function(){},buildPager:null};var b=a.extend(c,b);var d=this;var e="";var f="";var g="";var h="";var i="";var j="";var k="";var l="";var m="";var n="";var o="";var p="";var q="";var r="";var s="";var t=true;var u=false;var v=0;var w=0;var x=0;var y=0;var z=0;var A=0;var B=0;var C=0;var D=0;var E=false;var F=0;var G=g.length-1;this.goToSlide=function(a,c){if(!E){E=true;x=a;b.onBeforeSlide(x,g.length,g.eq(x));if(typeof c=="undefined"){var c=true}if(c){if(b.auto){d.stopShow(true)}}slide=a;if(slide==F){b.onFirstSlide(x,g.length,g.eq(x))}if(slide==G){b.onLastSlide(x,g.length,g.eq(x))}if(b.mode=="horizontal"){e.animate({left:"-"+W(slide,"left")+"px"},b.speed,b.easing,function(){E=false;b.onAfterSlide(x,g.length,g.eq(x))})}else if(b.mode=="vertical"){e.animate({top:"-"+W(slide,"top")+"px"},b.speed,b.easing,function(){E=false;b.onAfterSlide(x,g.length,g.eq(x))})}else if(b.mode=="fade"){P()}V();if(b.moveSlideQty>1){a=Math.floor(a/b.moveSlideQty)}Q(a);T()}};this.goToNextSlide=function(a){if(typeof a=="undefined"){var a=true}if(a){if(b.auto){d.stopShow(true)}}if(!b.infiniteLoop){if(!E){var c=false;x=x+b.moveSlideQty;if(x<=G){V();b.onNextSlide(x,g.length,g.eq(x));d.goToSlide(x)}else{x-=b.moveSlideQty}}}else{if(!E){E=true;var c=false;x=x+b.moveSlideQty;if(x>G){x=x%g.length;c=true}b.onNextSlide(x,g.length,g.eq(x));b.onBeforeSlide(x,g.length,g.eq(x));if(b.mode=="horizontal"){var f=b.moveSlideQty*k;e.animate({left:"-="+f+"px"},b.speed,b.easing,function(){E=false;if(c){e.css("left","-"+W(x,"left")+"px")}b.onAfterSlide(x,g.length,g.eq(x))})}else if(b.mode=="vertical"){var h=b.moveSlideQty*w;e.animate({top:"-="+h+"px"},b.speed,b.easing,function(){E=false;if(c){e.css("top","-"+W(x,"top")+"px")}b.onAfterSlide(x,g.length,g.eq(x))})}else if(b.mode=="fade"){P()}if(b.moveSlideQty>1){Q(Math.ceil(x/b.moveSlideQty))}else{Q(x)}T()}}};this.goToPreviousSlide=function(c){if(typeof c=="undefined"){var c=true}if(c){if(b.auto){d.stopShow(true)}}if(!b.infiniteLoop){if(!E){var f=false;x=x-b.moveSlideQty;if(x<0){x=0;if(b.hideControlOnEnd){a(".bx-prev",h).hide()}}V();b.onPrevSlide(x,g.length,g.eq(x));d.goToSlide(x)}}else{if(!E){E=true;var f=false;x=x-b.moveSlideQty;if(x<0){negativeOffset=x%g.length;if(negativeOffset==0){x=0}else{x=g.length+negativeOffset}f=true}b.onPrevSlide(x,g.length,g.eq(x));b.onBeforeSlide(x,g.length,g.eq(x));if(b.mode=="horizontal"){var i=b.moveSlideQty*k;e.animate({left:"+="+i+"px"},b.speed,b.easing,function(){E=false;if(f){e.css("left","-"+W(x,"left")+"px")}b.onAfterSlide(x,g.length,g.eq(x))})}else if(b.mode=="vertical"){var j=b.moveSlideQty*w;e.animate({top:"+="+j+"px"},b.speed,b.easing,function(){E=false;if(f){e.css("top","-"+W(x,"top")+"px")}b.onAfterSlide(x,g.length,g.eq(x))})}else if(b.mode=="fade"){P()}if(b.moveSlideQty>1){Q(Math.ceil(x/b.moveSlideQty))}else{Q(x)}T()}}};this.goToFirstSlide=function(a){if(typeof a=="undefined"){var a=true}d.goToSlide(F,a)};this.goToLastSlide=function(){if(typeof a=="undefined"){var a=true}d.goToSlide(G,a)};this.getCurrentSlide=function(){return x};this.getSlideCount=function(){return g.length};this.stopShow=function(a){clearInterval(o);if(typeof a=="undefined"){var a=true}if(a&&b.autoControls){p.html(r).removeClass("stop").addClass("start");t=false}};this.startShow=function(a){if(typeof a=="undefined"){var a=true}K();if(a&&b.autoControls){p.html(s).removeClass("start").addClass("stop");t=true}};this.stopTicker=function(a){e.stop();if(typeof a=="undefined"){var a=true}if(a&&b.ticker){p.html(r).removeClass("stop").addClass("start");t=false}};this.startTicker=function(a){if(b.mode=="horizontal"){if(b.tickerDirection=="next"){var c=parseInt(e.css("left"));var d=A+c+g.eq(0).width()}else if(b.tickerDirection=="prev"){var c=-parseInt(e.css("left"));var d=c-g.eq(0).width()}var f=d*b.tickerSpeed/A;L(C,d,f)}else if(b.mode=="vertical"){if(b.tickerDirection=="next"){var h=parseInt(e.css("top"));var d=B+h+g.eq(0).height()}else if(b.tickerDirection=="prev"){var h=-parseInt(e.css("top"));var d=h-g.eq(0).height()}var f=d*b.tickerSpeed/B;L(D,d,f);if(typeof a=="undefined"){var a=true}if(a&&b.ticker){p.html(s).removeClass("start").addClass("stop");t=true}}};this.initShow=function(){e=a(this);f=e.clone();g=e.children();h="";i=e.children(":first");j=i.width();v=0;k=i.outerWidth();w=0;l=X();m=Y();E=false;n="";x=0;y=0;z=0;o="";p="";q="";r="";s="";t=true;u=false;A=0;B=0;C=0;D=0;F=0;G=g.length-1;g.each(function(b){if(a(this).outerHeight()>w){w=a(this).outerHeight()}if(a(this).outerWidth()>v){v=a(this).outerWidth()}});if(b.randomStart){var c=Math.floor(Math.random()*g.length);x=c;y=k*(b.moveSlideQty+c);z=w*(b.moveSlideQty+c)}else{x=b.startingSlide;y=k*(b.moveSlideQty+b.startingSlide);z=w*(b.moveSlideQty+b.startingSlide)}H();if(b.pager&&!b.ticker){if(b.pagerType=="full"){S("full")}else if(b.pagerType=="short"){S("short")}}if(b.controls&&!b.ticker){J()}if(b.auto||b.ticker){if(b.autoControls){M()}if(b.autoStart){setTimeout(function(){d.startShow(true)},b.autoDelay)}else{d.stopShow(true)}if(b.autoHover&&!b.ticker){N()}}if(b.moveSlideQty>1){Q(Math.ceil(x/b.moveSlideQty))}else{Q(x)}V();if(b.captions){T()}b.onAfterSlide(x,g.length,g.eq(x))};this.destroyShow=function(){clearInterval(o);a(".bx-next, .bx-prev, .bx-pager, .bx-auto",h).remove();e.unwrap().unwrap().removeAttr("style");e.children().removeAttr("style").not(".pager").remove();g.removeClass("pager")};this.reloadShow=function(){d.destroyShow();d.initShow()};this.each(function(){if(a(this).children().length>0){d.initShow()}});return this};jQuery.fx.prototype.cur=function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var a=parseFloat(jQuery.css(this.elem,this.prop));return a}})(jQuery)
var unauth_home=(function(){var log=function(){if(jsface.browser.ie){AL.Logger.info('unauth_home',arguments);}else{var msg=Array.prototype.slice.call(arguments);msg.unshift('unauth_home');AL.Logger.info.apply(AL.Logger,msg);}};$("#unauth_home_onboard_join_btn").live("click",function(){AL.utils.triggerEvent('unauth_join','click');return true;});return{};}());$(function(){AL.Utils.bindConnectBtns();});$(function(){if($('#slider1').length>0){$('#slider1').bxSlider({easing:'easeOutExpo',auto:'true',pause:'6000',infiniteLoop:'true',controls:'false',randomStart:'true'});}});
$(function(){jsface.def({cls:'PageInit',on:AL.app,as:function(){var _currentUrl=document.location.href.toLowerCase();function _private(){var __show_import_popup=function(){AL.app.popups['onboard_post_join_popup']=new AL.widgets.DialogBasic({templateName:'onboard_post_join_popup',contentId:'onboard_post_join_popup_content',dialog_class:'round-grey-dialog',outside_click_close:false,width:800,bindEvents:function(widgetOpts){var template=widgetOpts.template;var elementArea=template.find('.elements-area');var content_template=AL.Utils.getTemplate('post-join-import-template','/pages/onboarding/post_join_import');elementArea.append(content_template);post_join_onboard.bindActions();}});AL.app.popups['onboard_post_join_popup'].show();AL.Utils.createLoadingBtns();};var __popupsByUrlValue=function(){var strippedUrl=_currentUrl.split("#");if(strippedUrl.length<2){return;}
var anchorValue=strippedUrl[1],pageId=AL.Profile.page_id;switch(anchorValue){case'login':case'signin':if(!AL.Profile.login){setTimeout(function(){AL.app.unauthPopup.show({anchor:'header_login',onShow:function(){if(anchorValue==='login'){$('#login-popup-unauth').removeClass('hidden');}else{$('#login-popup-unauth').addClass('hidden');}}});},10);}
break;case'join':if(!AL.Profile.login){setTimeout(function(){var anchor_id="unauth_join";if(!AL.app.popups[anchor_id]){AL.app.popups[anchor_id]=new AL.widgets.JoinPopup({anchor:anchor_id,align:'window_center'});}
AL.app.popups[anchor_id].show();},10);}
break;case'addtosharelist':if(AL.Profile.login&&pageId==="business_listing"){$(".header-bottom .bt-list-like").click();}
break;case'sharelist':case'startalist':if(AL.Profile.login){$("#tab-start-list").trigger('click');}
break;case'sync':if(AL.Profile.login){__show_import_popup();}
break;case'trylist':if(pageId==="business_listing"){$(".header-bottom .bt-try").click();}
break;case'profile':if(AL.Profile.debug_level>0){AL.Profile.show();}
break;default:break;}};var __call_onboarding=function(){$.post("/ajax/unset_first_time",{},function(){});var dialog_class='round-grey-dialog onboard-options-dialog';if(AL.app.popups['onboard_options_dialog']){delete AL.app.popups['onboard_options_dialog'];$("#onboard_options_dialog").remove();}
AL.app.popups['onboard_options_dialog']=new AL.widgets.DialogBasic({templateName:'onboard_options_dialog',contentId:'onboard_options_dialog_content',screenMask:true,outside_click_close:false,width:470,dialog_class:dialog_class,bindEvents:function(widgetOpts){var template=widgetOpts.template;var elementArea=template.find('.elements-area');var content_template=AL.Utils.getTemplate('onboard-options-template','/pages/onboarding/onboard_options');elementArea.append(content_template);template.find(".open-import-dialog-btn").click(function(){__show_import_popup();});template.find(".open-sharelist-dialog-btn").click(function(){$('#tab-start-list').addClass('post-join-dialog-flag').click();});template.find(".open-discover-btn").click(function(){AL.app.popups['onboard_options_dialog'].hide();$.cookie('open_discover_modal','open',{path:'/'});document.location='/latest';});}});AL.app.popups['onboard_options_dialog'].show();};return{_popupsInLoading:function(){if(_currentUrl.indexOf('/ipad')!==-1){return;}
if(AL.Profile.first_time&&AL.Profile.login){__call_onboarding();}
else if((($('#list-type-holder').length&&$('#list-type-holder').val()==='my_likelist')&&"1 5 10".hasWord(AL.Profile.sign_in_count)&&(AL.Profile.show_fb_popup==="1"||AL.Profile.show_fs_popup==="1"))||(window.serverVars&&window.serverVars.network_import_flag==='import')){var show=($("#network-import-popup-viewed").length&&parseInt($("#network-import-popup-viewed").val(),10)===parseInt(AL.Profile.sign_in_count,10))?false:true;if(AL.Profile.first_time&&AL.Profile.login){show=false;}
if(window.serverVars.network_import_flag==='import'){show=true;}
if(show){__show_import_popup();$.post("/ajax/set_network_import_popup_viewed","sign_in_count="+AL.Profile.sign_in_count);}}else if(AL.Profile.multiple_account_popup==true&&AL.Profile.login){AL.app.popups['mul_account']=new AL.widgets.DialogBasic({templateName:'mul-account-dialog',alModel:new AL.widgets.Model({contentTemplateId:'template-multi-email-conf-pp',contentTemplateUrl:'pages/email/_template_multi_email_conf_pp',contentDataObj:{email:AL.Profile.email}}),width:500,dialog_class:'round-grey-dialog',bindEvents:function(opts,widget){var server_upadte=function(answer){$.post("/registration/multiple_accounts_response/"+answer,{},function(data){if(data&&data.code==="popup"){AL.app.popups['mul_account_second'].opts.redirect_url=data.redirect_url;AL.app.popups['mul_account_second'].show();}else if(data&&data.code==="success"){document.location.href=data.redirect_url;}else{alert("Error:"+data.error_message);}
widget.hide();});};$(".button-no",opts.template).click(function(){server_upadte('no');});$(".button-yes",opts.template).click(function(){server_upadte('yes');});}});AL.app.popups['mul_account'].show();}else if(AL.Profile.invite_account_same_popup==true&&AL.Profile.login){AL.app.popups['mul_account_second']=new AL.widgets.DialogBasic({templateName:'mul-account-dialog',alModel:new AL.widgets.Model({contentTemplateId:'template-multi-email-own-conf-pp',contentTemplateUrl:'pages/email/_template_multi_email_conf_pp',contentDataObj:{email:AL.Profile.email}}),width:500,dialog_class:'round-grey-dialog',bindEvents:function(opts,widget){$(".button-yes",opts.template).click(function(){AL.app.popups['mul_account_second'].hide();$.get('/registration/clear_invite_account_same_popup');});}});AL.app.popups['mul_account_second'].show();}
else{__popupsByUrlValue();}}};}
return{PageInit:function(){this._p=_private();this._p._popupsInLoading();}};}});jsface.ready(function(){new AL.app.PageInit();});});
$(function(){AL.utils.tracking.impression();AL.app.popups['USER_HOVER']={sensitivity:7,interval:700,over:function(){if($("#login-popup-container:visible").length===0){var th=$(this),member_id=th.attr("rel"),anchorId=th.attr('id');var this_trigger=this;if(member_id==undefined){return;}
if(jsface.isEmpty(anchorId)){anchorId=AL.Utils.genId('LLUSERII');th.attr('id',anchorId);}
this.doHover=true;var jsonId='userInfoJson'+member_id;var display_hover=function(){if(!this_trigger.doHover){return;}
var hoverTop=-10,hoverLeft=40;var x=new AL.widgets.AllMemberPopup({adjustTop:hoverTop,adjustLeft:hoverLeft,anchor:anchorId,anchorEvent:'mouseenter',closeOnLeave:false,align:'left',autoShow:true,ajaxObj:x,listId:member_id,memberData:AL.jsonData[jsonId],onHide:function(obj){$(this_trigger).unbind('mouseenter');}});};$.getJSON("/lists/user_hover/"+member_id,{},function(json){if(json&&json.code==="success"){AL.jsonData[jsonId]=json.content;display_hover();}});}},out:function(){this.doHover=false;}};$(".userInfoTrigger").hoverIntent(AL.app.popups['USER_HOVER']);AL.app.popups['LIST_HOVER']={sensitivity:7,interval:700,over:function(){if($("#login-popup-container:visible").length===0){var th=$(this),this_trigger=this;var list_id=$(this_trigger).attr("rel");var anchor_id=AL.Utils.genId('listhover-');$(this).attr('id',anchor_id);if(list_id==='undefined'){return;}
var category='',sort='';var all_locations=0;if(AL.Profile.page_id==='content-page'){all_locations=-1;}
var form=$('#list-tab-form');if(form&&form.find('input[name=category_id]').length>0){category=form.find('input[name=category_id]').val();sort=form.find('input[name=list_sort]').val();all_locations=form.find('input[name=all_locations]').val();}
this.doHover=true;var hoverJsonId='listhoverJson'+list_id;var display_hover=function(d){if(!this_trigger.doHover){return;}
var json=AL.jsonData[hoverJsonId];var hoverTop=-10,hoverLeft=40;var x=new AL.widgets.ListHover({adjustTop:hoverTop,adjustLeft:hoverLeft,align:'left',anchor:anchor_id,ajaxObj:x,closeOnLeave:false,listId:list_id,memberData:json,onHide:function(obj){AL.jsonData[hoverJsonId]=obj.opts.memberData;$(this_trigger).unbind('mouseenter');}});};if(!AL.jsonData[hoverJsonId]){$.post("/lists/list_hover",{list_id:list_id,type:'all',category:category,sort:sort,trylist:(/trylist/i).test($(this_trigger).attr('href'))?1:0,all_locations:all_locations},function(json){if(json&&json.code==="success"){AL.jsonData[hoverJsonId]=json.content;display_hover();}});}else{display_hover();}}},out:function(){this.doHover=false;}};$(".list-hover-link").hoverIntent(AL.app.popups['LIST_HOVER']);$("input.hint, textarea.hint").hint();$(".list-gallery-item-description .more-link").showMore({itemClass:'more-description',moreText:'more&raquo;',lessText:'&nbsp;&laquo;less',number:1});AL.app.LatestRefresh=function(options){if($('#latest-search-selectors').length>0){var form=$("#latest-selector-form");var view=$('input[name=data[latest_view]]',form).val();var from=$('input[name=data[latest_from]]',form).val();$.post("/latest/show_more_activity",{show_more:0,view:view,from:from},function(data){var ret=eval(data);if(ret.left){$('.latest-item').remove();$('.show-more-container').remove();$(ret.left).insertAfter($('#latest-search-selectors'));if(options&&options.callback){options.callback();}}});}};AL.app.ListPageRefresh=function(params){var owner=$(".list-owner-id",".header-top").val();var url=$(".likelist-link",".header-top").val();var json_params=$('#list-owner-params').val();if(!json_params){return;}
var filters=$.parseJSON(json_params);if(params.refresh!=1&&(owner!=filters.user_id||AL.Profile.page_id!="mylist")){return;}
var list_id=$('#list-avatar-upload').attr('rel');if(!list_id){list_id=$('.list-photo-upload-link').attr('rel');}
if(list_id){if(params.business_id&&$.inArray(list_id,params.removed)!=-1){$('.list-entry-'+params.business_id).remove();var offset=$('#list-show-more-link').attr('rel');if(offset){offset--;$('#list-show-more-link').attr('rel',offset);}
return;}
var trylist=filters.trylist;if(params.action==='unlike'||trylist==1){if(trylist==1&&params.try_count==0){window.location.href='/lists/'+list_id;return;}
var opts={sort:filters.sort,change_sort:1,json_params:json_params};var url='/lists/show_left/'+$('.list-photo-upload-link').attr('rel');$(".show-more-container").remove();$('.filter-tabs').find('.loading').removeClass('hidden');$.post(url,opts,function(data){$(".spin").addClass('hidden');var ret=eval(data);$('.filter-tabs').find('.loading').addClass('hidden');if(ret&&ret.left){$(".filter-sort-links-container").remove();$(".singlelist-result").remove();if(filters.edit_mode=='1'){$(ret.left).insertAfter('#listbuilder-search-container');}else{$(ret.left).insertAfter('.filter-tab-container');}
if(ret.json_params){$('#list-owner-params').html(ret.json_params);}}});}}};AL.methods.followDialog=function(){var jLeft=$('#left'),list_title=$(".header-list-title",jLeft).text(),list_id=$(".header-list-id",jLeft).attr('rel');AL.app.popups['list_follow_popup']=new AL.widgets.DialogBasic({width:500,dialog_class:'round-grey-dialog',alModel:new AL.widgets.Model({contentTemplateId:'template-follow-pp',contentTemplateUrl:'/pages/list/_template_follow_pp',contentDataObj:{"list_title":list_title}}),bindEvents:function(widgetOpts,widget){var template=widgetOpts.template;$(".follow-dialog-ok-btn",template).bind('click',function(){AL.methods.followList({'list_id':list_id,'list_title':list_title,'action':'follow','anchor':$(this),'from_dialog':1});});$(".bt-cancel",template).bind('click',function(){widget.hide();});}});AL.app.popups['list_follow_popup'].show();};AL.methods.followList=function(params){var th=params.anchor;if(params.action==="follow"){th.addClass('loading');$.post("/lists/ajax_join_list",{list_id:params.list_id},function(data){if(data){params.list_title=data.list_name;if(data.code==='success'){$(".join-list-"+params.list_id).html('following').attr('rel','following');if(th.hasClass('btn-join-list-from-list-header')||params.from_dialog==1){AL.methods.follow_confirmation(params);window.serverVars.joinStatus='following';}}else{if(data.following){AL.app.popups['list_join_popup']=new AL.widgets.DialogBasic({templateName:'join_list_popup',alModel:new AL.widgets.Model({contentTemplateId:'template-already-joined-list-pp',contentTemplateUrl:'/pages/list/_template_already_joined_pp',contentJsonData:$.toJSON({"list_title":params.list_title})}),width:450,dialog_class:'round-grey-dialog'});AL.app.popups['list_join_popup'].show();th.html('following').attr('rel','following');window.serverVars.joinStatus='following';}}
th.removeClass('loading');}});}
if(params.action==="following"){AL.app.popups['list_unjoin_popup']=new AL.widgets.DialogBasic({templateName:'unjoin_list_popup',width:500,dialog_class:'round-grey-dialog',alModel:new AL.widgets.Model({contentTemplateId:'template-unjoin-list-pp',contentTemplateUrl:'/pages/list/_template_unjoin_list_pp',contentJsonData:$.toJSON({"list_title":params.list_title})}),bindEvents:function(widgetOpts,widget){var template=widgetOpts.template;$(".button-cancel",template).bind('click',function(){widget.hide();});$(".button-leave",template).bind('click',function(){widget.hide();$.post("/lists/ajax_unjoin_list",{list_id:params.list_id},function(data){if(data){th.html('follow').attr('rel','follow');window.serverVars.joinStatus='nofollow';$('.member-info-'+AL.Profile.id).remove();}});});}});AL.app.popups['list_unjoin_popup'].show();}};var cdata=$.parseJSON($.cookie("non_member_added_business"));if(cdata){$.cookie("non_member_added_business","0",{path:'/'});AL.methods.followDialog();}
if($("#header-location-input").val()==''){$.get("/ajax/get_location",{},function(data){if(data.code=='success'){$("#header-location-input").val(data.location);}});}
AL.Utils.bindConnectBtns();AL.Utils.bind_count_characters();if(AL.app.Search){AL.app.Search.init();}
if($("#list-show-more-link").length>0){new AL.components.ScrollShowMore({buttonId:"list-show-more-link"});}
AL.methods.relatedListsRows=function(){$("div.list-container div.list-element-container>div:nth-child(2n+1)").css("margin-left","0px");$("div.list-container div.list-element-container>div:nth-child(2n+1)").css("clear","both");};jsface.ready(AL.methods.relatedListsRows,"relatedListsRows");jsface.ready(function(){if(jsface.browser.ie8){$("#main_content").removeClass("equalheight");}});if($('div.marketing-container').length){$('.seo-related-links').css("display","none");}
$('#list-search-toggle').live('click',function(){var th=$(this),filtersContainer=$('.filter-sort-toggle-container'),icon=$('span.list-search-toggle-icon',th),jText=$('span.list-search-toggle-text',th);filtersContainer.toggle();icon.removeClass('list-search-toggle-icon-down list-search-toggle-icon-up');if(filtersContainer.css('display')==='block'){jText.text('hide');icon.addClass('list-search-toggle-icon-up');}else{jText.text('show');icon.addClass('list-search-toggle-icon-down');}});});
