<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Step2.aspx.cs" Inherits="XpShop.Install.Step2" %>
<html>
    <HEAD>
		<title>欢迎您选择安装XpShop 2012</title>
		<style type="text/css"> 
		body{margin:100px auto;text-align:center;background-color:#CCCCCC;font-size:12px;}
		td{font-size:14px;}
		.tleft {text-align:right;}
		.tright {text-align:left;}
		</style>
		<script language="javascript">
		function createXmlHttp() 
		{ 
			var A=null; 
			try 
			{ 
				A=new ActiveXObject("Msxml2.XMLHTTP"); 
			} 
			catch(e) 
			{ 
				try 
				{ 
					A=new ActiveXObject("Microsoft.XMLHTTP"); 
				} 
				catch(oc) 
				{ 
					A=null 
				} 
			} 
			if ( !A && typeof XMLHttpRequest != "undefined" ) 
			{ 
				A=new XMLHttpRequest() 
			} 
			return A 
		}
		function checkForm()
		{
			if(document.getElementById("txtIP").value=="")
			{
				alert("请输入服务器名称或IP地址");
				return false;
			}
			if(document.getElementById("txtName").value=="")
			{
				alert("请输入数据库名称");
				return false;
			}
			if(document.getElementById("txtAccound").value=="")
			{
				alert("请输入数据库用户名");
				return false;
			}
			if(document.getElementById("txtPassword").value=="")
			{
				alert("请输入数据库密码");
				return false;
			}
			var virtual = document.getElementById("txtVirtual").value;
			var ip = document.getElementById("txtIP").value;
			var name = document.getElementById("txtName").value;
			var account = document.getElementById("txtAccound").value;
			var pass = document.getElementById("txtPassword").value;
			
			var item=document.getElementsByName("item");
			var hasdata;
			for(var i=0;i<item.length;i++)
			{
				if(item[i].checked)
				{
					hasdata=i;
				}
			}
			
			document.getElementById("bt1").style.display ="none";
			document.getElementById("bt2").style.display ="block";
			
			var weburl = "Step2.aspx?NoCopyright=1&type=setup&virtual="+escape(virtual)+"&ip="+escape(ip)+"&name="+escape(name)+"&account="+escape(account)+"&pass="+escape(pass)+"&hasdata="+escape(hasdata)+"&t="+Math.random();
			var xmlhttp = createXmlHttp(); 
			xmlhttp.open("get",weburl,true);
			xmlhttp.onreadystatechange=function() 
			{ 
				if(xmlhttp.readyState==4)
				{  
					var result = xmlhttp.responseText;
					if(result!="ok")
					{
						alert(result);
						document.getElementById("bt1").style.display ="block";
						document.getElementById("bt2").style.display ="none";
					}
					else
					{
						alert("安装成功,请登录系统后台配置系统!");
						window.location="../installgoto.aspx";
					}
				}
			}
			xmlhttp.send(null);	
		}
		</script>
	</HEAD>
	<body>
		<form id="Form1" method="post" runat="server">
			<div style="width:700px;border:1px solid #666666; margin:0px auto;">
				<table cellpadding="0" cellspacing="0" width="700" bgcolor="#ffffff">
					<tr>
						<td colspan="2" style="PADDING-LEFT:30px;COLOR:#ffffff;HEIGHT:30px;BACKGROUND-COLOR:#333333;font-weight:bold">
							欢迎安装 XpShop 2012版 (.Net Framework 3.5 / MsSql Server 2005)
						</td>
					</tr>
					<tr>
						<td style="WIDTH:200px">
							<img src="images/logo.jpg">
						</td>
						<td style="WIDTH:500px">
							<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
								<tr>
									<td class="tleft">虚拟目录名称：</td>
									<td class="tright">
										<input type="text" id="txtVirtual" value=""><font color="red">(有则输入,无则留空)</font>
									</td>
								</tr>
								<tr>
									<td class="tleft">服务器名称或IP地址：</td>
									<td class="tright">
										<input type="text" id="txtIP" value="127.0.0.1"><font color="red">*(默认为本机地址)</font>
									</td>
								</tr>
								<tr>
									<td class="tleft">数据库名称：</td>
									<td class="tright">
										<input type="text" id="txtName"><font color="red">*</font>
									</td>
								</tr>
								<tr>
									<td class="tleft">数据库用户名：</td>
									<td class="tright">
										<input type="text" id="txtAccound"><font color="red">*</font>
									</td>
								</tr>
								<tr>
									<td class="tleft">数据库密码：</td>
									<td class="tright">
										<input type="text" id="txtPassword"><font color="red">*</font>
									</td>
								</tr>
								<tr>
									<td class="tleft">数据：</td>
									<td class="tright">
										<input type="radio" name="item" value="0">
                                        空数据
                                        <br>
                                        <input type="radio" name="item" value="1" checked="checked">
                                        演示数据
									</td>
								</tr>
								<tr>
									<td colspan="2" style="VERTICAL-ALIGN:middle;HEIGHT:100px;TEXT-ALIGN:center">
										<div id="bt1">
											<input type="button" style="BORDER-RIGHT:0px;BORDER-TOP:0px;BACKGROUND:url(Images/setup.jpg) no-repeat;BORDER-LEFT:0px;WIDTH:85px;CURSOR:pointer;BORDER-BOTTOM:0px;HEIGHT:27px"
												onclick="checkForm()">
										</div>
										<div id="bt2" style="DISPLAY:none">
											<img src="images/loading.gif">
										</div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</div>
		</form>
	</body>
</HTML>