;var popbubble_isopen=false;$j(function(){$j.ui.dialog.defaults.bgiframe=true;WUUI._init();WULeadAd.init();WUNotice._init();$j('#sitelet').dialog({width:945,height:($j(window).height()-30),maxHeight:($j(window).height()-30),autoOpen:false,resizable:false,close:function(){$j(WhatsUp).trigger('wu._close_sitelet',{merchant_id:$j('#sitelet_merchant_id').val(),merchant_location_id:$j('#sitelet_merchant_location_id').val(),name:$j('#sitelet_merchant_name').val()})}});$j('#sitelet').bind('dialogclose',function(){$j('#wumodalbg').hide();});$j('#sitelet').bind('dialogopen',function(){$j('#wumodalbg').show();});$j('#popup-terms').dialog({width:600,height:400,autoOpen:false,modal:true,resizeable:false,title:'Terms & Conditions'});$j('a.popup-terms').live('click',function(){$j('#popup-terms').dialog('open');});$j('#popup-privacy').dialog({width:600,height:400,autoOpen:false,modal:true,resizeable:false,title:'Privacy Policy'});$j('a.popup-privacy').live('click',function(){$j('#popup-privacy').dialog('open');});$j(document).trigger('wu_init');$j('#feed_detail').dialog({width:700,height:500,modal:true,autoOpen:false});$j('#sendto').dialog({width:620,modal:true,autoOpen:false,title:'Send to Friend',open:function(){$j('#stf_cimg').get(0).src=$j('#stf_cimg').get(0).src+'1';},close:function(){$j('#stf_name1').val('');$j('#stf_email1').val('');$j('#stf_name2').val('');$j('#stf_email2').val('');$j('#stf_name3').val('');$j('#stf_email3').val('');$j('#stf_message').val($j('#stf_message_default').val());}});$j('#fstf_submit').click(function(){if($j('#stf_name1').val()==''&&$j('#stf_email1').val()==''&&$j('#stf_name2').val()==''&&$j('#stf_email2').val()==''&&$j('#stf_name3').val()==''&&$j('#stf_email3').val()==''){WUNotice.show('You must specify at least one name and email address!',{height:'50px',timeout:8000,noclose:true});return false;}
$j('#stf_plswait').show();$j('#fstf').ajaxSubmit({dataType:'json',url:$j('#fstf_action').val(),success:function(r){$j('#stf_plswait').hide();if(r.success==true){$j('#sendto').dialog('close');$j('#fstf input[type="text"]').each(function(){if(this.readOnly!==true){$j(this).val('');}});$j('#stf_message').val($j('#stf_message_default').val());if($j('#is_logged_in').val()!=1){WU_PLR.open(true);}}
WUNotice.show(r.message,{height:'50px',timeout:8000,noclose:true});if(r.reload_captcha===true){$j('#stf_cimg').attr('src',$j('#stf_cimg').attr('src')+'1');}}});return false;});$j('#m_choose_event_date').dialog({width:300,modal:true,autoOpen:false});$j('#fced_submit').click(function(){var form_action=($j('input[name="addtype"]:checked').val()=='all')?'/account/add-to-cal-all':'/account/add-to-cal';$j('#fced_loading').show();$j('#fced').ajaxSubmit({dataType:'json',url:form_action,success:function(r){if(r.trigger_login===true){WU_PLR.open_with_add_to_cal($j('#mde-event_id').val(),$j('#mde-cal_date').val());}
if(r.success==true){$j('#m_choose_event_date').dialog('close');$j(WhatsUp).trigger('wu._complete.add_to_cal');}
$j('#fced_loading').hide();WUNotice.show(r.message,{height:'50px',timeout:8000,noclose:true});}});return false;});$j('#pbubble').popbubble();$j('#pbubble_background').click(function(){popbubble_close();});$j('#popup-tandc').dialog({autoOpen:false,width:600,height:400,title:'Terms & Conditions'});$j('#popup-privacy').dialog({autoOpen:false,width:600,height:400,title:'Privacy Policy'});$j('a.link-tandc').live('click',function(){$j('#popup-tandc').dialog('open');});$j('a.link-privacy').live('click',function(){$j('#popup-privacy').dialog('open');});WU_PLR.initialize();if($j.query.get('register')=='register'||$j.query.get('register')=='true'){WU_PLR.open(true);}
if($j.query.get('reset_password')=='true'){WU_PLR.reset_password_confirm($j.query.get('email'));}});function get_feed_detail(href)
{$j.getJSON(href+'?ajax=true',function(r){if(r.feed.feed_type_id==3){var title='Event: '+r.loc_merch.name+': '+r.feed.title;}else if(r.feed.feed_type_id==2){var title='News: '+r.merch.name+': '+r.feed.title;}else{var title='Special: '+r.merch.name+': '+r.feed.title;}
$j('#ui-dialog-title-feed_detail').text(html_entity_decode(title));$j('#feed_detail').html(html_entity_decode(r.content));$j('#feed_detail').dialog('open');});return false;}
function popbubble_click(target)
{if(popbubble_isopen)return;var idparts=target.id.split(/_/);var feed_id=idparts[1];var merchant_id=idparts[2];var location_merchant_id=idparts[3];if($j(target).hasClass('feed-cal')){if(merchant_id==location_merchant_id){WUAction.follow_merchant(merchant_id);return false;}
var merch=trim($j($j('.pres_'+merchant_id).get(0)).text());var loc_merch=trim($j($j('.loc_'+location_merchant_id).get(0)).text());var follow_string='';follow_string+='<div style="padding: 5px;">';follow_string+='<div style="text-align: center; margin-bottom: 7px;"><strong>Choose Who to Follow<\/strong><\/div>';follow_string+='<img src="/images/icons/wu_follow.png" style="vertical-align: text-bottom;" /> ';follow_string+='<a href="javascript:popbubble_follow('+merchant_id+');">Follow '+merch+'<\/a><br />';follow_string+='<img src="/images/icons/wu_follow.png" style="vertical-align: text-bottom;" /> ';follow_string+='<a href="javascript:popbubble_follow('+location_merchant_id+');">Follow '+loc_merch+'<\/a><br />';follow_string+='<div style="text-align: center; margin-top: 5px;"><small><strong><a class="close" href="javascript:popbubble_close()">CLOSE<\/a><\/strong><\/small><\/div>';follow_string+='<\/div>';var why=$j('#pb_pbubble td.bb').html();$j('#pb_pbubble td.bb').html(follow_string);$j('#pb_pbubble a.close').css('color','#000000');var top=(0-$j('#pb_pbubble').height()-25)+'px';var left='-115px';var pb=$j('#pb_pbubble').remove();$j(target).css('position','relative');$j(target).append(pb);$j('#pb_pbubble').css('top',top);$j('#pb_pbubble').css('left',left);popbubble_open();}else{WUAction.follow_merchant(merchant_id);}
return false;}
function popbubble_close()
{$j('#pb_pbubble').animate({opacity:0},250,function(){$j('#pb_pbubble').hide();});$j('span.feed-follow').click(function(){popbubble_click(this);});$j('#pbubble_background').hide();popbubble_isopen=false;}
function popbubble_follow(merchant_id)
{WUAction.follow_merchant(merchant_id,function(){popbubble_close();});}
function popbubble_open()
{$j('#pb_pbubble').show();$j('#pb_pbubble').animate({opacity:1},250);$j('span.feed-follow').unbind('click');$j('#pbubble_background').show();popbubble_isopen=true;};$j(function(){$j('input.ffilter').click(function(){var type=this.id.split(/_/)[1];var items=$j('#feed div.feed-type_'+type);if(this.checked){items.show();}else{items.hide();}
check_feed_items();});check_feed_items();if($j.query.get('show')!=''){$j('#feed input[type="checkbox"]').each(function(){this.checked=false;});$j('#fs_1').get(0).checked=true;}});function check_feed_items()
{if($j('#feed div.feed_item:visible').length>0){$j('#feed_none').hide();}else{$j('#feed_none').show();}}