﻿// JScript File
  //utworzenie dokumentu XML z pliku na dysku 
  function newXmlDocument(strFileName)
  {
        var xmlDoc;
        // code for IE
    if (window.ActiveXObject)
    {
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    }
        // code for Mozilla, Firefox, Opera, etc.
    else if (document.implementation && document.implementation.createDocument)
    {
        xmlDoc=document.implementation.createDocument("","",null);
    }
    else
    {
        alert('Your browser cannot create xmlDocument');
    }
    xmlDoc.async=false;
    xmlDoc.load(strFileName);
    return xmlDoc;
  }
  
 

 
 /*
 Authorization = function(divlogname,divpassname,divrespname)
 {
    this._divlog = document.getElementById(divlogname);
    this._divpass = document.getElementById(divpassname);
    this._divResp = document.getElementById(divrespname);
    this._pass = "";
    this._log = "";
    if(this._divlog!=null) this._pass = this._divlog;
    if(this._divpass!=null) this._pass = this._pass;
 }
 Authorization.prototype.logIn = function()
 {
    var content = "";
    content+=newSoapContent("username",this._log);
    content+=newSoapContent("password",this._pass);
    var data = createSOAPData("Authorization",content);
    var me = this;
    sendSOAPEnvelope('',data,function(re){
    
        var result=re.getElementsByTagName('Acceptation')[0].firstChild.nodeValue
        if(result=="true") {createCookie("db2TARANAuthorization","user:"+user+"%pass:"+pass,60*60*24); event(true)}
            else me._failed();
    });
 }
 Authorization.prototype._failed = function()
 {
    this._divResp.innerHTML="Blad autoryzacji";
 }
 
 */
 
 
 
 ProgressBar = function(opt_opts)
{
    this._opt_opts    = opt_opts                 || {};
    this._div                    = document.createElement('div');         
    this._gif                    = this._opt_opts.image     || (typeof(PATH)!='undefined'?PATH:'')+"img/progres.gif";
    this._text                   = this._opt_opts.text      || "<br /><span style=\"font-weight:bold;font-size:large;color:white;\"> " + (Global.lang.wczytywanie || "Wczytywanie danych...")  + " </span>";
    this._div.style.background   = this._opt_opts.background|| "#5e58c9"
    this._div.style.textAlign    = this._opt_opts.textAlign || "center"
    this._div.style.opacity      = this._opt_opts.opacity   || 0.8
    this._div.style.height       = this._opt_opts.height    || "70px"
    this._div.style.width        = this._opt_opts.width     || "400px"  
    this._offsetX                = this._opt_opts.offsetX   || -250;
    this._offsetY                = this._opt_opts.offsetY   || -50;
    this._centerX                = this._opt_opts.centerX   || -1;//-1 ozn. że sam ma wyznaczyć środek kontenera
    this._centerY                = this._opt_opts.centerY   || -1;//-1 ozn. że sam ma wyznaczyć środek kontenera
    this._paddingTop             = this._opt_opts.paddingTop || "0";
    this._div.innerHTML          = "<img style=\"padding-top:"+ this._paddingTop +"\"  src ='" + this._gif +"'>"+this._text;
    this._div.setAttribute('id','progress');
    this._div.style.varticalAling = 'middle';
    
    this._div.style.filter = 'alpha(opacity = ' + (parseFloat(this._div.style.opacity)*100)+')';
        
        //this._div.style.filter ='alpha(opacity=50)';
   // this._hasBack
    
}
ProgressBar.prototype = new GControl();

ProgressBar.prototype.initialize = function(map)//progress na mapie
{
    this._map = map;
    map.getContainer().appendChild(this._div);
    return this._div;
}


ProgressBar.prototype.initOnContainer=function(parentNode) 
{
    //alert(parentNode.id);
    parentNode.appendChild(this._div);  
    //alert( parentNode.offsetLeft+ " "+parentNode.offsetTop );
    
    
    this._div.style.position = 'absolute';
    this._div.style.left = 0+"px";// parentNode.offsetLeft + "px";
    this._div.style.top =  0+"px";//parentNode.offsetTop + "px";
    
    this._div.style.width = parentNode.clientWidth +"px";
    this._div.style.height = parentNode.clientHeight + "px";
     
    
     
}

ProgressBar.prototype.initOnPage = function(parentNode) //progress na stronie
{   
    var cx = this._centerX==-1?(parentNode.clientWidth/2 + this._offsetX ): (this._centerX+this._offsetX);
    var cy = this._centerY==-1?(parentNode.clientHeight/2 + this._offsetY): (this._centerY+this._offsetY);
  
    this._div.style.position = 'relative';
    this._div.style.top =  cx + "px";
    this._div.style.left = cy + "px";
  
    parentNode.appendChild(this._div);
}


ProgressBar.prototype.remove = function()
{
    if(this._div.parentNode!=null){
 //       this._div.innerHTML = "";
        this._div.parentNode.removeChild(this._div);
        }

}


ProgressBar.prototype.getDefaultPosition = function() {
    var cx = this._centerX==-1?(this._map.getContainer().clientWidth/2 + this._offsetX ): (this._centerX+this._offsetX);
    var cy = this._centerY==-1?(this._map.getContainer().clientHeight/2 + this._offsetY): (this._centerY+this._offsetY);
    return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(cx,cy  ));
}