function mywrite(flash)
{
	document.write(flash)
}


function $(name)
{
	obj =  document.getElementById(name);
	return obj;
}


function CheckEMail(address) {
	return address != "" 	&& address.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/);	
}

function myMail(f)
{
	if (!CheckEMail(f.email.value))
	{
		alert("Prosze podać poprawnie adres e-mail...");
		f.email.focus();
		return false;
	}

	return true;
}


function checkKontakt(f)
{
	if (!f.nazwisko.value)
	{
		alert("Prosze podać imię i nazwisko...");
		f.nazwisko.focus();
		return false;
	}

	
	if (!f.email.value && !f.telefon.value)
	{
		alert("Prosze podać adres e-mail lub telefon kontaktowy...");
		f.email.focus();
		return false;
	}
	
	if (f.email.value && !CheckEMail(f.email.value))
	{
		alert("Prosze podać poprawnie adres e-mail...");
		f.email.focus();
		return false;
	}
	
/*
	if (!f.temat.value)
	{
		alert("Prosze podać temat wiadomości...");
		f.temat.focus();
		return false;
	}
*/

	if (!f.tresc.value)
	{
		alert("Prosze podać treść wiadomości...");
		f.tresc.focus();
		return false;
	}

	return true;
}



function checkPrzedstawiciel(f)
{
	if (!f.nazwisko.value)
	{
		alert("Prosze podać imię i nazwisko...");
		f.nazwisko.focus();
		return false;
	}

	
	if (!f.email.value && !f.telefon.value)
	{
		alert("Prosze podać adres e-mail lub telefon kontaktowy...");
		f.email.focus();
		return false;
	}
	
	if (f.email.value && !CheckEMail(f.email.value))
	{
		alert("Prosze podać poprawnie adres e-mail...");
		f.email.focus();
		return false;
	}
	
/*
	if (!f.temat.value)
	{
		alert("Prosze podać temat wiadomości...");
		f.temat.focus();
		return false;
	}
*/

	if (!f.tresc.value)
	{
		alert("Prosze podać treść wiadomości...");
		f.tresc.focus();
		return false;
	}

	return true;
}



function checkZapytaj(f)
{
	if (!f.nazwisko.value)
	{
		alert("Prosze podać imię i nazwisko...");
		f.nazwisko.focus();
		return false;
	}

	
	if (!f.email.value && !f.telefon.value)
	{
		alert("Prosze podać adres e-mail lub telefon kontaktowy...");
		f.email.focus();
		return false;
	}
	
	if (f.email.value && !CheckEMail(f.email.value))
	{
		alert("Prosze podać poprawnie adres e-mail...");
		f.email.focus();
		return false;
	}
	
/*
	if (!f.temat.value)
	{
		alert("Prosze podać temat wiadomości...");
		f.temat.focus();
		return false;
	}
*/

	if (!f.tresc.value)
	{
		alert("Prosze podać treść wiadomości...");
		f.tresc.focus();
		return false;
	}

	return true;
}


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>810) szer = 810;
	  if (wys>610) wys = 610;

	str = "foto.php?dir="+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();

}


var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers

z = 1000;
function showmenu(e,object)
{
	if (!document.all&&!document.getElementById&&!document.layers) 
		return;

	if (window.menuobj) 
		hidemenu();

	clearhidemenu();
	
	menuobj=document.getElementById(object);
	if (menuobj)
	{
		menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj
		menuobj.thestyle.visibility="visible"
		menuobj.thestyle.zIndex=z++;
	}
//	alert(z + " " +menuobj.thestyle.zIndex);
//	pozobj=document.getElementById('poz_'+object);
//	if (pozobj)
//		pozobj.className='menu_hover';

return false
}

function hidemenu()
{
	if (window.menuobj)
	{
		menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
//		pozobj.className='menu';
	}
}

function dynamichide(e)
{
	if (ie4&&!menuobj.contains(e.toElement))
		delayhidemenu()
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
		delayhidemenu()
}

function delayhidemenu()
{
	if (ie4||ns6||ns4)
	delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu()
{
	if (window.delayhide)
		clearTimeout(delayhide)
}


function sel_change(object)
{
	clearhidemenu();

	if (object.className=='zmien_on')
		object.className='zmien_off';
	else
		object.className='zmien_on';
}

if (ie4||ns6)
	document.onClick=hidemenu();
	

var act_odp;
function odp(id)
{
	if ($("odp_"+act_odp))
	{
		$("odp_"+act_odp).style.display = "none";
	}

	if ($("odp_"+id))
	{
		$("odp_"+id).style.display = "block";
		act_odp = id;
	}
	return;
}

var last=-3;
var z=0;
function Region(numer)
{
//	alert(numer);
	if (last>-2 && last!=numer)
	{
		opacity("region_"+last, 100, 0, 1000);
	}
	
	
	if (last!=numer)
	{
		changeOpac(0, "region_"+numer)
		$("region_"+numer).style.display = "block";
		$("region_"+numer).style.zIndex = z++;		
		opacity("region_"+numer, 30, 100, 1000);
		last=numer;
	}
}

