// JavaScript Document

var moz = (document.getElementById && !document.all) ? 1 : 0;
var IE4 = document.all?true:false;
DOM = (document.getElementById) ? 1 : 0;
if (!IE4) {
document.captureEvents(Event.MOUSEMOVE)
}
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else {  // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}  
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}  
return true;
}

function show_almenu(x)  {
   if (IE4) {getMouseXY(this)}
   if (IE4)
   {
    document.all[x].style.left=tempX-215;
    document.all[x].style.visibility='visible';
    }
   else if (DOM)
   {
    document.getElementById(x).style.visibility='visible';
    document.getElementById(x).style.left=tempX-215;
   }
  }
  
 function hide_almenu(x) {
   if (IE4)
   {
    document.all[x].style.visibility='hidden';
    }
   else if (DOM)
   {
    document.getElementById(x).style.visibility='hidden';
   }
 }

 function show(x)  {
   if (IE4)
   {
    document.all[x].style.visibility='visible';
    }
   else if (DOM)
   {
    document.getElementById(x).style.visibility='visible';
   }
  }
  
 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('orakijelzo').innerHTML=heure;
  setTimeout("go()",1000)
}

// 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 hov(x,i) {
   if (IE4)
   {
    document.all[x].style.color=i;
    }
   else if (DOM)
   {
	document.getElementById(x).style.color=i;
   }
}
 function mutat(z)  {
	x="dv"+z;
	t="bt"+z;
	i="im"+z;
	if (IE4)
	{
		document.all[x].style.display='inline';
		document.all[x].src="img/bt_up0.jpg";
	}
	else if (DOM)
	{
		document.getElementById(x).style.display='inline';
		document.getElementById(i).src="img/bt_up0.jpg";
	}
	document.getElementById(t).href="javascript: elrejt('"+z+"');";
  }
  
 function elrejt(z) {
	x="dv"+z;
	t="bt"+z;
	i="im"+z;
	if (IE4)
	{
		document.all[x].style.display='none';
		document.all[x].src="img/bt_down0.jpg";
	}
	else if (DOM)
	{
		document.getElementById(x).style.display='none';
		document.getElementById(i).src="img/bt_down0.jpg";
	}
	document.getElementById(t).href="javascript: mutat('"+z+"');";
 }

function kepcsere(x,kep)  {
	if (IE4) {
		document.all[x].src=kep;
	} else if (DOM) {
		document.getElementById(x).src=kep;
	}
}
addEvent = function(o, e, f, s){
    var r = o[r = "_" + (e = "on" + e)] = o[r] || (o[e] ? [[o[e], o]] : []), a, c, d;
    r[r.length] = [f, s || o], o[e] = function(e){
        try{
            (e = e || event).preventDefault || (e.preventDefault = function(){e.returnValue = false;});
            e.stopPropagation || (e.stopPropagation = function(){e.cancelBubble = true;});
            e.target || (e.target = e.srcElement || null);
            e.key = (e.which + 1 || e.keyCode + 1) - 1 || 0;
        }catch(f){}
        for(d = 1, f = r.length; f; r[--f] && (a = r[f][0], o = r[f][1], a.call ? c = a.call(o, e) : (o._ = a, c = o._(e), o._ = null), d &= c !== false));
        return e = null, !!d;
    }
};

removeEvent = function(o, e, f, s){
    for(var i = (e = o["_on" + e] || []).length; i;)
        if(e[--i] && e[i][0] == f && (s || o) == e[i][1])
            return delete e[i];
    return false;
};
MaskInput = function(f, m){
    function mask(e){
        var patterns = {"1": /[A-Z]/i, "2": /[0-9]/, "4": /[\xC0-\xFF]/i, "8": /./ },
            rules = { "a": 3, "A": 7, "9": 2, "C":5, "c": 1, "*": 8};
        function accept(c, rule){
            for(var i = 1, r = rules[rule] || 0; i <= r; i<<=1)
                if(r & i && patterns[i].test(c))
                    break;
                return i <= r || c == rule;
        }
        var k, mC, r, c = String.fromCharCode(k = e.key), l = f.value.length;
        (!k || k == 8 ? 1 : (r = /^(.)\^(.*)$/.exec(m)) && (r[0] = r[2].indexOf(c) + 1) + 1 ?
            r[1] == "O" ? r[0] : r[1] == "E" ? !r[0] : accept(c, r[1]) || r[0]
            : (l = (f.value += m.substr(l, (r = /[A|9|C|\*]/i.exec(m.substr(l))) ?
            r.index : l)).length) < m.length && accept(c, m.charAt(l))) || e.preventDefault();
    }
    for(var i in !/^(.)\^(.*)$/.test(m) && (f.maxLength = m.length), {keypress: 0, keyup: 1})
        addEvent(f, i, mask);
};
