// JavaScript Document
	function setSize(width,height) 
	{
		if (window.innerWidth) 
		{
			window.innerWidth = width;
			window.innerHeight = height;
		}
		else if (document.body.clientWidth) 
		{
			window.resizeTo(width+30,height+52);
		}
		else 
		{
			alert("Twoja przegldarka nie obsluguje tej opcji.");
		}
	}
	
	function openNewClean(href,title,width,height)
	{
		//alert('width='+width+' height='+height);
		//window.open(href,title,"width="+width+",height="+height+",directories=0,location=0,menubar=0,resizable=1,scrollbars=0,toolbar=0").focus();
		var win = window.open(href,title,'width='+width+',height='+height+',directories=0,location=0,menubar=0,resizable=1,scrollbars=1,toolbar=0');
		win.focus();
	}

	var preLoadFlag = false;

	function switchImages(where, what) 
	{
	   if (preLoadFlag == true)
		{
			document.images[where].src = what;
		}
	}

	function simplePreload()
	{ 
	  var args = simplePreload.arguments;
	  document.imageArray = new Array(args.length);
	  for(var i=0; i<args.length; i++)
	  {
		document.imageArray[i] = new Image;
		document.imageArray[i].src = args[i];
	  }
	  preLoadFlag = true;
	}
	
	//funkcja uzywana przy sprawdzaniu formularzy (czy nie podano ciagu pustych znakow
	function trim(s) {
	  while (s.substring(0,1) == ' ') {
		s = s.substring(1,s.length);
	  }
	  while (s.substring(s.length-1,s.length) == ' ') {
		s = s.substring(0,s.length-1);
	  }
	  return s;
	}
	
	//funkcja do potwierdzania wyboru opcji
	function confirmation(tekst)
	{
		return window.confirm(tekst);
	}
	
	//funkcja wywolujaca atlas geograficzny
	function atlas()
	{
		//window.alert('uruchamiam atlas');
		window.open('atlas/index.php','atlas',"directories=0,location=0,menubar=0,resizable=1,scrollbars=1,toolbar=0,top=0,left=0")
	}
	
	function zliczaj_znaki(ile_znakow,nazwa_pola,nazwa_pola_pozostalo)
	{
		var elem	  = document.getElementById(nazwa_pola);
		var pozostalo = document.getElementById(nazwa_pola_pozostalo);
		if (elem.value.length < ile_znakow+1)
		  pozostalo.value = ile_znakow - elem.value.length;
		else
			window.alert('Przekroczono dozwolona ilosc znaków !!!');
	}
