var lastImg = null;

function imgSwap(ev,imgName) {
if (imgName != 0) {
	lastImg = ev.src;
	ev.src = imgName;
	}	
	else
	{
	ev.src = lastImg;
	}
}
function checkFields(newForm) {
	if (newForm.title.value == '') {
		alert('Brak tytu?u');
		return ;
	} else if (newForm.body.value == '') {
		alert('Brak tre?ci');
		return ;
	}
	newForm.submit();
}


function fullsize(pI,title,desc) {
        if(document.all){picId = "/_uTils/site/gallery.html?" + pI + "&title=" + encodeURIComponent(escape(title)) + "&desc=" + encodeURIComponent(escape(desc));}
        else{picId = "/_uTils/site/gallery.html?" + pI + "&title=" + escape(title) + "&desc=" + escape(desc);}
//picId = encodeURI(picId);
        Win = window.open(picId,'DispalyWindow','width=300, height=300, resizable=yes, scrollbars=auto menubar=no, location=no, left=0, top=0');
        return;
}
function isN(v,f,n) {
	if(v.length>0)if((v!=~~v)||(v<=0)){alert('Wymagana jest liczba ca?kowita dodatnia.');o=eval('document.'+f+"."+n);o.value="";}
}
function openInNewWindow(href){
	return window.open(href, null, 'left=0, top=0');
}

function openWindow(url,top,left,width,height) {
	var p = "";
	if (top>-1) p=",top="+top;
	if (left>-1) p=p+",left="+left;
	if (width>-1) p=p+",width="+width;
	if (height>-1) p=p+",height="+height;
	window.open(url,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'+p);
}

function getLang() {
	if (typeof siteLang == "string") {
		switch (siteLang) {
			case "en":	return 0; break;
			case "pl":	return 1; break;
			case "de":	return 2; break;
			case "es":	return 3; break;
			case "se":	return 4; break;
		}
	} else {
		 return 1; /*"en"*/
	}
}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") ==
		"external") {
			anchor.target = "_blank";
		}
	}
}
window.onload = externalLinks;

/* Wyniki wyszukiwania */
		function swapPage_1(offset) {
		document.forms['searchNav1'].elements['offset'].value = offset;
		document.forms['searchNav1'].submit();
		}
		function swapPage_2(offset) {
		document.forms['searchNav2'].elements['offset'].value = offset;
		document.forms['searchNav2'].submit();
		}

