var closePopup = false;
var pro_path = getRootPath();

function getRootPath(){
	var strFullPath=window.document.location.href;
	var strPath=window.document.location.pathname;
	var pos=strFullPath.lastIndexOf(strPath);
	var prePath=strFullPath.substring(0,pos+1);
	var postPath=strPath.substring(0,strPath.substr(1).indexOf('/')+1);
	return(prePath);
}

/**
  * 注册跳转
  */
function registerTo(type){
	if(type == 0){
		window.location.href=pro_path+"/Login.do?method=userAgreement&userFlg=1";
	}else if(type == 1){
		window.location.href=pro_path+"/Login.do?method=userAgreement&userFlg=2";
	}
}

/**
  * 登录跳转
  */
function loginTo(type){
	if(type == 0){
		window.location.href=pro_path+"/Login.do?method=goToperLogin";
	}else if(type == 1){
		window.location.href=pro_path+"/Login.do?method=goToenterLogin";
	}
}

/**
  * 登录/注册浮动框显示
  */
function showPopup(type) {
	
	var content = "";
	if(type == 0) {	// 登录框
		content = "<ul><li><a href='###' onclick='loginTo(0);return false;'>个人会员登录</a></li>" + 
				  "<li><a href='###' onclick='loginTo(1);return false;'>企业会员登录</a></li></ul>";
		closePopup = false;
		$("#member_popup").html(content);
		$("#member_popup").show();
	} else if(type == 1){	// 注册框
		content = "<ul><li><a href='###' onclick='registerTo(0);return false;'>个人会员注册</a></li>" + 
				  "<li><a href='###' onclick='registerTo(1);return false;'>企业会员注册</a></li></ul>";
		$("#member_popup").html(content);
		$("#member_popup").show();
		closePopup = false;
	} else {
		setTimeout(hidePopup , 100);
	}
}
/**
  * 登录/注册浮动框隐藏
  */
function hidePopup() {
	if(closePopup) {
		$("#member_popup").hide();
	}
}

