// otwierania linku o klasie openNew w nowym oknie
function newWindow () {
	var hyperlink = document.getElementsByTagName('a');
	
	for (var i=0; i<hyperlink.length; i++) {
		if (String(hyperlink[i].className).match("openNew")) {
			hyperlink[i].onclick = function () {
				window.open(this.href);
				return false;
			}
		}
	}
}

function printInit () {
	var hyperlink = document.getElementsByTagName('a');
	
	for (var i=0; i<hyperlink.length; i++) {
		if (String(hyperlink[i].className).match("print")) {
			hyperlink[i].onclick = function () {
			window.open(this.href,'drukuj','height=600,width=690,top=100,left=100,scrollbars=yes,resizable=yes,status=no');
			return false;
			}
		}
	}
}



function printIt () {
	if (document.getElementById('print')) {
		window.print();
	}
}


function sendemail () {
	var email_from=document.getElementById("email_from").value
	var email_to=document.getElementById("email_to").value
	var mode=document.getElementById("mode").value
	var link=document.getElementById("link").value

	advAJAX.get({
			url: '/util/sendfriendform.htm',
			parameters : {
				"div_id" : "SendFriedForm",
				"mode" : mode,
				"email_from" : email_from,
				"email_to" : email_to,
				"link" : link
			},
			onSuccess : function(obj) {
				document.getElementById("SendFriedForm").innerHTML=obj.responseText;
			},
			onError : function(obj) { alert("Error: " + obj.status); },
			onLoading : function(obj) {
				document.getElementById("SendFriedForm").innerHTML='Wait ...';
			}
	});
}

// swfobject 
function homepageSwf() {
	var flashvars = null;
	var params = {wmode: "transparent"};
	var attributes = null;
	swfobject.embedSWF("/swf/mapa_duza.swf", "duzaMapka", "690", "330", "9.0.28", "/swf/expressInstall.swf", flashvars, params, attributes);
}

function homepageSwf2() {
	var flashvars = null;
	var params = {wmode: "transparent"};
	var attributes = null;
	swfobject.embedSWF("/swf/mapa_mala.swf", "malaMapka", "520", "290", "9.0.28", "/swf/expressInstall.swf", flashvars, params, attributes);
}

window.onload = function js() {
	newWindow();
	printInit();
	printIt();
	homepageSwf();
	homepageSwf2();
	if (document.getElementById('duzaMapka')){homepageSwf();}
	if (document.getElementById('malaMapka')){homepageSwf();}
}





