//menu
$(document).ready(function(){
	
	$(".viewcon").find("img").each(function(index, element) {
        if($(this).width() > 950) {
			$(this).css({"height":"auto","width":"100%"});
		}
    });
$('.vnav li').hover(function(){
		$(this).children('div').show();
		},function(){
		$(this).children('div').hide();
		})	
$('.vnav li:last').each(function(index, element) {
    $(this).css('border',0)
});		
		
//menu
$('.menu li').mouseover(function(){
	$(this).find('.cur').removeClass('cur');
	$(this).find('.nav').slideDown();
	$(this).children('a').addClass('cur');
	});
$('.menu li').mouseleave(function(){
	$(this).find('.nav').slideUp();
	$(this).children('a').removeClass('cur');
	});
	$('.news_list li:odd').addClass('newseven');
	$('.knowledgeul li:last').css('border',0);


		 $('.codepic').hover(function(){$('.code').fadeIn()},function(){$('.code').fadeOut()});
    $('.backup,.topbut').click(function(){
        $('body,html').animate({scrollTop:0},500)
    });
    $(".backup").hide();
    $(function () {
        $(window).scroll(function(){
            if ($(window).scrollTop()>500){
                $(".backup").fadeIn(1000);
            }else{
                $(".backup").fadeOut(1000);
            }
        })
   })
	
  });


function Tab(btn,btnid,btnclass,con,conclass){
	var self = this ;
	var dq ;
	self.init = function(){
		btn.bind("hover",self.TheClick)
		btn.hover(
			function(){
				if($(this).attr("id")!=btnid){
					$(this).attr("class",btnclass);
				}
				
			},
			function(){
				if($(this).attr("id")!=btnid){
					$(this).attr("class",btnclass+"01");
				}
		 });
	}
	self.TheClick = function(){
		dq = btn.index(this);
		$("." + btnclass ).attr("class",btnclass+"01");
		$(this).attr("class",btnclass);
		$("#"+ btnid).removeAttr("id");
		$(this).attr("id",btnid);
		$("." + conclass).attr("class",conclass + "01");
		con.eq(dq).attr("class",conclass);
	}
	
	
}

$(function(){
	var TheBtn = $(".tab_ul li"),TheId = "TheDq",TheBtnClass = "tab_title_li",TheCon = $(".con>li"),TheConClass = "con_li";
	TheTab = new Tab(TheBtn,TheId,TheBtnClass,TheCon,TheConClass);
	TheTab.init();
	
	var TheBtn02 = $(".xtab_ul li"),TheId02 = "TheDq02",TheBtnClass02 = "xtab_li",TheCon02 = $(".xtab_ul01 li"),TheConClass02 = "xtab_con";
	TheTab02 = new Tab(TheBtn02,TheId02,TheBtnClass02,TheCon02,TheConClass02);
	TheTab02.init();
	
	var TheBtn01 = $(".TheTab_ul li"),TheId01 = "TheTheTabDq",TheBtnClass01 = "TheTab_title_li",TheCon01 = $(".TheCon li"),TheConClass01 = "TheCon_li";
	TheTab01 = new Tab(TheBtn01,TheId01,TheBtnClass01,TheCon01,TheConClass01);
	TheTab01.init();
	
	var TheBtn = $(".ptab_ul li"),TheId = "TheDq",TheBtnClass = "ptab_title_li",TheCon = $(".pcon li"),TheConClass = "pcon_li";
	TheTab = new Tab(TheBtn,TheId,TheBtnClass,TheCon,TheConClass);
	TheTab.init();
	
	
	var TheBtn = $(".hr_tab li"),TheId = "TheDq1",TheBtnClass = "hr_t_li",TheCon = $(".hrcon div"),TheConClass = "hrcon_li";
	TheTab = new Tab(TheBtn,TheId,TheBtnClass,TheCon,TheConClass);
	TheTab.init();	
	var TheBtn = $(".Lhr_tab li"),TheId = "TheDq2",TheBtnClass = "Lhr_t_li",TheCon = $(".Lhrcon div"),TheConClass = "Lhrcon_li";
	TheTab = new Tab(TheBtn,TheId,TheBtnClass,TheCon,TheConClass);
	TheTab.init();	
	var TheBtn = $(".Jhr_tab li"),TheId = "TheDq3",TheBtnClass = "Jhr_t_li",TheCon = $(".Jhrcon div"),TheConClass = "Jhrcon_li";
	TheTab = new Tab(TheBtn,TheId,TheBtnClass,TheCon,TheConClass);
	TheTab.init();	



//website

	var TheBtn = $(".Wtab_ul li"),TheId = "TheDq",TheBtnClass = "Wtab_title_li",TheCon = $(".Wcon li"),TheConClass = "Wcon_li";
	TheTab = new Tab(TheBtn,TheId,TheBtnClass,TheCon,TheConClass);
	TheTab.init();
	
	
	var TheBtn03 = $(".xszsul02 li"),TheId03 = "xszsId",TheBtnClass03 = "xszsbtn",TheCon03 = $(".xszsul li"),TheConClass03 = "xszsli";
	TheTab03 = new Tab(TheBtn03,TheId03,TheBtnClass03,TheCon03,TheConClass03);
	TheTab03.init();

	
})

var JPlaceHolder = {
    _check : function(){
        return 'placeholder' in document.createElement('input');
    },
    init : function(){
        if(!this._check()){
            this.fix();
        }
    },
    fix : function(){
        jQuery(':input[placeholder]').each(function(index, element) {
            var self = $(this), txt = self.attr('placeholder');
            self.wrap($('<div></div>').css({position:'relative', display:'inline', position:'relative', float:'left', margin:'0 0 15px 4px'}));
            var pos = self.position(), h = self.outerHeight(true), paddingleft = self.css('margin-left');
            var holder = $('<span></span>').text(txt).css({position:'absolute',margin:'0 0 0 15px',left:pos.left, top:pos.top, height:h, lienHeight:h, paddingLeft:paddingleft, color:'#aaa'}).appendTo(self.parent());
            self.focusin(function(e) {
                holder.hide();
            }).focusout(function(e) {
                if(!self.val()){
                    holder.show();
                }
            });
            holder.click(function(e) {
                holder.hide();
                self.focus();
            });
        });
    }
};
jQuery(function(){
    JPlaceHolder.init();    
});