
function sAlert(str){
var msgw,msgh,bordercolor;
msgw=300;//提示窗口的宽度
msgh=200;//提示窗口的高度
titleheight=25 //提示窗口标题高度
bordercolor="#DCDCDC";//提示窗口的边框颜色
titlecolor="#DCDCDC";//提示窗口的标题颜色

var sWidth,sHeight;
sWidth=screen.width;
sHeight=screen.height;

var bgObj=document.createElement("div");
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="absolute";
bgObj.style.top="0";
bgObj.style.background="#cccccc";
bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity="0.5";
bgObj.style.left="0";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);

var msgObj=document.createElement("div")
msgObj.setAttribute("id","msgDiv");
msgObj.setAttribute("align","center");
msgObj.style.background="white";
msgObj.style.border="1px solid " + bordercolor;
msgObj.style.position = "absolute";
msgObj.style.left = "50%";
msgObj.style.top = "50%";
msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
msgObj.style.marginLeft = "-225px" ;
msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
msgObj.style.width = msgw + "px";
msgObj.style.height =msgh + "px";
msgObj.style.textAlign = "center";
msgObj.style.lineHeight ="25px";
msgObj.style.zIndex = "10001";


//var title=document.createElement("h4");
//title.setAttribute("id","msgTitle");
//title.setAttribute("align","right");
//title.style.margin="0";
//title.style.padding="3px";
//title.style.background=bordercolor;
//title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
//title.style.opacity="0.75";
//title.style.border="1px solid " + bordercolor;
//title.style.height="18px";
//title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
//title.style.color="white";
//title.style.cursor="pointer";
//title.innerHTML="关闭";
//title.onclick=function(){
//document.body.removeChild(bgObj);
//document.getElementById("msgDiv").removeChild(title);
//document.body.removeChild(msgObj);
//}
document.body.appendChild(msgObj);
//document.getElementById("msgDiv").appendChild(title);


//------------------------------------------------

var titleTable = document.createElement("table");
titleTable.width = "296";
titleTable.border = "0";
titleTable.align = "center";
titleTable.cellSpacing = "0";
titleTable.cellPadding = "0";
var t_tr = titleTable.insertRow();
var t_td_1 = t_tr.insertCell();
var t_td_2 = t_tr.insertCell();
var t_td_3 = t_tr.insertCell();

t_td_1.width = "49";
t_td_2.background = "/images/title_line_top.gif";
t_td_2.className ="title";
t_td_2.appendChild(document.createTextNode("用户登录"));
t_td_3.width = "19";

var Img_1 = document.createElement("img");
Img_1.width = "49";
Img_1.height = "46";
Img_1.src = "/images/title_register.gif";
var Img_2 = document.createElement("img");
Img_2.width = "19";
Img_2.height = "46";
Img_2.src = "/images/title_corner_r.gif";

t_td_1.appendChild(Img_1);
//t_td_3.appendChild(Img_2);

document.getElementById("msgDiv").appendChild(titleTable);

//-----------------------------------------------------------
var disFrm = document.createElement("form");
disFrm.action = "";
disFrm.method = "post";
var login_flag = document.createElement("input");
login_flag.type = "hidden";
login_flag.name = "login_flag";
login_flag.value = "Y";

disFrm.appendChild(login_flag);

var disTable = document.createElement("table");
disTable.width = "100%";
disTable.align="center";

var mtr1 = disTable.insertRow();
var mtd1_1 = mtr1.insertCell();
mtd1_1.align = "center";
mtd1_1.appendChild(document.createTextNode("用户名"));

var mtd1_2 = mtr1.insertCell();
var t_account = document.createElement("input");
t_account.name = "t_account";
t_account.type = "text";
t_account.size = "16";
t_account.maxLength="16";
mtd1_2.appendChild(t_account);

var mtr2 = disTable.insertRow();
var mtd2_1 = mtr2.insertCell();
mtd2_1.align="center";
mtd2_1.appendChild(document.createTextNode("密  码"));

var mtd2_2 = mtr2.insertCell();
var t_psw = document.createElement("input");
t_psw.name = "t_psw";
t_psw.type = "password";
t_psw.size = "16";
t_psw.maxLength="8";
mtd2_2.appendChild(t_psw);

var mtr3 = disTable.insertRow();
var mtd3_1 = mtr3.insertCell();
mtd3_1.align = "center";
mtd3_1.colSpan = "2";
mtd3_1.height = "30";
var sub_btn = document.createElement("input");
sub_btn.type = "submit";
sub_btn.className = "btn";
sub_btn.value = "登录";
sub_btn.onclick = function (){

		if(t_account.value == ""){
			alert("请输入用户名");
			t_account.focus();
			return false;
		
		}else{
			var pat_s = /^(\s)/;
			var pat_e = /(\s)$/;

			if ( pat_s.test(t_account.value) || pat_e.test(t_account.value))
			{
				alert("首尾不能是空格");
				t_account.focus();
				return false;
			}

			if(!/^[a-z0-9_]*$/.test(t_account.value)){
				alert("请输入英文小写/数字/下划线");
				t_account.focus();
				return false;
			
			}

			if(t_account.value.slice(t_account.value.length-1)=="_"){
				alert("下划线不能在最后");
				t_account.focus();
				return false;		
			}
		}

		if(t_psw.value == ""){
			alert("请输入密码");
			t_psw.focus();
			return false;
		
		}else{

			if(!/^[a-zA-Z0-9]*$/.test(t_psw.value)){
				alert("请输入英文/数字");
				t_psw.focus();
				return false;
			
			}

		}
		return true;
	}
var reset_btn = document.createElement("input");
reset_btn.type = "button";
reset_btn.className = "btn";
reset_btn.value = "关闭";
reset_btn.onclick = function (){
	document.body.removeChild(bgObj);
	document.getElementById("msgDiv").removeChild(titleTable);
	document.getElementById("msgDiv").removeChild(disFrm);
	document.body.removeChild(msgObj);
		}

mtd3_1.appendChild(sub_btn);
mtd3_1.appendChild(document.createTextNode("   "));
mtd3_1.appendChild(reset_btn);

disFrm.appendChild(disTable);

document.getElementById("msgDiv").appendChild(disFrm);
//------------------------------------------------
}

