$(function(){
	$(".headnav li").eq(0).addClass("navcurrent");
	loginStatus();//判断个人是否登录
	//加载页面时,判断企业账号是否登录
	var orgid = $.cookie('orgId');
	$("#cmpSettled").on("click",function(){
		if (orgid && orgid != "null" && orgid != null) {
			location.href="cmp-portal/cmp-workspaces.html"
		}else{
			location.href="cmp-portal/cmp-settled-reg.html"
		}
	})
	
	$("#gocmp").on("click",function(){
		if (orgid && orgid != "null" && orgid != null) {
			location.href="cmp-portal/cmp-workspaces.html"
		}else{
			location.href="cmp-portal/cmp-settled-log.html"
		}
	})
	
	/*发布需求*/
	$("#postNow").click(function(){
		if(userid=="null"||userid==undefined){
			location.href="login.html";
		}
		$.ajax({
			url: "/ajax/professor/auth",
			type: "GET",
			timeout: 10000,
			dataType: "json",
			data: {
				"id": userid,
			},
			success: function(data, textState) {
				if(data.success) {
					var $rta=data.data;
					if($rta.authStatus==3){
						location.href="myDemand.html";
					}else{
						location.href="realname-authentication.html"
					}
					
				}

			},
			error: function(XMLHttpRequest, textStats, errorThrown) {

			}
		})
	})
	/*我是专家*/
	$("#JoinKeXiu").click(function(){
		if(userid=="null"||userid==undefined){
			location.href="login.html";
		}
		location.href="expert-authentication.html"
	})
	
	//热门领域
	$(".field").bind("click",function(){
		location.href = "search.html?subject=" + encodeURI($(this).text());
	})
	//热门专家
	$('.professor').hover(function() {
		$(this).find(".professor-data").stop(true, false).animate({
			"padding": "94px 0",
			"top": "-50px"
		})
	}, function() {
		$(this).find(".professor-data").stop(true, false).animate({
			"padding": "25px 0",
			"top": "58%"
		})
	})
	
})