var progressBarElementId = "ProgressBar";

addProgressBar();

function addProgressBar()
{
	var progressBarCode = "<div id=\"" + progressBarElementId + "\"";
	progressBarCode += " style=\"width:200px; height:20px; position:absolute; top:1px; left:1px; z-index:100; visibility:hidden\">";
	progressBarCode += "<table width=\"100%\" height=\"100%\"";
	progressBarCode += " style=\"z-index:2\"";
	progressBarCode += " class=\"processBar\">";
	progressBarCode += "<tr><td></td></tr>"
	progressBarCode += "</table>";
	progressBarCode += "<iframe scrolling=\"no\"";
	progressBarCode += " style=\"position: absolute; left: 1px; top: 1px; width: 100%; height: 100%; z-index:-1; border-style: none; display: block; filter: alpha(opacity=0) \">";
	progressBarCode += "</iframe>";
	progressBarCode += "</div>";
	
	//window.alert(progressBarCode);
	document.write(progressBarCode);
}

// deprecated
function addWaitBar()
{
var Str="";
Str+= "<div id=" + waitBarElementId  + " style=position:absolute;top:50px;left:100px;z-index:1;visibility:hidden >";
Str+= "<layer name=waiting visibility=visible zIndex=2 >"
Str+= "<table style='border-style: solid;border-width: 1pt;border-color: #63686B;border-bottom-style: solid;border-bottom-width: 1pt;border-bottom-color: #63686B;border-collapse: collapse;border-spacing: 0pt;'>"
Str+= " <tr>"
Str+= " <td bgcolor=#7BB0D0 height=30px width=300px align=center>"
Str+= " <div style=position:absolute;top:10;left:110;font-size:10pt;color:#f4f4f4 id=abc>";
Str+= " Loading......"
Str+= " </div>";
Str+= " </td>"
Str+= " </tr>"
Str+= " <tr>"
Str+= " <td bgcolor=#F6F6F6>"
Str+= " <img width=1 height=10 name=sbar style=background-color:#6699cc>"
Str+= " </td>"
Str+= " </tr>"
Str+= "</table> "
Str+= "</layer>"
Str+= "<IFRAME  scrolling=\"no\"  style=\"position:absolute; left:0px; top:0px; width:100%; height:100%; z-index:1; border-style:none; display:block; filter: alpha(opacity=0);\"></IFRAME>"
Str+= "</div>"
document.write(Str);
}

function showProgressBar()
{
    var progressBar = document.getElementById(progressBarElementId);
    
    if (progressBar == null) {
		window.alert("ProgressBar no initialized.");
		return false;
	}
    
	if(progressBar.style.visibility == 'visible'){
		window.alert("Can't process while ProgressBar is showing, please retry later.");
		return false;
	}
	
	progressBar.style.top = (document.body.offsetHeight - progressBar.clientHeight) / 2
			+ document.body.scrollTop + "px";
	progressBar.style.left = (document.body.offsetWidth - progressBar.clientWidth) / 2
			+ document.body.scrollLeft + "px";

	//window.alert(progressBar.style.pixelTop);
	//window.alert(progressBar.style.pixelLeft);
			
	progressBar.style.visibility = 'visible';
	//progressBar.style.z-index = 1;

	return true;
}

function hideProgressBar() {
    var progressBar = document.getElementById(progressBarElementId);
    
    if (progressBar == null) {
		window.alert("ProgressBar no initialized.");
		return false;
	}
	
	if (progressBar.style.visibility == 'hidden'){
		window.alert("ProgressBar no showing.");
		return false;
	}
	
	progressBar.style.visibility = 'hidden';
	
	return true;
}

function ProcessBar(xtime){
	return showProgressBar();
}

function ProcessBar2(){
	return mainFrame.showProgressBar();;
}

function ProcessBarParent(){
	return parent.showProgressBar();;
}

function HideBarParent(){
	return parent.hideProgressBar();;
}
