licz=0;
// Otwarcie okna z obrazekiem 
function otworz(nazwa, szer, wys) {
        config = 'left=100,top=100,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
        kitekSC = 'okno' + licz;
        stadion = window.open('',kitekSC,config)
        var otworzZW = '';
        otworzZW += '<html><head>';
        otworzZW += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">';
        otworzZW += '<title>Foto-Galeria - Wirtualna Polska</title>';
        otworzZW += '<script language="javascript">';
        otworzZW += 'setTimeout(';
        otworzZW += '"self.close()';
        otworzZW += ';",70000)';
        otworzZW += '</';
        otworzZW += 'script>';
        otworzZW += '</head>';
        otworzZW += '<body bgcolor="white" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">';
        otworzZW += '<div align="center"><a href="#" onclick="javascript:self.close();"><img src='+nazwa+' border="0" alt="" /></a></div>';
        otworzZW += '</body></html>';
        stadion.document.write(otworzZW);
        stadion.focus();
        licz += 1;
}

function updateChartXml(chartId,url,opisid,opis) {
	
	if (opis != '') {
	    document.getElementById(opisid).innerHTML = opis;
	}
	//Get reference to chart object using Dom ID
	var chartObj = getChartFromId(chartId);
	//Update it's XML
	
	chartObj.setDataXML(url);
	chartObj.render('ofe1div');
}

function updateChartUrl(chartId,url,opisid,opis) {
	
	if (opis != '') {
	    document.getElementById(opisid).innerHTML = opis;
	}
	//Get reference to chart object using Dom ID
	var chartObj = getChartFromId(chartId);
	//Update it's XML
	
	chartObj.setDataURL(url);
}

function goToURL(date) { 
  window.location = "d1,"+date+",notowania.html"; 
}
function goToWiz(d) { 
  window.location = d;
}
function goToURL1(el) { 
  data = document.getElementById(el);
  popr = sprawdz_daty(data);
  if (popr!=0) {
    if (popr==1) {
      alert('Poprawny format daty to dd.mm.yyyy!');
      return;
    } else {
      if (popr==2) { 
	alert('Niepoprawne daty!');
	return;
      } else {
	alert('Błędne daty!');
	return;
      }
    }
  } else {
    date = data;
  }
  goToURL(date.value);
}

function goToURL2(minDateEl, maxDateEl, countEl, reszta) { 
  minDate = document.getElementById(minDateEl);
  maxDate = document.getElementById(maxDateEl);
  count = document.getElementById(countEl);
  min = minDate;
  max = maxDate;
  
  goToURL3(min.value, max.value, count.value, reszta);
}

function goToURL3(min, max, count,reszta) { 
  window.location = "minDate,"+min+",maxDate,"+max+",count,"+count+","+reszta; 
}


/**
 * popr==0 OK
 * popr==1 Poprawny format daty to dd.mm.yyyy!
 * popr==2 Niepoprawne daty!
 */
function sprawdz_daty(data) {
  var popr=0, data_od,  mies;
  data_od = new Date(data.value.substr(8,2),data.value.substr(3,2)-1,data.value.substr(0,2));	
  mies= new Array(31,28,31,30,31,30,31,31,30,31,30,31);	
  
  if ((data.value.length!=10)) 
    popr=1;
  else if ((data.value.substr(2,1)!='.')||(data.value.substr(5,1)!='.')) 
    popr=1;	
  else if ((isNaN(data.value.substr(0,2)))||(isNaN(data.value.substr(3,2))||(isNaN(data.value.substr(6,4))))) 
    popr=2; 
  else {
    if (data_od.getYear()<100) {
      if (data_od.getYear()!= Number(data.value.substr(8,2))) popr=2;	
    } else {
      if (data_od.getYear()!= Number(data.value.substr(6,4))) 
	popr=2;
      else {			
	if (data_do.getYear()<100) {
	  if (data_do.getYear()!= Number(data.value.substr(8,2))) 
	    popr=2;
	} else {
	  if (data_do.getYear()!= Number(data.value.substr(6,4))) 
	    popr=2;
	}
      }
    }
  }
  
  if (Number(data.value.substr(0,2))>mies[Number(data.value.substr(3,2))-1]) {
    popr=2;
  }

  return popr;

}



/**
 * Klasa do ukrywania/pokazywania elementow list
 */
function SHList(active){
    this._active = active;
    document.getElementById(active).style.display = 'block';
}

SHList.prototype._active;

SHList.prototype.setVisible = function(id){

    document.getElementById(this._active).style.display = 'none';
    
    document.getElementById(id).style.display = 'block';
    
    this._active = id;
    
}

