﻿//注销
function ExitSystem(){
	   	   var HTMLStr = '<div id="MsgDiv" style="width:300px;height:120px;background-color:#f7f9fd">' +
              '  <div style="padding:2px 2px 2px 5px;background-color:#dceefb;text-align:left;font-weight:bold;">提示信息</div>' +
              '  <div style="color:#4e608c;padding:10px 10px 0px 10px;height:40px;">您是否确定注销?</div>' +
              '  <div style="padding:10px 10px 0px 10px;"><input type="button" class="button" value=" 确 定 " onclick="javascript:top.location=\'../Loginout.asp\';" onmousemove="ButtonMove(this)" onmouseout="ButtonOut(this)" />　　'+
              '  <input type="button" class="button" value="取 消" onclick="javascript:$.unblockUI();" onmousemove="ButtonMove(this)" onmouseout="ButtonOut(this)" /></div>' +
              '</div>';
	   	   $.blockUI(HTMLStr);
		
		$("#MsgDiv").parents().css('left',  (document.body.clientWidth/2)  - ($("#MsgDiv").parents().width()/2)  );
		$("#MsgDiv").parents().css('top' ,  (document.documentElement.clientHeight/2) - ($("#MsgDiv").parents().height()/2) );
}
//下载文件时检查是否登录
function CheckUpload( Id,RoleId,CoRoleId,sign,which){

	if (RoleId <= 0 && CoRoleId <= 0){

		 var HTMLStr = '<div id="MsgDiv" style="width:300px;height:120px;background-color:#f7f9fd">' +
			         '  <div style="padding:2px 2px 2px 5px;background-color:#dceefb;text-align:left;font-weight:bold;">提示信息</div>' +
			         '  <div style="color:#4e608c;padding:10px 10px 0px 10px;height:40px;">你必须登录后才能下载与查看，请先登陆！</div>' +
			         '  <div style="padding:10px 10px 0px 10px;"><input type="button" value=" 确 定 " class="button" onclick="javascript:top.location=\'Login.asp?UpId='+Id+'&which='+ which +'\';" onmousemove="ButtonMove(this)" onmouseout="ButtonOut(this)" />　'+
			         '	<input type="button" class="button" value="取 消" onclick="javascript:$.unblockUI();" onmousemove="ButtonMove(this)" onmouseout="ButtonOut(this)" /></div>' +
			         '</div>';
		$.blockUI(HTMLStr);
		$("#MsgDiv").parents().css('left',  (document.documentElement.clientWidth/2)  - ($("#MsgDiv").parents().width()/2)  );
		$("#MsgDiv").parents().css('top' ,  (document.documentElement.clientHeight/2) - ($("#MsgDiv").parents().height()/2) );
	}
	else if (which == "upload"){
		top.location = "UploadShow.asp?Id="+Id+"&sign="+sign ;
	}
	else if (which == "enrol"){
		top.location = "enrolFile/enrol.asp";
	}
	else{
		top.locaion = "Knowledge_show.asp?value="+Id+"&sign="+sign;
		//top.loaction = "UploadShow.asp";
	}
}

//提示信息
function ShowAlert( MsgVal , Url ){

	if (Url!="") {
		Url = "location='" + Url + "'";
	}
	var HTMLStr = '<div id="MsgDiv" style="width:300px;height:120px;background-color:#f7f9fd">' +
				  '  <div style="padding:2px 2px 2px 5px;background-color:#dceefb;text-align:left;font-weight:bold;">提示信息</div>' +
				  '  <div style="color:#4e608c;padding:10px 10px 0px 10px;height:40px;">'+MsgVal+'</div>' +
				  '  <div style="padding:10px 10px 0px 10px;"><input type="button" value=" 确 定 " class="button" onclick="javascript:$.unblockUI();' + Url + '" /></div>' +
				  '</div>';
	parent.$.blockUI(HTMLStr);
	parent.$("#MsgDiv").parents().css('left',  (parent.document.documentElement.clientWidth/2)  - (parent.$("#MsgDiv").parents().width()/2)  );
	parent.$("#MsgDiv").parents().css('top' ,  (parent.document.documentElement.clientHeight/2) - (parent.$("#MsgDiv").parents().height()/4) );
}

//前台按钮的设置，当鼠标移动到时
function ButtonMove(Obj){
	Val = Obj.getAttribute("SelVal");
	if (Val==null || Val=="0") {
		$(Obj).attr("style", "width:76px;height:24px;border:0px; vertical-align: middle; background:url(Include/Images/but_bg_1a.gif) no-repeat; cursor:pointer;");
	}
}
//前台按钮的设置，当鼠标离开时
function ButtonOut(Obj){
	Val = Obj.getAttribute("SelVal");
	if (Val==null || Val=="0") {
		$(Obj).attr("style", "width:76px;height:24px;border:0px; vertical-align: middle; background:url(Include/Images/but_bg_1.gif) no-repeat; cursor:pointer;");
	}
}

//后台按钮的设置，当鼠标移动到时
function ButtonMove2(Obj){
	Val = Obj.getAttribute("SelVal");
	if (Val==null || Val=="0") {
		$(Obj).attr("style", "width:76px;height:24px;border:0px; vertical-align: middle; background:url(../../Include/Images/but_bg_1a.gif) no-repeat; cursor:pointer;");
	}
}
//后台按钮的设置，当鼠标离开时
function ButtonOut2(Obj){
	Val = Obj.getAttribute("SelVal");
	if (Val==null || Val=="0") {
		$(Obj).attr("style", "width:76px;height:24px;border:0px; vertical-align: middle; background:url(../../Include/Images/but_bg_1.gif) no-repeat; cursor:pointer;");
	}
}

//打开一个窗口
function winopen(Url){
   var WinWidth  = screen.width  - 100;//30; 
   var WinHeight = screen.height - 140;//60; 
   var WinName = "win" + new Date().getTime();
   window.open(Url,'win'+new Date().getTime(),'width='+WinWidth+',height='+WinHeight+',Toolbar=no,Location=no,Menubar=no,scrollbars=yes,Resizable=yes,Left=40,Top=30');

}
