function UsunWczytywanie()
{
	if (document.getElementById)
		document.getElementById('loading').style.visibility='hidden';
	else
	{
		if(document.layers) //NS4
			document.loading.visibility = 'hidden';
		else //IE4
  			document.all.loading.style.visibility = 'hidden';
 	};
};
function PokazWczytywanie()
{
	if (document.getElementById)
		document.getElementById('loading').style.visibility='visible';
	else
	{
		if(document.layers) //NS4
			document.loading.visibility = 'visible';
		else //IE4
  			document.all.loading.style.visibility = 'visible';
 	};
};

function openClose(id)
{
   if(document.getElementById) {
      element = document.getElementById(id);
   } else if(document.all) {
      element = document.all[id];
   } else return;

   if(element.style) {
      if(element.style.display == 'block' ){
         element.style.display = 'none';
      } else {
         element.style.display = 'block';
      }
   }
}

function SerwerThumb(el) {
	if (el.checked==false) {
		document.dodaj.width.disabled=true;
		document.dodaj.width.value="";
		document.dodaj.height.disabled=false;
		document.dodaj.height.value="";
	}
    	else {
		document.dodaj.width.disabled=false;
		document.dodaj.width.value="100";
		document.dodaj.height.disabled=false;
		document.dodaj.height.value="0";
 	}
}

function KategoriaZablokujPola(obj,id,elems) {
	if (obj.selectedIndex!=0) {
		for (a=0; a<elems.length; a++) {
			document.forms["dodaj"].elements[elems[a]].disabled=true;
			document.forms["dodaj"].elements[elems[a]].value="";
		}
	}
	else {
		for (a=0; a<elems.length; a++)
			document.forms["dodaj"].elements[elems[a]].disabled=false;
	}
	$('#'+id).toggle(1000);

}

function RozwinMenu(id) {
	jQuery('#'+id).toggle("500");
}

function TableForm(obj,tab) {
        var res=FormVer(obj,tab);
        if (res==false)
                return false;
        if (obj.kategoria.options[obj.kategoria.selectedIndex].value==-1) {
                alert('Musisz wybrać jedną z podkategorii!');
		return false;
        }
        return true;
}

function CategoryForm(obj) {
	if (obj.kategoria.options[obj.kategoria.selectedIndex].value==-1) {
		alert('Musisz wybrać jedną z podkategorii!');
		return false;
	}
	else
		return true;
}

function OpcjaZablokujPola(obj,id,elems) {
	if (obj.selectedIndex!=0) {
		for (a=0; a<elems.length; a++) {
			document.forms["dodaj"].elements[elems[a]].disabled=true;
			document.forms["dodaj"].elements[elems[a]].value="";
		}
	}
	else {
		for (a=0; a<elems.length; a++)
			document.forms["dodaj"].elements[elems[a]].disabled=false;
	}
	$('#'+id).toggle(1000);

}
