$(function(){
    function Tab(opts) {
        this.init(opts)
    }
    Tab.prototype = {
        $target: null,
        $className:null,
        index: 0,
        init: function (opts) {
            var _this = this;
            _this.$target = opts.$target || $('.J-tab');
            _this.$tit = _this.$target.find('.J-tab-tit');
            _this.$span = _this.$tit.find('span');

            _this.$tabList = _this.$target.find('.J-tab-list');
            _this.$ul = _this.$tabList.find('ul');
            _this.bindEvent(opts.$className);
        },
        bindEvent: function (className) {
            var _this = this;
            _this.$tit.delegate('span','mouseenter', function () {
                $(this).addClass(className).siblings().removeClass(className);
                _this.index = $(this).index();
                _this.$ul.hide().eq(_this.index).show();
            });
        }
    };

    var tab = new Tab({
        $target: $('.J-tab'),
        $className:'setc'
    });
});




$(function () {
    function Create(opt) {
        this.init(opt);
    }
    Create.prototype = {
        init:function(opt){
            var _this = this;
            _this.$ul1 = opt.$target || $('.J-ul1');
            _this.$lis = _this.$ul1.find('li');
            var htmlStr = '';

            _this.$lis.each(function (i) {
                htmlStr = "<span>"+ (i+1) +"</span>";
                $(this).prepend(htmlStr);
                var span = $(this).find('span');
                if(i<3){
                    span.css({"color":"#f00","border-color":"#f00"});
                }
            });
        }
    };
    var create = new Create({
        $target:$('.J-ul1')
    });
    var create2 = new Create({
        $target:$('.J-ul2')
    });
});

$(function () {
    var $textarea = $('.J-text').find('textarea');
    var $btn =  $('.J-text').find('button');
    $textarea.on('input',function(){
        $('.J-default').html('');
    });
    $textarea.on('blur',function(){
        if($textarea.val()){
            $('.J-default').html('');
        }
        else{
            $('.J-default').html('您对报告、信息或者贵宾网员服务有什么要求，欢迎提交给我们，我们尽快为您答复')
        }
    });
});



$(function () {
    $('.J-h_card1').hide();
    function sh(ele1,ele2){
        ele2.hide();
        ele1.on('mouseenter',function () {
            $index = $(this).index();
            ele2.show();
        });
        ele2.on('mouseleave',function () {
            $(this).hide(300);
        });
    }
    sh($('.J-card_1'),$('.J-h_card1'));
    sh($('.J-card_2'),$('.J-h_card2'));
    sh($('.J-card_3'),$('.J-h_card3'));
});






