/**
 *  首页脚本
 */
 
KISSY.ready(function(S) {
					 
		//搜索下面的图片轮播Slide
        var DOM = S.DOM,
            descList = DOM.children('#carousel_ad .desc-list');

        var slide = new S.Slide('#carousel_ad', {
            contentCls: 'yslider-stage',
            navCls: 'yslider-stick',
            activeTriggerCls: 'top_here',
            effect: 'fade',
            easing: S.Easing.easeOutStrong
        });

        slide.on('beforeSwitch', function(ev) {
            S.each(descList, function(desc, i) {
                desc.style.display = i === ev.toIndex ? 'block' : 'none';
            });
        });
		
		//分类专栏图片轮播Slide
        var slide = new S.Slide('#woman_ad', {//女人专栏
            contentCls: 'yslider-stage',
            navCls: 'yslider-stick',
            activeTriggerCls: 'top_here',
            effect: 'fade',
            easing: S.Easing.easeOutStrong
        });

        var slide = new S.Slide('#man_ad', {//男人专栏
            contentCls: 'yslider-stage',
            navCls: 'yslider-stick',
            activeTriggerCls: 'top_here',
            effect: 'fade',
            easing: S.Easing.easeOutStrong
        });

        var slide = new S.Slide('#drug_ad', {//药妆专栏
            contentCls: 'yslider-stage',
            navCls: 'yslider-stick',
            activeTriggerCls: 'top_here',
            effect: 'fade',
            easing: S.Easing.easeOutStrong
        });

        var slide = new S.Slide('#children_ad', {//儿童专栏
            contentCls: 'yslider-stage',
            navCls: 'yslider-stick',
            activeTriggerCls: 'top_here',
            effect: 'fade',
            easing: S.Easing.easeOutStrong
        });

        var slide = new S.Slide('#elderly_ad', {//老人专栏
            contentCls: 'yslider-stage',
            navCls: 'yslider-stick',
            activeTriggerCls: 'top_here',
            effect: 'fade',
            easing: S.Easing.easeOutStrong
        });

		//商城公告Tabs
		var tabs = new S.Tabs('#i_news_box');
		tabs.on('beforeSwitch', function(ev) {});

});


$(document).ready(function(){
					   
	//如果首页轮播广告的图片数为1时，隐藏数字按钮和其背景
	$('#carousel_ad, #woman_ad, #man_ad, #drug_ad, #drug_ad, #children_ad, #elderly_ad').each(function(){
		if($(this).find('.top_show_img a').size() == 1)
		{
			$(this).find('.top_hot_font, .top_text_bg').hide();
		}
	});
	
});

