function Photo(str) {
	script = String(str).replace(/(\w+)\/(\d{2}.jpg)/, "$1.inc.php?foto=$2");
	//alert(script);
	//return;
	gal = window.open(script,'fotka','width=630,height=540,left=0,top=0,resizable=yes,scrollbars=yes');
	gal.focus();
}
//
function validateForm(g) {
	g.info.optional = true;
	if(g.href) {
		if (g.img_href && (g.href.value != '') && (g.img_href.value != '')) {
			if (g.img_href.value.search(/(gif$|png$|jpg|jpeg)$/) == -1) {
				alert("Niepoprawny plik!");
				return false;
			} 
		}
		g.href.optional = true;
	}
	var fieldEmpty = '';
	var eValEmpty = '';
	for (var noElement = 0; noElement<g.elements.length; noElement++) {
		var element = g.elements[noElement];
		if (((element.type == 'text') || (element.type == 'textarea')) && !element.optional) {
			if (element.type == 'textarea') {
				splits = element.value.split(/\s/);
				for (var whiteSpace in splits) {
					if (splits[whiteSpace] != '') {
						eValEmpty += splits[whiteSpace]+" ";
					}
				}
				element.value = eValEmpty;
				element.value = element.value.replace(/^\s+/, '');
				element.value = element.value.replace(/\s+$/, '');
			}
			if (element.value == '') {
				fieldEmpty = fieldEmpty+"\n - "+element.name;
			}
		}
	}
	if (fieldEmpty) {
		alert('Wypełnij:'+"\n"+fieldEmpty);
		return false;
	}
	return true;
}
//
function radioCheck(f)
{
	for(var noElement=0; noElement<f.elements.length; noElement++)
	{
		var element = f.elements[noElement];
		if (element.checked) return true;
	}
	return false;
}
//
function autoLoad()
{
	if (anchors = document.getElementsByTagName("a"))
	{
		for (var i = 0; i<anchors.length; i++)
		{
			if (anchors[i].className == "blank" || anchors[i].className == "http" || anchors[i].className == "http_white") anchors[i].target = "_blank";
		}
	}
}

try
{
	window.addEventListener("load", autoLoad, true);
}
catch(e)
{
	window.attachEvent("onload", autoLoad);
}
