kepszam = 34;

function kepekKiiras(){
	var oszlop = 4;
	var str = '';
	var si = '';
	for (var i = 0; i < kepszam;){
		str += '<' + 'DIV class="kepsor">';
			for (var j = 0; (i < kepszam) && (j < oszlop); ++i, ++j){
				str += '<' + 'DIV class="kepcella">';
					si = (((i + 1) < 10) ? ('0' + (i + 1)) : ('' + (i + 1)));
					str += '<' + 'A rel="lightbox-kc" href="pictures/kc_' + si + '.jpg" title="' + (i + 1) + '. kép"><' + 'IMG class="" src="pictures/kc_' + si + '_kicsi.jpg" alt="' + (i + 1) + '. kép"><' + '/A>';
				str += '<' + '/DIV>';
			}
		str += '<' + '/DIV>';
		str += '<' + 'DIV class="ter01"><' + '/DIV>';
	}
	document.getElementById('TERMEKKEPEK').innerHTML = str;
}

window.addEvent(
	"domready",
	function(){
		$$(document.links).filter(
			function(el) {
				return el.rel && el.rel.test(/^lightbox-/i);
			}
		).slimbox(
			{
				counterText: 'összesen {y} kép'
			},
			null,
			function(el){
				return true;
			}
		);
	}
);

self.addLoadEventListener = function(listener){
	if (typeof this.addEventListener != 'undefined'){
		this.addEventListener('load', listener, false);
	}
	else if (typeof this.document.addEventListener != 'undefined'){
		this.document.addEventListener('load', listener, false);
	}
	else if (typeof this.attachEvent != 'undefined'){
		this.attachEvent('onload', listener);
	}
	else {
		if (typeof this.onload == 'function'){
			var oldListeners = this.onload;
			this.onload = function(){
				oldListeners();
				listener();
			};
		}
		else {
			this.onload = listener;
		}
	}
}

self.addLoadEventListener(
	function(){
		AktivTartalom = 0;
		document.getElementById('MENU_' + AktivTartalom).style.backgroundPosition = '50% ' + (((-72) * AktivTartalom) - 48) + 'px';
		document.getElementById('TARTALOM_' + AktivTartalom).style.display = 'block';
		for (var i = 0; i < 3; ++i){
			document.getElementById('MENU_' + i).onclick = function(){
				var menuId = (this.id.split('_')[1] - 0);
				if (menuId !== AktivTartalom){
					document.getElementById('MENU_' + AktivTartalom).style.backgroundPosition = '50% ' + ((-72) * AktivTartalom) + 'px';
					document.getElementById('TARTALOM_' + AktivTartalom).style.display = 'none';
					AktivTartalom = menuId;
					this.style.backgroundPosition = '50% ' + (((-72) * menuId) - 48) + 'px';
					document.getElementById('TARTALOM_' + menuId).style.display = 'block';
					if (
						(menuId === 2)
						&&
						($('TERKEP').src !== 'http://maps.google.com/maps?f=d&source=embed&saddr=&daddr=47.584951,18.394815&hl=hu&geocode=&mra=mi&mrsp=0&sz=17&sll=47.584961,18.394321&sspn=0.00592,0.013003&ie=UTF8&ll=47.584964,18.39431&spn=0.002316,0.006866&z=17&output=embed')
					){
						$('TERKEP').src = 'http://maps.google.com/maps?f=d&source=embed&saddr=&daddr=47.584951,18.394815&hl=hu&geocode=&mra=mi&mrsp=0&sz=17&sll=47.584961,18.394321&sspn=0.00592,0.013003&ie=UTF8&ll=47.584964,18.39431&spn=0.002316,0.006866&z=17&output=embed';
					}
				}
			};
			document.getElementById('MENU_' + i).onmouseover = function(){
				var menuId = (this.id.split('_')[1] - 0);
				if (menuId !== AktivTartalom){
					this.style.backgroundPosition = '50% ' + (((-72) * menuId) - 24) + 'px';
				}
			};
			document.getElementById('MENU_' + i).onmouseout = function(){
				var menuId = (this.id.split('_')[1] - 0);
				if (menuId !== AktivTartalom){
					this.style.backgroundPosition = '50% ' + ((-72) * menuId) + 'px';
				}
			};
		}
	}
);

