<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<title>sinsiu B2C 1.0 beta7 安装</title>
	<style type="text/css">
		body{padding:50px;font-family:"Microsoft Yahei";}
		table{width:500px;border:0;margin:0 auto;background:#FFF;color:#FFF;}
		td{border:0;padding:5px;background:#69C;vertical-align:middle;}
		table .c{text-align:center;}
		table .l{text-align:right;width:190px;}
		table .title{height:50px;font-size:22px;font-weight:bold;}
		table .bt_row{height:50px;}
		table .text{width:200px;border:1px solid #FFF;}
		#mysql_info{display:none;background:#69C;}
		.button{*padding:4px 4px 0 4px;*line-height:11px;*margin:0 0 -1px 0;cursor:pointer;}
	</style>
</head>
<body>
<form name="install" method="post" action="deal.php">
	<table cellspacing="1" cellpadding="0">
		<tr>
			<td colspan="2" class="c title">sinsiu B2C 1.0 beta7 安装</td>
		</tr>
		<tr>
			<td colspan="2"></td>
		</tr>
		<tr>
			<td class="l">后台帐号：</td>
			<td><input class="text" name="admin_name" type="text" /></td>
		</tr>
		<tr>
			<td class="l">后台密码：</td>
			<td><input class="text" name="admin_pwd" type="password" /></td>
		</tr>
		<tr>
			<td class="l">重复密码：</td>
			<td><input class="text" name="r_pwd" type="password" /></td>
		</tr>
		<tr>
			<td colspan="2"></td>
		</tr>
		<tr>
			<td class="l">电子邮箱：</td>
			<td><input class="text" name="email" type="text" /></td>
		</tr>
		<tr>
			<td colspan="2" class="c bt_row">
				<div id="button_1">
				<input class="button" type="button" onclick="do_submit()" value="开始安装" />
				</div>
				<div id="button_2" style="display:none">
				<input class="button" type="button" value="正在安装，请稍候……" />
				</div>
			</td>
		</tr>
	</table>
</form>
<script language="javascript">
function ajax(type,file,text,func)
{
	var XMLHttp_Object;
	try{XMLHttp_Object = new ActiveXObject("Msxml2.XMLHTTP");}
	catch(new_ieerror)
	{
		try{XMLHttp_Object = new ActiveXObject("Microsoft.XMLHTTP");}
		catch(ieerror){XMLHttp_Object = false;}
	}
	if(!XMLHttp_Object && typeof XMLHttp_Object != "undefiend")
	{
		try{XMLHttp_Object = new XMLHttpRequest();}
		catch(new_ieerror){XMLHttp_Object = false;}
	}
	type = type.toUpperCase();
	if(type == "GET") file = file + "?" + text;
	XMLHttp_Object.open(type,file,true);
	if(type == "POST") XMLHttp_Object.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	XMLHttp_Object.onreadystatechange = function ResponseReq()
	{
		if(XMLHttp_Object.readyState == 4) func(XMLHttp_Object.responseText);
	};
	if(type == "GET") text = null;
	XMLHttp_Object.send(text);
}
/////////////////////////////////////////////////////////////
function do_submit()
{
	var obj = document.install;
	if(obj.admin_name.value == "")
	{
		alert("后台帐号不能为空");
	}else if(obj.admin_pwd.value == ""){
		alert("后台密码不能为空");
	}else if(obj.admin_pwd.value != obj.r_pwd.value){
		alert("两次输入密码不一致");
	}else{
		ajax("post","ajax.php","",
		function(data)
		{
			if(data == 1)
			{
				document.getElementById("button_1").style.display = "none";
				document.getElementById("button_2").style.display = "block";
				obj.submit();
			}else{
				alert(data);
			}
		});	
	}
}
</script>
</body>
</html>