{
	img1on = new Image();	img1on.src = "menu/menu01_on.png";
	img1off = new Image();	img1off.src = "menu/menu01_off.png";

	img2on = new Image();	img2on.src = "menu/menu02_on.png";
	img2off = new Image();	img2off.src = "menu/menu02_off.png";

	img3on = new Image();	img3on.src = "menu/menu03_on.png";
	img3off = new Image();	img3off.src = "menu/menu03_off.png";

	img4on = new Image();	img4on.src = "menu/menu04_on.png";
	img4off = new Image();	img4off.src = "menu/menu04_off.png";

	img5on = new Image();	img5on.src = "menu/menu05_on.png";
	img5off = new Image();	img5off.src = "menu/menu05_off.png";

	img6on = new Image();	img6on.src = "menu/menu06_on.png";
	img6off = new Image();	img6off.src = "menu/menu06_off.png";

	img7on = new Image();	img7on.src = "shared/footer_on.png";
	img7off = new Image();	img7off.src = "shared/footer.png";
}

function imgOn(imgName)
{
	document[imgName].src = eval(imgName + "on.src");
	window.status = document[imgName].alt;
}

function imgOff(imgName)
{
	document[imgName].src = eval(imgName + "off.src");
	window.status = "";
}

function moveSingleVal(currentVal, finalVal, frameAmt)
{
  if(frameAmt == 0 || currentVal == finalVal)
    return finalVal;
  
  currentVal += frameAmt;
  if((frameAmt > 0 && currentVal >= finalVal) 
      || (frameAmt < 0 && currentVal <= finalVal))
  {
    return finalVal;
  }
  return currentVal;
}

function doFrame(eID, cLeft, nLeft, fLeft)
{
  var t;
  var el = document.getElementById(eID);
  if(el == null)
    return;

  cLeft = moveSingleVal(cLeft, nLeft, fLeft);

  el.style.left = Math.round(cLeft) + 'px';
  
  if(cLeft == nLeft)
  {
	clearTimeout(t);
	return;
  }
    
  t = setTimeout( 'doFrame("'+eID+'",'+cLeft+','+nLeft+','+fLeft+')', 40);
}

function animate(elementID, newLeft, time)
{
  var el = document.getElementById(elementID);
  if(el == null)
    return;
 
  var cLeft = parseInt(el.style.left);
  
  var totalFrames = 1;
  if(time > 0)
    totalFrames = time/40;

  var fLeft = newLeft - cLeft;
  if(fLeft != 0)
    fLeft /= totalFrames;
  
  doFrame(elementID, cLeft, newLeft, fLeft);
}

function getY(elementID) {
	return document.getElementById(elementID).offsetTop;
}function moveSingleVal(currentVal, finalVal, frameAmt)
{
  if(frameAmt == 0 || currentVal == finalVal)
    return finalVal;
  
  currentVal += frameAmt;
  if((frameAmt > 0 && currentVal >= finalVal) 
      || (frameAmt < 0 && currentVal <= finalVal))
  {
    return finalVal;
  }
  return currentVal;
}

function doFrame(eID, cLeft, nLeft, fLeft)
{
  var t;
  var el = document.getElementById(eID);
  if(el == null)
    return;

  cLeft = moveSingleVal(cLeft, nLeft, fLeft);

  el.style.left = Math.round(cLeft) + 'px';
  
  if(cLeft == nLeft)
  {
	clearTimeout(t);
	return;
  }
    
  t = setTimeout( 'doFrame("'+eID+'",'+cLeft+','+nLeft+','+fLeft+')', 40);
}

function animate(elementID, newLeft, time)
{
  var el = document.getElementById(elementID);
  if(el == null)
    return;
 
  var cLeft = parseInt(el.style.left);
  
  var totalFrames = 1;
  if(time > 0)
    totalFrames = time/40;

  var fLeft = newLeft - cLeft;
  if(fLeft != 0)
    fLeft /= totalFrames;
  
  doFrame(elementID, cLeft, newLeft, fLeft);
}

function getY(elementID) {
	return document.getElementById(elementID).offsetTop;
}

function submit_keyreq(lang) {
  if(document.keyreq.email.value == "") { 
    if (lang == 'magyar') {
      alert("Kérjük, adja meg e-mail címét!"); 
    } else {
      alert("Please enter your e-mail address!"); 
    }
    document.keyreq.email.focus(); 
  } else { 
    document.keyreq.submit(); 
  }
}

var TimeToFade = 300.0;

function fade(eid)
{
  var element = document.getElementById(eid);
  if(element == null)
    return;
    
   
  if(element.FadeState == null)
  {
    if(element.style.opacity == null || element.style.opacity == '' 
       || element.style.opacity == '1')
      element.FadeState = -2;
    else
      element.FadeState = 2;
  }
    
  if(element.FadeState == 1 || element.FadeState == -1)
  {
    element.FadeState = element.FadeState == 1 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
  }
  else
  {
    element.FadeState = element.FadeState == 2 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade;
    setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
  }  
}

function animateFade(lastTick, eid)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
  
  var element = document.getElementById(eid);
 
  if(element.FadeTimeLeft <= elapsedTicks)
  {
    element.style.opacity = element.FadeState == 1 ? '1' : '0';
    element.style.filter = 'alpha(opacity = ' + (element.FadeState == 1 ? '100' : '0') + ')';
    element.FadeState = element.FadeState == 1 ? 2 : -2;
    return;
  }
 
  element.FadeTimeLeft -= elapsedTicks;
  var newOpVal = element.FadeTimeLeft/TimeToFade;
  if(element.FadeState == 1)
    newOpVal = 1 - newOpVal;

  element.style.opacity = newOpVal;
  element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
  
  setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);
}
