function validate_SendLink( field_id )
{
	if (!/^[a-zA-Z0-9\-_\.]+?@[a-zA-Z0-9\-_\.]+?\.[a-zA-Z]{2,4}$/.test(document.getElementById(field_id).value))
	{
		alert("Podany adres e-mail jest błędny!");
		document.getElementById(field_id).select();
		return false;
	}
	else
	{
		return true;
	}
}

function set_page(id)
{
	var el = document.getElementById(id);
	var y=0;
	for( var node=el; node; node=node.offsetParent)
	{
		y += node.offsetTop;
	}
	window.scrollTo(0, y);
}

function toggleList(tree_id) {
	var element = document.getElementById("parent"+tree_id);
	var more = document.getElementById("child"+tree_id);
	
	if (element) {
		if (element.style.display == 'none') {
			element.style.display = 'block';
			more.className = (more.className.match(/active/)) ? 'minus_active' : 'minus';
		}
		else {
			element.style.display = 'none';
			more.className = (more.className.match(/active/)) ? 'plus_active' : 'plus';
		}
	}
}


function v_post_code(v,i) {
	if (!v.match(/^\d\d-\d\d\d$/)) {
		alert("Wprowadź kod pocztowy w formacie xx-xxx!");
		document.getElementById(i).focus();
	}
}


function setCookie(cookieName, cookieValue, cookieExp)
{
	document.cookie = cookieName + '=' + escape(cookieValue)+(cookieExp?'; expires='+new Date(+new Date()+cookieExp*864e5).toGMTString():'')+'; path=/'
}
function getCookie(N,x)
{
	if((x=document.cookie)&&(N=(';'+x).match(new RegExp('(;| )'+N+'=[^;]+')))) 
	return unescape(N[0].split(/=/g)[1])
}



iz=0;
function photo(url,w,h)
{
	win=window.open('','win'+iz, 'left=0,top=0,width='+w+',height='+h+',innerheight='+h+',innerwidth='+w+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no')
	win.document.write('<html><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-2"></head>');
	win.document.write('<title>Powiększenie</title><body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
	win.document.write('<div align="center"><a href="#" onclick="javascript:self.close();"><img src="'+url+'" title="Zamknij" border="0"></a></div></body></html>');
	win.focus();
	iz+=1;
}