<?php include_once ('./tmpl/header.html'); ?>
<script language="javascript" type="text/javascript" src="./tmpl/js/step_4.js"></script>
	<div class="right">
		<h2>Step <?php echo $step;?> of 5 </h2>

		<h1>正在安装</h1>
	 
		<div id="setupinfo">正在开始安装...<br></div>
		
		<div class="butbox">
		<input type="button" class="inputButton" value=" 上一步 " onclick="window.location.href='index.php?step=3';" style="margin-right:20px" />
		<input name="dosubmit" type="submit" class="inputButton nonext" id="dosubmit" value=" 下一步 " disabled  />
	</div>
	</div>
</div>
<div class="power">Powered by <a href="http://www.loowei.com" target="_blank">Loowei</a></div>
</div></div>

<script language="javascript" type="text/javascript">
var n=0;
var data = <?php echo json_encode($_POST);?>;
$.ajaxSetup ({ cache: false });
function reloads(n) {
		var url =  "./index.php?step=4&install=1&n="+n;
		$.ajax({
			 type: "POST",		
			 url: url,
			 data: data,
			 dataType: 'json',
			 beforeSend:function(){
			 },
			 success: function(msg){
				if(msg.n=='999999'){
					$('#setupinfo').append(msg.msg);
					$('#dosubmit').attr("disabled",false);
					$('#dosubmit').removeAttr("disabled");				
					$('#dosubmit').removeClass("nonext");
					setTimeout('gonext()',2000);
					return false;
				}
				if(msg.n || msg.n==0){
					$('#setupinfo').append(msg.msg);
					reloads(msg.n);
				}else{
					alert(msg.msg);
				}			 
			}
		});
}
function gonext(){
	window.location.href='./index.php?step=5';
}
$(document).ready(function(){
		reloads(n);
})
</script>
</body>
</html>
