// 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;
 
function go(){
  auj=new Date();
  if(auj.getMinutes()<10){plusm="0"}else plusm='';
  if(auj.getSeconds()<10){pluss="0"}else pluss='';
  heure=auj.getHours() + ':' + plusm + auj.getMinutes() + ':' + pluss + auj.getSeconds();
  document.getElementById('ora').innerHTML=heure;
  setTimeout("go()",1000)
}

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;
	}
}

// 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 fmenuvalt(id, value) {
	fmn = 'mp' + id;
	fmv = 'menupont' + value;
	document.getElementById(fmn).className = fmv;
}

function almenuvalt(x,to) {
	mnp = 'amp' + x;
	mto = 'almenupont' + to;
	document.getElementById(mnp).className = mto;
}

function showflash(file,width,height) {
    document.write('<div class=\'flash\' style=\'width: ' + width + 'px; height: ' + height + 'px;\'>');
    document.write('<object type=\"application/x-shockwave-flash\" data=\"'+file+'\" width=\"'+width+'\" height=\"'+height+'\">');
    document.write('    <param name=\"movie\" value=\"'+file+'\" />');
    document.write('    <param name=\"wmode\" value=\"transparent\" />');
    document.write('</object>');
    document.write('</div>');
}
function popup(){
	document.getElementById('popup').style.display='inline';
	document.getElementById('popup').style.left='300px';
	document.getElementById('popup').style.top='150px';
}
function magassagallit(azon, mag) {
	document.getElementById(azon).style.height = mag + 'px';
}
function bezar()  {
	x = 'popup';
	if (NS4)
	{
		document.layers[x].diplay = 'none';
	}
	else if (IE4)
	{
		document.all[x].style.display = 'none';
	}
	else if (DOM)
	{
		document.getElementById(x).style.display = 'none';
	}
}

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 check_all(group, action)
{
 for (var i=0; i<group.length; i++)
  group[i].checked = action;
}

function shopimg(xid, event)
{
	if (window.event) 
	{
		y = window.event.clientY;
	} else {
		y = event.pageY;
	}
	document.getElementById(xid).style.top = y - 305;
	document.getElementById(xid).style.display = 'inline';
}

function showit(xid)
{
	document.getElementById(xid).style.display = 'inline';
}
function closeit(xid)
{
	document.getElementById(xid).style.display = 'none';
}

function opclose(x)  {
	if (NS4)
	{
		if (document.layers[x].diplay == 'inline')
		{
			document.layers[x].diplay = 'none';
		} else {
			document.layers[x].diplay = 'inline';
		}
	}
	else if (IE4)
	{
		if (document.all[x].style.display == 'inline')
		{
			document.all[x].style.display = 'none';
		} else {
			document.all[x].style.display = 'inline';
		}
	}
	else if (DOM)
	{
		if (document.getElementById(x).style.display == 'inline')
		{
			document.getElementById(x).style.display = 'none';
		} else {
			document.getElementById(x).style.display = 'inline';
		}
	}
}
  
function show(x)  {
	if (NS4)
	{
		document.layers[x].visibility='show';
	}
	else if (IE4)
	{
		document.all[x].style.visibility='visible';
	}
	else if (DOM)
	{
		document.getElementById(x).style.visibility='visible';
	}
}
  
function hide(x) {
	if (NS4)
	{
		document.layers[x].visibility='hide';
	}
	else if (IE4)
	{
		document.all[x].style.visibility='hidden';
	}
	else if (DOM)
	{
		document.getElementById(x).style.visibility='hidden';
	}
}

function shimg(xid, e) {
	var posy = 0;
	var posx = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posy = e.pageY;
		posx = e.pageX;
	}
	else if (e.clientX || e.clientY) 	{
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
	}
	// posx and posy contain the mouse position relative to the document
	document.getElementById(xid).style.top = posy - 2 + "px"; 
	document.getElementById(xid).style.left = posx + 5 + "px";
	document.getElementById(xid).style.display = 'inline';
}

function insertMCE(txinstance,html) {
    tinyMCE.execInstanceCommand(txinstance,"mceInsertContent",false,html); 
}

function flotex(szoveg, e) {
	var posy = 0;
	var posx = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posy = e.pageY;
		posx = e.pageX;
	}
	else if (e.clientX || e.clientY) 	{
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
	}
	// posx and posy contain the mouse position relative to the document
	document.getElementById('flotex').style.top = posy + 10 + "px"; 
	document.getElementById('flotex').style.left = posx - 10 + "px";
	document.getElementById('ft_cont').innerHTML = szoveg;
	document.getElementById('flotex').style.display = "block"; 
}

function floimg(url, e) {
	var posy = 0;
	var posx = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posy = e.pageY;
		posx = e.pageX;
	}
	else if (e.clientX || e.clientY) 	{
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
	}
	szoveg = "<img src='" + url + "' width='140' alt=''>";
	// posx and posy contain the mouse position relative to the document
	document.getElementById('flotex').style.top = posy + 10 + "px"; 
	document.getElementById('flotex').style.left = posx - 10 + "px";
	document.getElementById('ft_cont').innerHTML = szoveg;
	document.getElementById('flotex').style.display = "block"; 
}

function lgkapcs(act, num)
{
	for (a=0; a<num; a++)
	{
		button = "bt" + a;
		field = "lg" + a;
		document.getElementById(button).className = "lg_inaktiv";
		document.getElementById(field).style.display = "none";
	}
	button = "bt" + act;
	field = "lg" + act;
	document.getElementById(button).className = "lg_aktiv";
	document.getElementById(field).style.display = "block";
}
function cgkapcs(act, num)
{
	for (a=0; a<num; a++)
	{
		button = "bt0" + a;
		field = "lg0" + a;
		document.getElementById(button).className = "lg_inaktiv";
		document.getElementById(field).style.display = "none";
	}
	button = "bt0" + act;
	field = "lg0" + act;
	document.getElementById(button).className = "lg_aktiv";
	document.getElementById(field).style.display = "block";
}
function radiochange(azon,all) {
	cid = "ls";
	did = "mn";
	num = azon.slice(2);
	for (n=0; n<all; n++)
	{
		tid = did + n;
		document.getElementById(tid).className = 'mlist_item0';
	}
	vid = cid + num;
	tid = did + num;
	document.getElementById(vid).checked = 1;
	document.getElementById(tid).className = 'mlist_item1';
	document.getElementById('selitem').value = num;
}
function movemenu(moveto,all) {
	actid = Number(document.getElementById('selitem').value);
	if (document.getElementById('selitem').value == "")
	{
		mehet = false;
	} else {
		mehet = true;
	}
	if (moveto == "fel")
	{
		if (actid+1 < all)
		{
			nextid = actid+1;
		} else {
			mehet = false;
		}
	} else {
		if (actid > 0)
		{
			nextid = actid-1;
		} else {
			mehet = false;
		}
	}
	if (mehet)
	{
		mnid_a = "ls" + actid;
		mntx_a = "mn" + actid;
		mnid_t = "ls" + nextid;
		mntx_t = "mn" + nextid;
		atid = document.getElementById(mnid_t).value;
		attx = document.getElementById(mntx_t).innerHTML;
	
		document.getElementById(mnid_t).value = document.getElementById(mnid_a).value;
		document.getElementById(mntx_t).innerHTML = document.getElementById(mntx_a).innerHTML;
		document.getElementById(mnid_a).value = atid;
		document.getElementById(mntx_a).innerHTML = attx;
		
		radiochange(mntx_t,all);
	}
}
function ch_back (pic, to, nm) {
	document.getElementById('back').value = pic;
	for (n=0; n<nm; n++) {
		old = "p" + n;
		document.getElementById(old).className = "back0";
	}
	document.getElementById(to).className = "back1";
}
