	var pgHtml = '<table id="progressSpace" width="300" border="0" cellpadding="0" cellspacing="0" >' +
				'   <tr><td height="20" align="left" bgcolor="#FFFFFF">' +
				'		<table id="progressBar" width="1%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#0000FF">' +
				'  		   <tr><td id="progressText" align="center" valign="middle" style="font-family:Arial; font-size:10px; color:#FFFFFF">1%</td></tr>' +
				'  		</table>' +							
				'	</td></tr>' +
				'</table>'+
				'<table width="300" align="center" id="trPgData">'+
				'	<tr><td id="progressData" align="center" style="font-family:Arial; font-size:10px; font-weight:bold; color:#0000FF">00</td></tr>'+
				'</table>';

	var pgBarAjax = null;
	var progressTimer = null;
	var showProgressData = false;
	function progessInit() { return;}

	function progessUpdate(request) {
	 var progress = request.responseText.split(","); //แปลงเป็น ARRAY โดยใช้รหัสขึ้นบันทัดใหม่
	 	if (progress[0] != "null" && progress[1] != "null") {
			var total = parseInt(progress[0]);
			var complete = parseInt(progress[1]);
			if (total > 0 && complete > 0) {
				progressSpace.style.display="";
				progressBar.style.display="";
				var percent = Math.floor(100/(total/complete));
				progressText.innerHTML = percent+"%";
				progressBar.style.width = percent+"%";
				if (showProgressData) {
					trPgData.style.display = "";
					if (complete==1 && total == 100) 
						progressData.innerHTML = 'Calculate....';
					else
						progressData.innerHTML = complete+"/"+total;	
				}
			}
		}
	}

	function pgbarSetup(pgParent,pgurl,pgTotalpart,pgComplete,showData) {
		if (showData != undefined) {
			showProgressData = showData;
		}
		pgParent.innerHTML = pgHtml;
		pgBarAjax = new AjaxJspTag.UpdateField
			(pgurl+"?NAME="+pgTotalpart+","+pgComplete, 
					{parameters: "",
					action: "progressBar",
					target: "null",
					preFunction: progessInit,
					postFunction: progessUpdate,
					source: "progressBar",
					eventType: "click"}
			);
			
			progressSpace.style.cssText="border:ridge #0099FF";
			progressBar.style.cssText="border: thin  groove #000099";
			
			progressBar.style.display="none";	
			progressSpace.style.display="none";	
			trPgData.style.display="none";
		}
		
	function startProgress() {
		if (pgBarAjax != null) {
			progressTimer = setInterval("pgBarAjax.execute();",5000);
		}
	}

	function stopProgress() {
		if (progressTimer != null &&pgBarAjax != null) {
			clearInterval(progressTimer);
		}
	}
