function mywrite(flash)
{
//	alert(flash);
	document.write(flash)
}


function $(name)
{
	obj =  document.getElementById(name);
	return obj;
}

function ShowHide(id)
{
//	alert
	if ($(id).style.display == "none")
		$(id).style.display = "block"
	else
		$(id).style.display = "none";
}


var last;
function SetOne(name)
{
	last = name;
}

function ShowOne(name)
{
	$(last).style.display = "none";
	$(name).style.display = "block";
	$("bt_"+last).style.fontWeight = "normal";
	$("bt_"+name).style.fontWeight = "bold";
	last = name;
}




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 checkZapytanie(f)
{
	if (!f.nazwisko.value)
	{
		alert("Prosze podać dane osoby do kontaktu...");
		f.nazwisko.focus();
		return false;
	}

	if (!f.adres.value)
	{
		alert("Prosze podać adres...");
		f.adres.focus();
		return false;
	}

	
	if (!f.email.value && !f.telefon.value)
	{
		alert("Prosze podać adres e-mail lub telefon kontaktowy...");
		f.telefon.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

var selected;

function initMenu(str, sel)
{
	if (navigator.appVersion.indexOf("MSIE")>0)
	{
		str = str.split(",");
		for (var i in str)
		{			
			obj = $("submenu"+str[i]);
			if (obj) obj.style.left = obj.offsetLeft + "px";	
		}
	}

	selected = "submenu"+sel;
	if (sel)
	{
		selected = "submenu"+sel;
		showmenu("",selected);
	}
}


z = 1000;
function showmenu(e,object)
{
	
	if (!document.all&&!document.getElementById&&!document.layers) 
		return;

	if (window.menuobj) 
		hidemenu(object);

	clearhidemenu();
	
	menuobj=$(object);
	if (menuobj)
	{
		menuobj.className = "submenu_on";
//		if (object == selected ) menuobj.className = "submenu_on submenu_sel";
	}

return false
}

function hidemenu(object)
{
	if (window.menuobj)
	{
//		menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
		menuobj.className = "submenu";
	}
	
	if (!object)
	{
//		delayhide=setTimeout('showmenu("",selected);',500)
		showmenu("",selected);
	}
}

function dynamichide(e)
{
	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;
	}
}

