// Készítette: Győrváry Tamás
// Mindennemű felhasználás előtt kérjük a készítővel egyeztetni:
// E-mail: tomka@pumpkin.hu

	var imgn="";
	var imgo="";
	
	
	//kepek betoltes fuggvenye
	function preload(imgSrc) {
	eval(imgSrc+'_off = new Image()')
	eval(imgSrc+'_off.src = "images/"+imgSrc+".gif"')
	eval(imgSrc+'_on = new Image()')
	eval(imgSrc+'_on.src = "images/"+imgSrc+"_sel.gif"')
	}
	
	//kep cserelgetes fomenuben fuggveny
	function chimg(imgName,imgObj) {
	    document.images[imgName].src = eval(imgObj+".src");
		imgn=imgName;
		imgo=imgObj;
	}
	
	//kepek betoltese
	
	menuitems=new Array('cegtortenet','ujauto','hasznaltauto','szerviz','alkatresz','autoberles','akciok','sms', 'assistance', 'elerhetoseg', 'linkek', 'eladotesztautok')
	
	for (i=0;i<menuitems.length;i++) {
		preload('layLeftMenu_'+menuitems[i])
		}
	

	//fomenuhoz tartozo fuggvenyeket indit
	function act(TI) {
		deact();chimg(TI,TI+'_on');
	}

	//minden valtoztatast visszaallit ami a fomenuhoz tartozik
	function deact() {
			imgoend=imgo.substr(imgo.length-2,imgo.length);
			imgo=imgo.substr(0,imgo.length-3);
			if (imgoend=="on") {
			chimg(imgn,imgo+'_off');
			}
			imgo="";
			imgn="";
	}

	//kép - popup
	function popImage(imageURL) {
        var opt='scrollbars=no,width=150,height=100,left=100,top=100';
        imgWin = window.open('','',opt);
        with (imgWin.document) {
                writeln('<html><head><title>...</title><style type="text/css">body {overflow: auto; margin: auto; margin:0; padding: 0;}</style>');
                writeln('<sc'+'ript type="text/javascript">');
                writeln('function resizePopup() {');
                writeln('width = document.images[0].width + 10; ');
                writeln('height = document.images[0].height + 30; ');
                writeln('window.resizeTo(width,height); ');
                writeln('if (window.innerWidth) { window.innerWidth = width - 10; window.innerHeight = height + 30; }');
                writeln('}');
                writeln('</s' + 'cript>');
                writeln('</head><body bgcolor="#000000" onload="resizePopup();">')
                writeln('<img src="'+imageURL+'" onclick="window.close();" border="0" style="position: absolute; left: 0px; top: 0px; cursor: pointer;"/></body></html>');
                close();
	        }
	}
	
	//sima popup	
	function createpopup(url, width, height)
	 {
	   popupz = window.open(url, "", "width=" + width + ", height=" + height + ", resizable=yes, menubar=no, toolbar=no, scrollbars=yes, location=no, status=no");
	   popupz.moveTo((screen.width / 2) - parseInt(width / 2), (screen.height / 2) - parseInt(height / 2));
	 }