
$(function(){
	banner();
	index();
	share();
	toolbar();
    if($(".talentPage").length){
		$(".zhaopinCon .title h3").click(function(){
			var index=$(this).index();
			$(this).addClass("cur").siblings("h3").removeClass("cur");
			$(".zhaopinCon .zlist").eq(index/2).show().siblings(".zlist").hide();
		});
		
		$(".talentPage .zlist").each(function(){
			if($(this).find(".item").length > 18){
				$(this).find(".item:gt(17)").hide();
			}
		});
		$(".talentPage .zlist .seemore").click(function(){
			$(this).parent(".list2").find(".item:gt(17)").show();
			$(this).hide();
		})
		
		var _item=$(".talentPage .item");
		$(".talentPage").on("click",".item .btn",function(){
			$(this).siblings(".itemCon").show();
			layout(1);
		})
		$(".talentPage").on("click",".item .btn2",function(){
			var txt=$(this).siblings(".title").find("em").text();
			$(".jobinfo .title span").text(txt);
			$(".jobinfo").show();
		})
		$(".talentPage .close").click(function(){
			$(this).parents(".itemCon").hide();
			layout(0);
		})
		$(".jobinfo .close2").click(function(){
			$(".jobinfo").hide();
		})
	}
    
});
function index(){
	if (!$("#banner").length) { return false; }
	var _advn=$("#iadvanCon"),_advan_item=_advn.find(".bigarea");
	_advn.find(".smallarea .item").hover(function(){
		var index=$(this).index();
		$(this).addClass("hover").siblings().removeClass("hover");
		var bigimg=$(this).find("img").attr("data-big");
		_advan_item.find("img").attr("src",bigimg);
	},function(){});
	
	
	
	jQuery(".icooper").slide({mainCell:".icooperCon .list",autoPage:true,effect:"left",autoPlay:false,vis:7});
}

function toolbar(){
	$('#toolbar dd').bind({
		'mouseenter': function(){
			if($(this).children('.slide').length){
				var _this = $(this).children('.slide');
				_this.stop(true, true).animate({'width': 180}, 200);
			}else if($(this).children('.pop').length){
				var _this = $(this).children('.pop');
				_this.show().animate({'right': 65}, 200);
			}
		},
		'mouseleave': function(){
			if($(this).children('.slide').length){
				var _this = $(this).children('.slide');
				_this.stop(false, false).animate({'width': 0}, 200);
			}else if($(this).children('.pop').length){
				var _this = $(this).children('.pop');
				_this.hide().animate({'right': 90}, 200);
			}
		}
	});
	$("#top").click(function () {
        $("body, html").stop().animate({ "scrollTop": 0 });
    });
}

function banner(){
	if (!$("#banner").length || $("#banner .list li").length <= 1) { return false; }
	var _this = $("#banner"),
		me = $("#banner .list"),
		tip = $("#banner .tip"),
		t, interval = 5000,
		speed = 1000,
		speed2 = 700,
		n = 0,
		N = me.children("li").length;
		me.find("li:gt(0)").hide();
	if ($("#banner .tip").length) {
		var htmlTip = "";
		for (var i = 0; i < N; i++) {
			if (i == 0) {
				htmlTip += "<span class='cur'></span>";
			} else {
				htmlTip += "<span></span>";
			}
		}
		tip.append(htmlTip);
	}
	var func = function() {
		if (n >= N - 1) {
			n = 0;
		} else {
			n++;
		}
		me.children("li").eq(n).css({
			"z-index": 2
		}).stop().fadeIn(speed).siblings("li").css({
			"z-index": 1
		}).stop().fadeOut(speed2);
		if ($("#banner .tip").length) {
			tip.find("span").eq(n).addClass("cur").siblings().removeClass("cur");
		}
	}
	tip.children("span").mouseover(function() {
		clearInterval(t);
		n = $(this).index()-1;
		func();
	});
	t = setInterval(func, interval);
	_this.hover(function(){
		clearInterval(t);
	},function(){
		t = setInterval(func, interval);
	});
}
//share
function share(){
	window._bd_share_config = {
    "common": {
        "bdSnsKey": {},
        "bdText": "",
        "bdMini": "2",
        "bdMiniList": false,
        "bdPic": "",
        "bdStyle": "0",
        "bdSize": "16"
    },
    "share": {},
    "slide": { // 跟图标式的代码相比，这里是添加了浮窗式 slide 属性配置
        "type": "slide",
        "bdImg": "5",
        "bdPos": "left",
        "bdTop": "100"
    }
};
	window._bd_share_config = {
		share : [{
			"bdSize" : 16
		}],
	}
	with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
}

function layout(u){
	var $obj = $('<div class="dialog-layout"></div>');
	if(u == 0){
		$('.dialog-layout').remove();
	}else{
		if(!$('.dialog-layout').length){
			$obj.appendTo('body').show();
		}
	}
}