function powieksz(el, fname, s, w)
{

	wys = w + 5;
	szer = s + 25;

	  if(window.screen){
		aw=screen.availWidth;
		ah=screen.availHeight;
	  }else{
		aw=640;
		ah=450;
	  }

	  if (szer>800) szer = 830;
	  if (wys>600) wys = 630;

	str = "foto.php?id="+escape(el)+"&ph="+escape(fname);
	var win = window.open(str,"zoom","width="+szer+", height="+wys+", left="+(aw-szer)/2+", top="+ (ah-wys)/2+", titlebar=no, status=no, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=yes, fullscreen=no");
	win.focus();
}

function wnd_print(src)
{
	w = 678;
	h = 400;
  if(window.screen){
	  if (w>900 || h>600)
	  {
	    aw=900;
		ah=600;
	  }
	  else
	  {
	    aw=screen.availWidth;
		ah=screen.availHeight;
	  }
  }else{
    aw=640;
    ah=450;
  }
  //if(noweOkienko==null || noweOkienko.closed){
    ustawienia=
     "left=" + (aw-w)/2 + ", "
    +"top=" + (ah-h)/2 + ", "
    +"screenX=" + (aw-w)/2 + ", "
    +"screenY=" + (ah-h)/2 + ", "
    +"width=" + w + ", "
    +"height=" + h + ", "
    +"innerWidth=" + w + ", "
    +"innerHeight=" + h + ", "
    +"toolbar=yes, "
    +"location=no, "
    +"directories=no, "
    +"status=no, "
    +"menubar=yes, "
    +"scrollbars=yes, "
    +"resizable=yes, "
	+"status=no";
	noweOkienko = window.open(src,'printwww',ustawienia);

  //}
  noweOkienko.focus();
  return noweOkienko;
}


noweOkienko = null;
function wnd(src, nazwa, w, h)
{
  if(window.screen){
    aw=screen.availWidth;
	ah=screen.availHeight;
  }else{
    aw=800;
    ah=600;
  }

	w = w > aw ? aw : w;
  	h = h > ah ? ah : h;

  //if(noweOkienko==null || noweOkienko.closed){
    ustawienia=
     "left=" + (aw-w)/2 + ", "
    +"top=" + (ah-h)/2 + ", "
    +"screenX=" + (aw-w)/2 + ", "
    +"screenY=" + (ah-h)/2 + ", "
    +"width=" + w + ", "
    +"height=" + h + ", "
    +"innerWidth=" + w + ", "
    +"innerHeight=" + h + ", "
    +"toolbar=no, "
    +"location=no, "
    +"directories=no, "
    +"status=no, "
    +"menubar=no, "
    +"resizable=no, "
	+"status=no";
   if( w == aw || h == ah ) ustawienia += ", scrollbars=yes ";

	noweOkienko = window.open(src,nazwa,ustawienia);

  //}
  noweOkienko.focus();
  return noweOkienko;
}



function mySend(f)
{
	if (!CheckEMail(f.ml.value))
	{
		alert("Podaj poprawnie adres e-mail...");
		f.ml.focus();
		return;
	}
	return true;
}

function CheckEMail(adres)
{
	if (adres.indexOf('@') == -1)
		return false;
	if (adres.length < 4)
		return false;
	if (adres.indexOf('@') != adres.lastIndexOf('@'))
		return false;
	if (adres.indexOf(' ') != -1)
		return false;
	return true;
}

function mywrite(cont) { document.write(cont); }

function isEmail(s) {
	return s != "" 	&& s.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/);
}

function checkNonEmpty(obj, msg, focus) {
  		s = obj.value.replace(/(\s)*/, '');
  		if( s == '' ) {
  			if( msg != '' ) alert(msg);
  			if( focus )
  				obj.focus();
			return false;
  		}
  		return true;
}


function getFlashMovieObject(movieName)
{
  if (window.document[movieName])
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName];
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }

}

function SendDataToFlashMovie(flash,val)
{
     var flashMovie=getFlashMovieObject( flash );
     if( flashMovie != null )
     	flashMovie.SetVariable("/:message", val);
}

/* works with IE 4+, NS4, NS6 and other Gecko, OmniWeb, Opera (4) 5+,
iCab, IceBrowser, Esape 4, HotJava 3, Konqueror and, as long as they
follow the standards, loads more */
/* e - event object */
function findCoords(e) {
   var posX = 0, posY = 0;
   if( !e ) { e = window.event; } if( !e ) { return [ 0, 0 ]; }
   if( typeof( e.pageX ) == 'number' ) {
      posX = e.pageX; posY = e.pageY;
   } else {
      if( typeof( e.clientX ) == 'number' ) {
         posX = e.clientX; posY = e.clientY;
         if( document.body && ( document.body.scrollTop || document.body.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) ) {
               posX += document.body.scrollLeft; posY += document.body.scrollTop;
         }  else {
            if( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) ) {
               posX += document.documentElement.scrollLeft; posY += document.documentElement.scrollTop;
            }
         }
      }
   }
   return [ posX, posY ];
}
