var Import=new Object();
Import.width=500;

Import.Start=function(url, count) {
        Import.started=false;
        Import.forward='';
        Import.url=url;
        Import.pos=0;
        Import.count=count;
        Import.Next();
}

Import.Next=function() {
        if (Import.pos<=Import.count) Import.Send();
        else window.location=Import.forward;

}

Import.Send=function() {
        Import.started=true;
        if (window.XMLHttpRequest) http=new XMLHttpRequest();
        else http=new ActiveXObject("Microsoft.XMLHTTP");
        http.open("GET", Import.url+'?l='+Import.pos, true);
        http.onreadystatechange=function() {
                if (http.readyState==4 & Import.started) {
                        Import.started=false;
                        Import.pos++;
                        p=document.getElementById('progress');
                        p.width=Math.round(Import.width*Import.pos/(Import.count+1));
                        p=document.getElementById('progress_percent');
                        p.innerHTML=Math.round(100*Import.pos/(Import.count+1))+'%';
                        Import.forward=http.responseText;
                        Import.Next();
                }
        }
        http.send(null);
}