var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17320894-1']);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

function btnOn(p) {
	p = "#" + p;
	if ($(p).length) {
		var src = $(p).attr("src").replace(/_0./i, "_1.");
		$(p).attr("src", src);
	};
};

function btnOff(p) {
	p = "#" + p;
	if ($(p).length) {
		var src = $(p).attr("src").replace(/_1./i, "_0.");
		$(p).attr("src", src);
	};
};

function setHeight() {
	var winH;
	if (self.innerWidth) {
		winH = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		winH = document.documentElement.clientHeight;
	} else if (document.body) {
		winH = document.body.clientHeight;
	};
	if (winH < 600) {
		winH = 600;
	}
	if ($("#divMenu").length) {
		$("#divMenu").css("minHeight", winH-225 + "px");
	}
};

var menuitems = {m1:20, m12:20, m2:30, m3:30};

function writeMenu(cm) {
	$.each(menuitems, function(m, val) {
		if ( cm == m ||
			 (m.length == 2 && cm.substring(0, m.length) == m)) {
			document.writeln('<img id="' + m + '" src="img/inner/' + m +'_1.png" border="0"/>');
		} else {
			if (m.length == 2 || m.substring(0, 2) == cm.substring(0, 2)) {
				document.writeln('<a href="' + m + '.html" onmouseover="btnOn(\'' + m + '\')" onmouseout="btnOff(\'' + m + '\')"><img id="' + m + '" src="img/inner/' + m +'_0.png" border="0"/></a>');
			};
		}
	});
	document.writeln('<img src="img/inner/mx.png"/><br/>');
	document.writeln('<img src="img/x.gif" width="150" height="140"/><a href="mailto:nyakep@nyakep.hu" onmouseover="btnOn(\'bm\')" onmouseout="btnOff(\'bm\')"><img id="bm" src="img/inner/mail_0.png" border="0"/></a>');
};

window.onresize = setHeight;
