/*
var zapalone='cat_0';
function show_subcat (idc) {

  var id_cat = idc;
	
	document.getElementById(zapalone).style.display="none";
	document.getElementById("divsubcat").style.display = "block";
	document.getElementById("cat_"+id_cat).style.display = "block";
	zapalone= 'cat_'+id_cat;
	
	return id_cat;
}

function show_form(i,count){

  document.getElementById("divFormAdd").style.display = "block";
 
 var sub_ = i;
 var ile = count;
 
 for(j=0;j<ile;j++)
 {
 if(j==sub_)
 {
   document.getElementById("sub_"+j).disabled = false;
 }
 else
 {
   document.getElementById("sub_"+j).disabled = true;
 }
 }

}	
*/
//------------------------------------------------------------------------------
function onLoad()
{
  //document.getElementById("regon").disabled = true;
	document.getElementById("regon").style.background = '#dddddd';
	document.getElementById("obrazek").value = '';	
}
//------------------------------------------------------------------------------
function Clear_input()
{
document.getElementById("obrazek").value = '';
}

function show_f()
{
  var regon = document.getElementById("regon");
  //document.getElementById("div_form_firma").style.display = "block";
	regon.disabled = false;
	regon.style.background = '';

}
function hide_f()
{
  var regon = document.getElementById("regon");
  //document.getElementById("div_form_firma").style.display = "none";
	regon.disabled = true;
	regon.style.background = '#dddddd';

}


//--- validate input
var valid_char= new Array();
valid_char['¹']='a';
valid_char['æ']='c';
valid_char['ê']='e';
valid_char['³']='l';
valid_char['ñ']='n';
valid_char['ó']='o';
valid_char['œ']='s';
valid_char['Ÿ']='z';
valid_char['¿']='z';
valid_char['¥']='A';
valid_char['Æ']='C';
valid_char['Ê']='E';
valid_char['£']='L';
valid_char['Ñ']='N';
valid_char['Ó']='O';
valid_char['Œ']='S';
valid_char['']='Z';
valid_char['¯']='Z';
valid_char['±']='a';
valid_char['¶']='s';
valid_char[' ']='';

valid_char['/']='';
valid_char['?']='';
valid_char['.']='';
valid_char['>']='';
valid_char[',']='';
valid_char['<']='';
valid_char['+']='';
valid_char['=']='';
valid_char[')']='';
valid_char['(']='';
valid_char['*']='';
valid_char['&']='';
valid_char['^']='';
valid_char['%']='';
valid_char['$']='';
valid_char['#']='';
valid_char['@']='';
valid_char['!']='';

valid_char['|']='';
valid_char[']']='';
valid_char['}']='';
valid_char['[']='';
valid_char['{']='';
valid_char[':']='';
valid_char[';']='';


valid_char[String.fromCharCode(92)]=''; // \
valid_char[String.fromCharCode(34)]=''; // "
valid_char[String.fromCharCode(39)]='';	// '
valid_char[String.fromCharCode(44)]='';	// '	
valid_char[String.fromCharCode(126)]='';	// ~
valid_char[String.fromCharCode(96)]='';	// `

valid_char[String.fromCharCode(260)]='A';
valid_char[String.fromCharCode(83)]='S';
valid_char[String.fromCharCode(346)]='S';
valid_char[String.fromCharCode(378)]='z';
valid_char[String.fromCharCode(377)]='Z';

function validChar(c)
{
  var k;
  for(k in valid_char)
  {
//  	alert(c+'='+k);
  	if (c==k)
  	  return valid_char[k];
  }
//  alert(c.charCodeAt(0));
  return c;
}
function validString(s)
{
  if(!s)
  	return;
  var new_s="";
  var i;
  for(i=0;i<s.length;i++)
    new_s+=validChar(s.substring(i,i+1));
  return new_s;
}
function validStringInput(o)
{
  var s=o.value;
  if(!s)
    return;
    
  s=validString(s);
  //o.value=s.toUpperCase();
	o.value=s;
}
function validEmailInput(o)
{
  var s=o.value;
  if(!s)
    return;
    
  o.value=validString(s);
}

function sToUpper(o)
{
  var t=o.value;
  if (t.length > 0 && t!=t.toUpperCase())
	  o.value = t;
    //o.value=t.toUpperCase();
}
//------------------		 
/*===================================== js dla menu*/
// JavaScript Document
/*
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;
*/
/*=================================================*/	
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}			

function ShowGuestbookForm(){

  document.getElementById("guestbook_form").style.display = "block";
}	


function enlarge(image) {
var i = new Image();
i.src = image;
var x = i.width;
var y = i.height;
// window.status for degugging:
window.status = image + " = " + x + " x " + y + " pixels";
var z = "resizable=yes,scrollbars=no,width=" + (x+50) + ",height=" + (y+50);
window.open(image,"image",z);
}


// Set the horizontal and vertical position for the popup
PositionX = 100;
PositionY = 100;
// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth  = 500;
defaultHeight = 500;
// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = true;
// Do not edit below this line...
// ================================



if (parseInt(navigator.appVersion.charAt(0))>=4)
{
	var isNN=(navigator.appName=="Netscape" || navigator.appName=="Opera")?1:0;
  var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
  var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
  var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
	

  function popImage(imageURL,imageTitle)
	{
    if (isNN){imgWin=window.open('about:blank','',optNN);}
    if (isIE){imgWin=window.open('about:blank','',optIE);}

    with (imgWin.document)
		{
      writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
			writeln('<sc'+'ript>');
      writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
      writeln('isNN=(navigator.appName=="Netscape" || navigator.appName=="Opera")?1:0;');
			writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('isOO=(navigator.appName=="Opera")?1:0;');
      writeln('function reSizeToImage(){');
			writeln('if (isIE){');
			writeln('window.resizeTo(500,500);');
      writeln('width=500-(document.body.clientWidth-document.images[0].width);');
      writeln('height=500-(document.body.clientHeight-document.images[0].height);');
      writeln('window.resizeTo(width,height);}');
			writeln('if (isNN){');       
      writeln('window.innerWidth=document.images["George"].width;');
			writeln('window.innerHeight=document.images["George"].height;}}');
      writeln('function doTitle(){document.title="'+imageTitle+'";}');

			
			writeln('</sc'+'ript>');
      if (!AutoClose) 
			  writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
      else 
			  writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
      writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
      close();		
    }
	}