var l = 0;
var aktiv;
function ausg(datei,id)
{
  var xmlHttp = null;
// Mozilla, Opera, Safari sowie Internet Explorer (ab v7)
if (typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}
if (!xmlHttp) {
    // Internet Explorer 6 und älter
    try {
        xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        try {
            xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
        } catch(e) {
            xmlHttp  = null;
        }
    }
}
if (xmlHttp) {
    xmlHttp.open('GET', datei, true);
    xmlHttp.onreadystatechange = function () {
    		if(id==1)
    		{
    			if (xmlHttp.readyState == 4) {
            var a=xmlHttp.responseText;
            auswertung(a);
        		}
    		}
        
   };
   xmlHttp.send(null);
}
}
function Fensterweite () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function Fensterhoehe () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}
function submit(){
ausg('status.txt',1);
//window.setTimeout('submit()',2000);
}
function auswertung(str){

var width=Fensterweite();
var height=Fensterhoehe();
width-=240;
height-=250;
if(width<800){width=800;}
if(height<600){height=600;}
var left = 0 - width - 100;
var html="<div id='vklayer' style='overflow:auto;border:2px solid silver;padding:20px;text-align:left;position:absolute; width:"+width+"px; height:"+height+"px; z-index:99; left: "+left+"px; top: 250px;background-color:#eec;'>";
html+=str+"</div>";
html=html.replace("740",""+width);
mAus(html,left,100);

}


function verschiebe(){
l+=20;
  if (typeof(document.getElementById)=="function"){
  document.getElementById("vklayer").style.left=l+"px";
  }
  else if(document.all) {
  document.all.vklayer.style.left=l+"px";
  }
if(l>=100)
window.clearInterval(aktiv);

}
function versandkosten() {
ausg('vsk.php?mein4711=4711',1);
}

function mAus(html,start,end)
{
l=start;
zu();
document.getElementById("vkosten").innerHTML += html;

aktiv = window.setInterval("verschiebe()",10);
/*	var check=start;
	while(start<end) {
	start++;
	window.setTimeout("verschiebe("+start+")",500);
	}
	verschiebe(check);
	*/
}
function zu(){
if(aktiv)
window.clearInterval(aktiv);

if(document.getElementById("vkosten").firstChild)
	{document.getElementById("vkosten").removeChild(document.getElementById("vkosten").firstChild);}
}

function trim (zeichenkette) {
  return zeichenkette.replace (/^\s+/, '').replace (/\s+$/, '').replace(/\n/,'');
}
