<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!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" />
<title>Upload processor</title>
<link rel="stylesheet" href="/JuuluuApp/RIA/jquery-ui-1.8.20/core/demos/demos.css">
	<link rel="stylesheet" href="/JuuluuApp/RIA/jquery-ui-1.8.20/core/themes/base/jquery.ui.all.css">
	<script src="/JuuluuApp/RIA/jquery-ui-1.8.20/core/jquery-1.7.2.js"></script>
	<script src="/JuuluuApp/RIA/jquery-ui-1.8.20/core/ui/jquery.ui.core.js"></script>
	<script src="/JuuluuApp/RIA/jquery-ui-1.8.20/core/ui/jquery.ui.widget.js"></script>
	<script src="/JuuluuApp/RIA/jquery-ui-1.8.20/core/ui/jquery.ui.progressbar.js"></script>

	<script src="/JuuluuApp/RIA/jquery-ui-1.8.20/core/ui/jquery.ui.button.js"></script>

	<script>
	$(function() {
		$( "#progressbar" ).progressbar({
			value: 0
		});
		$( "input:submit, a, button", ".u_but" ).button();
		$( "button", ".u_but" ).click(function() {
			//alert("OK");
			window.close();
		 return false; });
	});
	</script>
	
<!--
position:absolute;
	left:193px;
	top:178px;
	-->
	
<style type="text/css">
<!--
#uploadProcessorBox{	width:500px;
	height:120px;
		background-color:#CCCCCC;
	border:solid 1px #999999;
	padding:10px;
	}
#uploadProcessor {

	z-index:1;

}
#processor_upload_return{

margin:10px;
padding:10px;
}
-->
</style>
</head>

<body>

<div id="uploadProcessorBox">

<div id="progressbar"></div>
<div id="uploadProcessor"> 加载中...</div>
<div class="u_but" align="center">
<!--<a href="#">An anchor</a>-->
<button >关闭</button>
</div>
</div><!-- End demo -->


<script src="/js/ajax.js" language="javascript"></script>

<script type="text/javascript">    


var xmlHttpIMLogin_send_report;
// JavaScript Document
//案例
function update_send_report(){
	
var imServerLogined=false;

var rePort_send_SiteServer_url="/storeFile/userUpload/uploadPrpcessor_ajax.jsp"+"?fresh=" + Math.random(); 
var imAdminId=1;
if(imServerLogined==null||imServerLogined==false){
	//alert("login to im server by new user!");
	//缓存ajax
	xmlHttpIMLogin_send_report=GetXmlHttpObject(report_update_date_repaint);
	//http://192.168.0.99:8080/GsKeFuServer-war/gskeFuBean?uid=1&act=newUser
	var url=rePort_send_SiteServer_url;
	
	// xmlHttpIMLogin_send_report.setRequestHeader("If-Modified-Since","0");
//xmlHttpIMLogin_send_report.setRequestHeader("Cache-Control","no-cache");
	
	//alert(url);
	xmlHttpIMLogin_send_report.open("GET", url , false);
	xmlHttpIMLogin_send_report.send(null);
	
}
}//end fun
//获取ajax返回数据 重绘报表
function report_update_date_repaint(){
	var info;
	//Ajax必需先判定正确的状态后才取回返回的数据。"完成该操作所需的数据还不可使用"的错误
	//判断ajax程序状态
	if(xmlHttpIMLogin_send_report.readyState == 4) {
   		 if(xmlHttpIMLogin_send_report.status == 200) { 
   	 		info=xmlHttpIMLogin_send_report.responseText;
			//判断是否登录成功 is login sucess
			//alert(info);
	 var reportDiv=	document.getElementById("uploadProcessor");
	 reportDiv.innerHTML=info;
	// alert(info);
			parseReturnData();
   	 }//END IF
    }//end if
	

}


var upladoisok=false;
var flushProcessorID;
	if(upladoisok==false){
	
		update_send_report();
		//定时更新 2秒
	flushProcessorID=	setInterval("update_send_report()", 2000);
	}
		
	function stopFlushProcessor(){
			clearInterval(flushProcessorID);
			upladoisok=true;
				//alert(" stop flush upload OK!");
	}	
	
	function parseReturnData(){
		var percent=document.getElementById("percent");
		if(percent!=null){
			//alert(percent);
		//	alert(percent.innerHTML);
			var jindu=percent.innerHTML;
			var intjindu=parseInt(jindu);
			intjindu=intjindu*100;
			$( "#progressbar" ).progressbar(
			{ value :intjindu});
			//is ok
			if(jindu!=null&&jindu.indexOf("1.0")!=-1){
				//alert("upload OK!");
				stopFlushProcessor();
				
			}
			//failt
			if(jindu!=null&&jindu=="1.0"){
				//alert("1.0 upload OK!");
				//stopFlushProcessor();
			}
		}
	}
		
</script>

</body>
</html>
