function displayWindow(url, width, height){
var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',top=30,left=100,resizable=no,scrollbars=no,menubar=no');
}


function popGal(){
	for (var i=0; (a=document.getElementsByTagName('a')[i]);i++) {
		if (a.className == "popGal"){
			a.onclick = function(){
				window.open(this.href,'Image','left=100,top=100,width=100,height=100,status=yes,resizable=yes');
				return false;
			}
		}
	}
}

function popGallery(){
	for (var i=0; (a=document.getElementsByTagName('a')[i]);i++) {
		if (a.className == "popGallery"){
			a.onclick = function(){
				window.open(this.href,'Gallery','left='+(screen.availWidth/2-375)+',top='+(screen.availHeight/2-250)+',width=770,height=500,scrollbars=yes,status=yes,resizable=yes');
				return false;
			}
		}
	}
}

function externalLinks(){
	for (var i=0; (a=document.getElementsByTagName('a')[i]);i++) {
          if (a.getAttribute("rel") == "external")
               a.target = "_blank";

	}
}

function popMap(){
	for (var i=0; (a=document.getElementsByTagName('a')[i]);i++){
		if (a.className == "popMap"){
			a.onclick = function () { 
				var con = document.getElementById('mapf');
				con.style.display = "block";
				return false;
			}
			document.getElementById('mapfc').onclick=function(){
				this.parentNode.style.display = 'none';
			}
		}
	}
}

function submitForm(){
	var f = document.getElementById('contactForm');
	if (!f) return;
	f.onsubmit = function () {
		for (var i=0; (inp=this.getElementsByTagName('input')[i]); i++){
			if (inp.className == "mandatory" && inp.value==""){
				alert('Wypełnij wszystkie pola formularza');
				return false;
			}
		}
		for (var i=0; (txt=this.getElementsByTagName('textarea')[i]); i++){
			if (txt.className == "mandatory" && txt.value==""){
				alert('Wypełnij wszystkie pola formularza');
				return false;
			}
		}
	}
}

function init(){
	if(arguments.callee.done)return;
	arguments.callee.done=true;
	externalLinks();
	popGal();
	popGallery();
	popMap();
	submitForm();
};

if(document.addEventListener){document.addEventListener("DOMContentLoaded", init, null);}
/*@cc_on @*/
/*@if (@_win32)
  document.write('<script defer="defer" src="ie_onload.js"><'+'/script>');
/*@end @*/
window.onload=init;
