// JavaScript Document

var moz = (document.getElementById && !document.all) ? 1 : 0;
 NS4 = (document.layers) ? 1 : 0;
 IE4 = (document.all) ? 1 : 0;
 DOM = (document.getElementById) ? 1 : 0;
 
nPlus = 4   //the % of fading for each step
speed = 25  //the speed
nOpac = 100

function go(code,pnum){
  if(document.getElementById){
	speed = 25;
    document.getElementById('alsokep').style.visibility="visible";
    imgs = document.getElementById('felsokep');
	opacity = nOpac+nPlus;
	nOpac = opacity;
    if (opacity>100){
        nPlus=-nPlus;
		alsoid = "kep/" + code + (1 + Math.floor(pnum * Math.random()))+".jpg";
		document.getElementById("alsokep").src = alsoid
		speed = 2500;
    }
	if (opacity<0) {
        nPlus=-nPlus;
		felsoid = "kep/" + code + (1 + Math.floor(pnum * Math.random()))+".jpg";
		document.getElementById("felsokep").src = felsoid
		speed = 2500;
    }
	setTimeout('go("' + code + '",' + pnum + ')',speed);
    if(IE4){
        imgs.style.filter="alpha(opacity=0)";
		imgs.filters.alpha.opacity = opacity;
    } else {
        imgs.style.MozOpacity = 0;
		imgs.style.MozOpacity = opacity/100;
    }
  }
}

function nyit(x,y) {
	mag = Number(y)*15;
	if (NS4) {
		document.layers[x].height=mag;
	} else if (IE4) {
		document.all[x].style.height=mag;
	} else if (DOM) {
		document.getElementById(x).style.height=mag;
	}
}

function popup(){
	document.getElementById('hirdet').style.display='inline';
	document.getElementById('hirdet').style.left='150px';
	document.getElementById('hirdet').style.top='70px';
}

function bezar(){
	document.getElementById('hirdet').style.display='none';
}

// Insert in Head section:
/*
<script language="JavaScript">
window.attachEvent("onload", correctPNG);
</script>
*/
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
	for(var i=0; i<document.images.length; i++)
	{
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		 {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
		 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
		 }
	}
}

function pop(kep,w,h,tit) {
	var msg = window.open('ures.html','popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',top=100,left=100');
	msg.document.write('<head>');
	msg.document.write('<title>'+tit+'</title>');
	msg.document.write('<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">');
	msg.document.write('</head>');

	msg.document.write('<body style="margin: 0px; padding: 0px;">');
	msg.document.write('<a href="javascript: window.close();">');
	msg.document.write('<img width="'+w+'" height="'+h+'" src="'+kep+'" border="0" alt="'+tit+'">');
	msg.document.write('</a></body>');
	msg.document.write('</html>');
	msg.document.close();
}

function poppage(oldal) {
	var msg = window.open(oldal+'.html','popup','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=500,height=300,top=100,left=100');
}

function kepcsere(x,kep)  {
	if (NS4) {
		document.layers[x].src=kep;
	} else if (IE4) {
		document.all[x].src=kep;
	} else if (DOM) {
		document.getElementById(x).src=kep;
	}
}

function show(x)  {
   if (NS4)
   {
    document.layers[x].display='inline';
   }
   else if (IE4)
   {
    document.all[x].style.display='inline';
    }
   else if (DOM)
   {
    document.getElementById(x).style.display='inline';
   }
}
  
function hide(x) {
   if (NS4)
   {
    document.layers[x].display='none';
   }
   else if (IE4)
   {
    document.all[x].style.display='none';
    }
   else if (DOM)
   {
    document.getElementById(x).style.display='none';
   }
}


