// JavaScript Document
function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	return el;

}

function usun(url_){
  if(confirm('Czy napewno usunąć'))
    document.location.href=url_;
}

function open_win(adres_){
  var w = window.open();
  w.location.href = adres_;
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block'
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function dodaj_do_adresu(adres){
  document.location.href += adres;
}

function tr_podswietlone(tr, kolor){
  tr.style.backgroundColor = kolor;
}

function menu(przycisk,on,subMenu,aktywny){
  if(on=="over"){
    getElemRefs(przycisk).style.backgroundImage="url(../images/zakladka_on.gif)";
    getElemRefs(przycisk+'_link').style.color="black";
    if(subMenu!=''){
      showLayer(subMenu);
    }
  }else if(on=="out" && !aktywny){
    getElemRefs(przycisk).style.backgroundImage="url(../images/zakladka_out.gif)";
    getElemRefs(przycisk+'_link').style.color="white";
    if(subMenu!=''){
      hideLayer(subMenu);
    }
  }
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr) lyr.style.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr) lyr.style.visibility = "hidden";

}

function galeria(index,akcja){

  if(akcja=='next'){
    indZd[index]+=1;    
  }else if(akcja=='prev'){
    indZd[index]-=1;
  }
  getElemRefs('zdjecia_'+index).src = zdjecia[index][indZd[index]][1];
  getElemRefs('href_'+index).href = 'javascript:open_win(\''+zdjecia[index][indZd[index]][1]+'\');';
    
  if((indZd[index]+1)==zdjecia[index].length){ getElemRefs('next'+index).style.visibility = "hidden";}
  else{ getElemRefs('next'+index).style.visibility = "visible";}
  if(indZd[index]==0){ getElemRefs('prev'+index).style.visibility = "hidden";}
  else{ getElemRefs('prev'+index).style.visibility = "visible";}
}
