$(document).ready(function(){
	$(".unlogin").removeClass("displayNone");
	
	var footerHeight = $("footer").outerHeight(true);
	$('#container').css("padding-bottom", footerHeight +"px" );
	//窗口大小变更事件
	$(window).resize(function() {
		footerHeight=$("footer").outerHeight(true);
		$('#container').css("padding-bottom", footerHeight +"px" );
		//console.log(footerHeight)
	});
	
	$(document).scroll(function() {
		var top = $(document).scrollTop();
		if (top == 0) {
			$(".navheader").removeClass("navhdown");
		} else {
			$(".navheader").addClass("navhdown");
		}
	})
	//退出登录转态
	$("#exitLogin").on("click",function(){
		exit();
	})
	//判断登录转态
	var orgId = $.cookie("orgId");
	if (orgId && orgId != "null" && orgId != null) {
		$(".unlogin").addClass("displayNone");
		$(".onlogin").removeClass("displayNone");
		$.ajax("/ajax/image/hasOrgLogo", {
			data:{"id":orgId},
			type: "GET",
			dataType: 'json',
			async: false,
			success: function($data) {
				if($data.success){
					if($data.data){
						$("#imglogo").attr("src","/images/org/"+orgId+".jpg");
					}
				}
			},
			error: function() {
				$.MsgBox.Alert('提示', '服务器请求失败')
			},
		});
	}else{
		$(".unlogin").removeClass("displayNone");
		$(".onlogin").addClass("displayNone");
	}
});
//Model模态框打开关闭
function modelOpen(){
	$(".blackcover").fadeIn();
	$(".modelContain").slideDown();
	$("body").addClass("modelOpen");
}
function modelClose(){
	$(".modelContain").slideUp();
	$(".blackcover").fadeOut();
	$("body").removeClass("modelOpen");
}

function exit(){
	$.cookie('orgId', null,{path:"/"}); 
	$.cookie('orgAuth', null,{path:"/"}); 
	$.cookie('orgEmail', null,{path:"/"}); 
	$.cookie('orgName', null,{path:"/"}); 
	$.cookie('orgType', null,{path:"/"}); 
	location.href="cmp-settled-log.html"	
}




//截取url传值
function GetQueryString(name) { 
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 	
	var r = window.location.search.substr(1).match(reg);  //��ȡurl��"?"�����ַ�����ƥ��

	var context = ""; 
	if (r != null) 
		 context = r[2]; 
	reg = null; 
	r = null; 
	return context == null || context == "" || context == "undefined" ? "" : decodeURI(context); 
}

//转换格式
function changeTime(dealtime){
	   var s = dealtime;
	   //console.log(s);
	   if(dealtime.length==8){
	   	var y = s.substr(0,4);
	   var m = s.substr(4,2);
	   var d = s.substr(6,2);			  
	   var formatTime = y+"-"+m+"-"+d;
		return formatTime;
	   }
	   else
	   {
	   	var y = s.substr(0,4);
	   var m = s.substr(4,2);
	   var d = s.substr(6,2);
	   var h = s.substr(8,2);
	   var minute = s.substr(10,2);
	   var formatTime = y+"-"+m+"-"+d+" "+h+":"+minute;
		return formatTime;
	   }
	   
	}
//过滤特殊字符  
function replaceStr(s) 
{ 
	var pattern = new RegExp("-");
	var rs = ""; 
	for (var i = 0; i < s.length; i++) { 
		rs = rs+s.substr(i, 1).replace(pattern, ''); 
	} 
	return rs; 
} 	

//根据用户输入的Email跳转到相应的电子邮箱首页  
var hash={  
    'qq.com': 'http://mail.qq.com',  
    'gmail.com': 'http://mail.google.com',  
    'sina.com': 'http://mail.sina.com.cn',  
    '163.com': 'http://mail.163.com',  
    '126.com': 'http://mail.126.com',  
    'yeah.net': 'http://www.yeah.net/',  
    'sohu.com': 'http://mail.sohu.com/',  
    'tom.com': 'http://mail.tom.com/',  
    'sogou.com': 'http://mail.sogou.com/',  
    '139.com': 'http://mail.10086.cn/',  
    'hotmail.com': 'http://www.hotmail.com',  
    'live.com': 'http://login.live.com/',  
    'live.cn': 'http://login.live.cn/',  
    'live.com.cn': 'http://login.live.com.cn',  
    '189.com': 'http://webmail16.189.cn/webmail/',  
    'yahoo.com.cn': 'http://mail.cn.yahoo.com/',  
    'yahoo.cn': 'http://mail.cn.yahoo.com/',  
    'eyou.com': 'http://www.eyou.com/',  
    '21cn.com': 'http://mail.21cn.com/',  
    '188.com': 'http://www.188.com/',
    'ustb.edu.cn': 'http://mail.ustb.edu.cn/',
    'foxmail.coom': 'http://www.foxmail.com'  
};
/*标志*/
function autho() {
	if(arguments[0] == 1) {
		return {
			"sty": "authicon-pro",
			"title": "科袖认证专家"
		}
	} else {
		if(arguments[1] == 1) {
			return {
				"sty": "authicon-staff-ok",
				"title": "企业认证员工"
			}
		} else {
			if(arguments[2] == 3) {
				return {
					"sty": "authicon-real",
					"title": "实名认证用户"
				}
			}else{
				return {
					"sty": "e",
					"title": " "
				}
			}
		}
	}
}


/*时间转换*/
function TimeTr(dealtime) {
	var myDate = new Date(); 
	var s = dealtime;
	var y = s.substr(0, 4);
	var m = s.substr(4, 2);
	var d = s.substr(6, 2);
	var h = s.substr(8, 2);
	var minute = s.substr(10, 2);
	var formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "")+ "日 " + h + ":" + minute;
	if(y != myDate.getFullYear()){
		formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "")+ "日 " + h + ":" + minute;
	}
	return formatTime;
}
/*时间格式转换*/
//function timeTran(otm) {
//	var month, day, hour, minu;
//	var monFirst = otm.substring(4, 5);
//	var dayFirst = otm.substring(6, 7);
//	if(monFirst == "0") {
//		month = otm.substring(5, 6)
//	} else {
//		month = otm.substring(4, 6)
//	}
//	if(dayFirst == "0") {
//		day = otm.substring(7, 8);
//	} else {
//		day = otm.substring(6, 8);
//	}
//	hour = otm.substring(8, 10);
//	minu = otm.substring(10, 12);
//	return month + "月" + day + "日 " + hour + ":" + minu;
//}