//搜索
$(function() {
    $('.n17_navs_search').hide();
    $('.n17_search_show').click(function(e) {
        e.stopPropagation();
        $(this).hide().siblings('.n17_navs_search').show()
            .css('width', '30').animate({ width: 146 }, 500);
    });
    $('.n17_navs_search').on('click', function(e) {
        e.stopPropagation();
    });
    $(document).on('click', function(e) {
        $('.n17_navs_search').animate({ width: 30 }, 500, function() {
            $(this).hide();
            $('.n17_search_show').show();
        });
    });
});

//二维码
$(function() {
    $('.n17_box_code').hide();
    $('.n17_phone_ul li a').mouseover(function() {
        $(this).siblings('.n17_box_code').stop().fadeIn();
    });
    $('.n17_phone_ul li a').mouseout(function() {
        $(this).siblings('.n17_box_code').stop().fadeOut();
    });
});

//瑞丽STAR
$(function() {
    var speed = 250;
    $('.n17_star_tip').css({ 'opacity': 0, 'top': 280 });
    $('.n17_box_star li').mouseover(function() {
        $(this).find('.n17_star_name').stop().animate({ 'opacity': 0 }, speed);
        $(this).find('.n17_star_tip').stop().animate({ 'opacity': 1, 'top': 0 }, speed);
    }).mouseleave(function() {
        $(this).find('.n17_star_name').stop().animate({ 'opacity': 1 }, speed);
        $(this).find('.n17_star_tip').stop().animate({ 'opacity': 0, 'top': 280 }, speed);
    });
});

$(function() {
    var speed = 250;
    $('.n17_mod_tip').css({ 'opacity': 0, 'top': 180 });
    $('.n17_box_model li').mouseover(function() {
        $(this).find('.n17_mod_name').stop().animate({ 'opacity': 0 }, speed);
        $(this).find('.n17_mod_tip').stop().animate({ 'opacity': 1, 'top': 0 }, speed);
    }).mouseleave(function() {
        $(this).find('.n17_mod_name').stop().animate({ 'opacity': 1 }, speed);
        $(this).find('.n17_mod_tip').stop().animate({ 'opacity': 0, 'top': 180 }, speed);
    });
});

//MOBILE移动
$(function() {
    $('.n17_mobile_all>div').on('mouseover', function() {
        $(this).css('z-index', 90).stop().animate({ bottom: 20 }, 300).find('div:last').fadeIn();
    }).on('mouseleave', function() {
        $(this).css('z-index', '').stop().animate({ bottom: 0 }, 300).find('div:last').fadeOut();
    }).each(function(i, e) {
        $(e).find('div:last').hide();
    });
});

//美妆互动
$(function() {
    $('.n17_up_box').hide();
    $('.n17_active_box').each(function(i, e) {
        $('.n17_up_body:first .n17_up_box', e).show();
        $('.n17_up_body:first .n17_li_showli', e).hide();
    });
    //$(".n17_up_body").mouseover(function(e) {
    //    var parent = $(this).parent('.n17_active_box');
    //    $(".n17_up_box", parent).hide();
    //    $(".n17_li_showli", parent).show();
    //    $(".n17_up_box", this).show();
    //    $(".n17_li_showli", this).hide();
    //});
});

//瑞丽深度        
$(function() {
    function tabs(tabTit, on, tabCon) {
        $(tabTit).children().mouseover(function() {
            $(this).addClass(on).siblings().removeClass(on);
            var index = $(tabTit).children().index(this);
            $(tabCon).children().eq(index).show().siblings().hide();
        });
    };
    $('.n17_pick_show').hide().eq(0).show();
    tabs(".n17_pick_ul", "n17_current", ".n17_pick_list");
});

//杂志
$(function() {
    $('.n17_maga_ma').hide();
    $('.n17_maga_show').mouseover(function() {
        $(this).find('.n17_maga_ma').addClass('ani_ma').show();
    }).mouseleave(function() {
        $(this).find('.n17_maga_ma').removeClass('ani_ma').hide();
    });
});

//first slide
$(function() {
    $('.n17_slides').slidesjs({
        play: {
            auto: true,
            effect: "slide"
        },
        navigation: {
            active: true,
            effect: "slide"
        },
        pagination: {
            click: false,
            effect: "slide"
        },
        effect: {
            slide: {
                speed: 1000
            }
        }
    });

    $('.slidesjs-previous', '.n17_slides').css({ left: -100 });
    $('.slidesjs-next', '.n17_slides').css({ right: -100 });
    $('.n17_slides').on('mouseover', function(event) {
        $('.slidesjs-previous', this).stop().animate({ left: 10 }, 300);
        $('.slidesjs-next', this).stop().animate({ right: 10 }, 300);
    }).on('mouseleave', function(event) {
        $('.slidesjs-previous', this).stop().animate({ left: -100 }, 300);
        $('.slidesjs-next', this).stop().animate({ right: -100 }, 300);
    });
});

//today slide
$(function() {
    $('.n17_slides_today').slidesjs({
        play: {
            auto: true,
            effect: "fade"
        },
        navigation: {
            active: false,
            effect: "fade"
        },
        pagination: {
            click: false,
            effect: "fade"
        },
        effect: {
            slide: {
                speed: 1000
            }
        }
    });
});

//优品驾到 slide
$(function() {
    $('.n17_slides_youp').slidesjs({
        play: {
            auto: true,
            effect: "slide"
        },
        navigation: {
            active: false,
            effect: "slide"
        },
        pagination: {
            click: false,
            effect: "slide"
        },
        effect: {
            slide: {
                speed: 1000
            }
        }
    });
});

//抢先试用 slide
$(function() {
    $('.n17_try_slide').slidesjs({
        play: {
            auto: true,
            effect: "slide"
        },
        navigation: {
            active: false,
            effect: "slide"
        },
        pagination: {
            click: false,
            effect: "slide"
        },
        effect: {
            slide: {
                speed: 1000
            }
        }
    });
});

//focus slide
$(function() {
    $('.n17_slides_focus').slidesjs({
        play: {
            auto: true,
            effect: "fade"
        },
        navigation: {
            active: false,
            effect: "fade"
        },
        pagination: {
            click: false,
            effect: "fade"
        },
        effect: {
            fade: {
                speed: 800
            }
        }
    });
});

//small slide
$(function() {
    $('.n17_slides_s').slidesjs({
        play: {
            auto: true,
            effect: "slide"
        },
        navigation: {
            active: false,
            effect: "slide"
        },
        pagination: {
            click: false,
            effect: "slide"
        },
        effect: {
            slide: {
                speed: 1000
            }
        }
    });
});

//new slide
$(function() {
    $('.n17_slides_new').slidesjs({
        play: {
            auto: true,
            effect: "slide"
        },
        navigation: {
            active: true,
            effect: "slide"
        },
        pagination: {
            active: false,
            click: false,
            effect: "slide"
        },
        effect: {
            slide: {
                speed: 1000
            }
        }
    });
});

//瑞丽视觉 slide
$(function() {
    $('.n17_slides_v').slidesjs({
        play: {
            auto: true,
            effect: "slide"
        },
        navigation: {
            active: true,
            effect: "slide"
        },
        pagination: {
            active: false,
            click: false,
            effect: "slide"
        },
        effect: {
            slide: {
                speed: 1000
            }
        }
    });
});

$(function(){
	$('.slidesjs-pagination').each(function() {
		$(this).css('margin-left', -$(this).width()/2);
	});
});
