var NALA=NALA||{};NALA.homePage={init:function(){var that=this;that.oneday();that.swichable();that.mainNav_animate();(function(){var _Date=new Date(),day=_Date.getDay(),nowTimes=_Date.getTime(),endTimes=_Date.setHours(20,30,0,0).valueOf();if(day==4&&(nowTimes<endTimes)){that.showDay4AD();}
var day_week=$('#weekday-yugao').find('dt').switchable("#weekday-yugao .bd",{api:true});if(day<6){day_week.move(day-1);}})();},swichable:function(){$(".trigger_hd").switchable(".switchable_hd li",{effect:"lazyScroll",speed:0.7,delay:0.12,triggerType:"mouse",easing:"swing",vertical:false,circular:true}).carousel().autoplay({interval:7,order:true,api:true});$(".brand_btn").switchable(".brands_con ul",{speed:0.7,delay:0.12,triggerType:"click",vertical:false});},mainNav_animate:function(){var $mainCata=$("#J_mainCata"),$subCata=$("#J_subCata"),animater=null;$mainCata.on("mouseenter","li",function(){var $this=$(this),_index=$this.index();$this.addClass("current").siblings().removeClass("current");if(animater!==null){clearTimeout(animater);}
animater=setTimeout(function(){$subCata.find(".J_subView").hide().eq(_index).show();if($subCata.is(":hidden")){$subCata.css({"display":"block"}).animate({left:176},200,function(){$subCata.css({'z-index':999})});}},200);return false;});$mainCata.parent(".cata_index").on("mouseleave",function(){if(animater!==null){clearTimeout(animater);}
animater=setTimeout(function(){$subCata.find(".J_subView").hide().end().css({"left":0,"z-index":0,"display":"none"});$mainCata.find("li").removeClass("current");},200);}).on("mouseenter",function(){if(animater!==null){clearTimeout(animater);}});},oneday:function(){var $oneday_box=$("#hd_oneday");$oneday_box.load("/item/onedayIndex?"+new Date().getTime(),function(){var $time=$oneday_box.find("em.time"),_time=$time.data('time');if($time.length>0){NALA.common.countDown(_time,{timeDiv:$time});}
var $tit_p=$time.parent('p').prev('p');setInterval(function(){$tit_p.toggleClass('out');},5000);if($oneday_box.find("div.trigger").length>0){var switchGoods=$oneday_box.find("div.trigger").switchable("#hd_oneday li",{effect:"scroll",speed:0.7,triggerType:"click"}).carousel().autoplay({interval:7,api:true});var $trigger=$oneday_box.find("div.trigger-num"),$info=$oneday_box.find("div.info"),_prev=$oneday_box.find("a.prev"),_next=_prev.next('a'),_str='去早场享优惠';if($oneday_box.find('.box-wu').length>0){_str='去午场享优惠';}
switchGoods.onSwitch(function(e,i){var $li=switchGoods.getPanels().eq(i);$info.html('<em class="pink" style="color:#fff;"><b>'+$li.data('nalaprice')+'</b></em>');i++;$trigger.html('<span>'+i+'</span>/4');});_prev.click(function(){switchGoods.prev();});_next.click(function(){switchGoods.next();});$oneday_box.hover(function(){$(this).addClass('oneday-hover');},function(){$(this).removeClass('oneday-hover');});$oneday_box.find('.info1').click(function(){window.open("/item/oneday1");});}
$oneday_box.find('').click(function(){window.open("/item/oneday");});$oneday_box.find('').click(function(){window.open("/item/oneday");});});},showDay4AD:function(){var $li=$('#day4-nav'),_offset=$li.offset(),_left=_offset.left;$ad=$('<div style="left:'+(_left-427)+'px; height:0;" class="day4-nav-ad"><a href="" target="_blank"><img src="http://img.nala.com.cn/images/day4-index-navad.png?050902" /></a><a href="javascript:;" title="关闭" class="iconfont">&#223;</a></div>').appendTo('body'),$bg=$('<div class="bg"></div>').appendTo($li);$ad.animate({'height':'205px'},600,'easeOutBounce').on('click','a.iconfont',function(){claseAD();return false;});setTimeout(function(){claseAD();},3500);function claseAD(){$ad.animate({'width':0,'height':0,'left':_left+50,'top':'115px'},300,'easeOutExpo',function(){$ad.remove();$li.addClass('on');$bg.delay(1000).animate({'opacity':0},500,function(){$li.removeClass('on');});});}},switchHot:function(){var $hot_box=$("#hot_box"),$hot_trg=$("#hot_trigger");$hot_box.find("li").hover(function(){$(this).addClass("hot_hover").siblings("li").removeClass("hot_hover");},function(){$(this).removeClass("hot_hover");});$hot_trg.switchable("#hot_con ul",{effect:"scroll",speed:0.7,triggerType:"click"}).carousel();$hot_trg.html('<span>1</span>/2');var API=$hot_trg.switchable();API.onSwitch(function(e,i){i++;$hot_trg.html('<span>'+i+'</span>/2');});var _prev=$hot_box.find("a.prev"),_next=_prev.next('a');_next.click(function(){API.next();});_prev.click(function(){API.prev();});},switchTheme:function(){var $acTab=$('#ac-tab'),$a=$acTab.find('a'),$li=$acTab.find('li'),$arrow=$acTab.find('.arrow'),$ul=$acTab.next().find('ul');$a.hover(function(){var index=$(this).index(),_ul=$ul.eq(index);$a.removeClass();$(this).addClass('on').prev().addClass('prev-on');$ul.hide();_ul.show();NALA.common.lazyload(_ul);$arrow.css('top',index*67+27);return false;},function(){return false;});$li.hover(function(){},function(){$(this).addClass("hover");});},datalazyload:function(){var $win=$(window),_wheight=$win.height(),$textarea=$('textarea.datalazyload'),_len=$textarea.length,i=0,_areaTop=0;var loadData=function(){if(i<_len){var _sTop=$win.scrollTop(),$tArea=$textarea.eq(i),_areaTop=$tArea.offset().top-_wheight;if(_sTop>=_areaTop){$tArea.before($tArea.val()).remove();dataEvent($tArea);i++;$win.trigger('scroll');}}else{$win.off('scroll',loadData);}};$win.on('scroll',loadData);function dataEvent($t){var type=$t.data('event')||0;switch(type){case 1:NALA.homePage.switchTheme();break;case 2:NALA.homePage.switchHot();break;defalut:break;}}}};$(function(){$('#J_mainCata').find('h1').html('<a target="_blank" href="http://www.lixinedu.com.cn/">立信财会</a>');NALA.homePage.init();NALA.homePage.datalazyload();});