define(["core"],function(a){return a.create_module("details",function(h){var e,c,g,d=["lightBox","tooltip"],f=0,b=105; return{el:{eventDescription:h.find("#event_description")[0],moreText:h.find(".moreText")[0],moreTextContent:h.find(".moreTextContent")[0],jsSeeMore:h.find(".moreOrLess")[0],jsSeeEvent:h.find(".seeEvent")[0],tabs:h.find("#detail_tabs .detailNav .detail-tab > a"),lightBoxLink:h.find(".lightBoxLink")[0],ticketLimitSection:h.find(".ticket-limit")[0]},init:function(){e=this; c=h.getContainer();h.removeClass(e.el.eventDescription,"hide");if(typeof lightBoxLink!=="undefined"){h.addEvent(lightBoxLink,"click",e.lightBoxLinkClicked); }h.foreach(e.el.tabs,function(){h.addEvent(this,"click",e.tabClicked);});if(typeof e.el.moreText!=="undefined"){d.push("showHide"); }h.library({name:d},h);this.library.tooltip.init(c,{appendTo:function(i){return i.parent(); },getPosition:function(i){return i.position();},openTooltipCallback:e.openTooltipCallback,closeTooltipCallback:e.closeTooltipCallback}); if(typeof e.library.showHide!=="undefined"){e.el.moreText.setAttribute("data-open",false); shouldShowSeeMore=e.library.showHide.init({targetClassName:["hide","show"],sourceClassName:["icon-less","icon-more"],thresholdHeight:f,seeLessLength:b,callback:e.moreInfoLinkClicked}); }e.openActiveTabOnLoad();this.library.lightBox.init(c);h.listen({deactivate_menu:e.deactivateMenu,"view-resized":e.updateInfoView}); h.checkWindowResizeView();e.checkInitView();e.moveDate();if(typeof e.el.ticketLimitSection!=="undefined"){e.setTicketLimit(settings.ticketLimit); }},destroy:function(){e=null;h.ignore(["open-tab","close-tab"]);},openActiveTabOnLoad:function(){h.foreach(e.el.tabs,function(){if(h.hasClass(this,"active")){var i=this.getAttribute(h.DATA_ATTR+"tab"); e.openTab(i,this);}});},openTooltipCallback:function(i,k){var m=k.getAttribute("id"),j=h.find(".limit .tooltip .close")[0],l; if(typeof e.el.ticketLimitSection!=="undefined"&&m&&m==="ticket_limit_icon_details"){l=h.outerHeight(e.el.ticketLimitSection); h.addClass(e.el.ticketLimitSection,"tooltip-open");h.find(".limit .tooltip")[0].style.top=l+"px"; j.style.top="-"+l+"px";h.addEvent(e.el.ticketLimitSection,"click",e.ticketLimitClick); }},closeTooltipCallback:function(){if(typeof e.el.ticketLimitSection==="undefined"){return false; }h.removeClass(h.find(".ticket-limit")[0],"tooltip-open");h.removeEvent(e.el.ticketLimitSection,"click",e.ticketLimitClick); },ticketLimitClick:function(){return false;},setTicketLimit:function(i){if(typeof e.el.ticketLimitSection==="undefined"){return false; }var j=h.find(".ticketLimit")[0];j.innerHTML=i;return j;},hideSeeMoreIfNotNeeded:function(){var i; if(typeof e.library.showHide!=="undefined"){i=e.library.showHide;}else{return false; }if(i.isExpansionRequired===false){e.el.jsSeeMore.style.display="none";}else{e.el.jsSeeMore.style.display=""; }},moreInfoLinkClicked:function(i){if(i==="show"&&h.getCurrentView()!=="desktop"){e.deactivateMenu(); e.tabClosed();}if(h.hasClass(this,"seeEvent")){return;}if(i==="show"){this.innerHTML=" "+this.getAttribute("data-mnx-less"); }else{this.innerHTML=" "+this.getAttribute("data-mnx-more");e.omnitureSeeMore(); }},updateInfoView:function(i){if(typeof e.library.showHide!=="undefined"){e.library.showHide.refreshSeeMore(); e.hideSeeMoreIfNotNeeded();}if(typeof i==="undefined"){i={};i.currentView=e.currentView; }if((i.currentView!=="desktop")&&h.hasClass(e.el.jsSeeEvent,"icon-more")){e.el.moreTextContent.style.height=0; }e.moveDate();e.currentView=i.currentView;},checkInitView:function(){e.currentView=h.checkMatchMedia("desktop")===true?"desktop":"notDesktop"; e.updateInfoView();},closeSeeMore:function(j){var i=e.currentView=="desktop"?e.el.jsSeeMore:e.el.jsSeeEvent; if(!h.hasClass(h.find(".moreTextContent .showHide-lessText"),"show")){h.triggerEvent(i,"click"); }},omnitureSeeMore:function(j){var i={};i.tmLink="tm_edp_seemore";i.el=e.el.jsSeeMore; h.notify({type:"omniture-link-track",data:i});},moveDate:function(){var k=h.checkMatchMedia("smallScreen")?true:false,l=h.find("#dateInfo")[0],j=h.find("#dateLargeScreen")[0],i=h.find("#dateSmallScreen")[0]; if(typeof l=="undefined"){return false;}if(k){i.appendChild(l);}else{j.appendChild(l); }},tabClicked:function(k){var j=k.currentTarget,i=j.getAttribute(h.DATA_ATTR+"tab"); e.disableSubmenu();e.resetTabsToDefault();if(h.hasClass(j,"active")){e.closeTab(i,j); }else{e.openTab(i,j);}k.preventDefault();return false;},openTab:function(j,k){var i=h.find(".icon",k); if(!h.isTabAnimated(".tab")){e.tabOpened(j);e.deactivateMenu();h.addClass(k,"active"); h.removeClass(i,"icon-more");h.addClass(i,"icon-less");h.addClass(k.parentNode,"active"); }},closeTab:function(j,k){var i=h.find(".icon",k);if(!h.isTabAnimated(".tab")){e.tabClosed(j); e.deactivateMenu();h.removeClass(k,"active");h.removeClass(i,"icon-less");h.addClass(i,"icon-more"); h.removeClass(k.parentNode,"active");}},deactivateMenu:function(){h.foreach(e.el.tabs,function(){var i=h.find(".icon",this); h.removeClass(this,"active");h.addClass(i,"icon-more");h.removeClass(i,"icon-less"); h.removeClass(this.parentNode,"active");});},disableSubmenu:function(){h.notify({type:"deactivate_Submenu",data:null}); },resetTabsToDefault:function(){h.notify({type:"subtabDefault",data:null});},lightBoxLinkClicked:function(){h.notify({type:"open-lightBox",data:null}); },tabOpened:function(i){h.notify({type:"open-tab",data:i});},tabClosed:function(i){h.notify({type:"close-tab",data:i}); }};});});