// Simple popup 0.1 by roba
if (document.all)    {n=0;ie=1;ns6=0;}
if (document.getElementById&&!document.all)    {n=0;ie=0;ns6=1;} 

function loadbar(width,height,id){
	if (ns6) {
		ypos = innerHeight;
		ypos = ((ypos/2) - (height/2)) + pageYOffset;
		if (ypos < 1) ypos = 100;
		xpos = innerWidth;
		xpos = (xpos/2) - (width/2);
		if (xpos < 1) xpos = 100;
		document.getElementById("progressbar2").style.display='block';
		document.getElementById("progressbar2").style.width=width+"px";
		document.getElementById("progressbar2").style.height=height+"px";
		document.getElementById("progressbar2").style.left=xpos+"px";
		document.getElementById("progressbar2").style.top=ypos+"px";
		}
	else if (ie) {
		ypos = document.body.offsetHeight;
		ypos = ((ypos/2) - (height/2) + document.body.scrollTop);
		if (ypos < 1) ypos = 100;
		xpos = document.body.offsetWidth;
		xpos = (xpos/2) - (width/2);
		if (xpos < 1) xpos = 100;
		document.all("progressbar2IE").innerHTML='<iframe src="" width="300" height="150" FRAMEBORDER="0" SCROLLING="No"></iframe>';
		document.all("progressbar2IE").style.display='block';
		document.all("progressbar2IE").style.width=width+"px";
		document.all("progressbar2IE").style.height=height+"px";
		document.all("progressbar2IE").style.left=xpos+"px";
		document.all("progressbar2IE").style.top=ypos+"px";
		document.all("progressbar2IE").style.zIndex = 10;
		document.all("progressbar2").style.display='block';
		document.all("progressbar2").style.width=width+"px";
		document.all("progressbar2").style.height=height+"px";
		document.all("progressbar2").style.left=xpos+"px";
		document.all("progressbar2").style.top=ypos+"px";
		document.all("progressbar2").style.zIndex = 20;
		}
	document.fileup.submit();
	window.setInterval("GetHTTPData('"+id+"')",1000);
	}
	
function Update(data) {
	var datap=data.split("|");
	if (ns6) {
		document.getElementById("progressbarIMG").width = datap[0];
		}
	else if (ie) {
		document.all("progressbarIMG").width = datap[0];
		}
	if (datap[1] > 0) {
		if (ns6) {
			document.getElementById("progressbarTXT").innerHTML = "Nahr&#225;no: "+datap[1]+" kB z "+datap[2]+" kB / Rychlost: "+datap[3]+" kB/s";
		}
		else if (ie) {
			document.all("progressbarTXT").innerHTML = "Nahr&#225;no: "+datap[1]+" kB z "+datap[2]+" kB / Rychlost: "+datap[3]+" kB/s";}
		}
}

function GetHTTPData(id) {
	var xmlHttp;
	var data;
  try {
		xmlHttp=new XMLHttpRequest();
	}
  catch (e) {
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)	{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()	{
		if (xmlHttp.readyState==4) {
			Update(xmlHttp.responseText);
		}
	}
	var d = new Date();
	var ts = d.getTime();
	xmlHttp.open("GET","ulstatus.php?id="+id+"&time="+ts,true);
	xmlHttp.send(null);
}
