var xmlhttp, m, am, bm, xm;

var bjv = 0; // banner_jobb show

function GetXmlHttpObject() {
  if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
    return new XMLHttpRequest();
  }
  if (window.ActiveXObject) { // code for IE6, IE5
    return new ActiveXObject("Microsoft.XMLHTTP");
  }
  return null;
}

function mo(obj) {
  obj.style.backgroundColor=MO_BG;
}

function mv(obj, ezt) {
  if ( ezt != m ) {
    obj.style.backgroundColor=MV_BG;
  }
}

function mch(obj,ezt,azon) {
  if ( m == ezt ) { return; }
  if ( document.getElementById(azon+m) != null ) {
    if ( document.getElementById("nyil"+m) != null ) {
      document.getElementById("nyil"+m).src=IM_NY;
    }
    document.getElementById(azon+m).style.backgroundColor=MV_BG;
  }
  m=ezt;
  if ( document.getElementById("nyil"+ezt) != null ) {
    document.getElementById("nyil"+ezt).src=IM_NY2;
  }
}

function amv(obj, ezt) {
  if ( ezt != am ) { obj.style.backgroundColor=MV_BG2; }
}

function amch(obj,ezt,azon) {
  if ( am == ezt ) { return; }
  if ( document.getElementById(azon+am) != null ) {
    document.getElementById(azon+am).style.backgroundColor=MV_BG2;
    document.getElementById(azon+"s"+am).style.fontWeight='normal';
  }
  am=ezt;
}

function xoldal(obj,ezt,azt,nyelv) {
  z=0;

  if ( document.getElementById("nyil"+m) != null ) {
    document.getElementById("nyil"+m).src=IM_NY;
  }

  if ( azt != 0 ) {
    if ( m != azt ) {
      if ( document.getElementById("mp"+m) != null ) {
        document.getElementById("mp"+m).style.backgroundColor=MV_BG;
      }
    }
    m=azt;
    if ( document.getElementById("mp"+m) != null ) {
      document.getElementById("mp"+m).style.backgroundColor=MO_BG;
    }
    z=1;
  }
  oldal(obj,ezt,z,z,nyelv);
}

function betolt(url,alm,bal,ban) {

  xm=0;

  if ( document.getElementById("nyil"+m) != null ) {
    document.getElementById("nyil"+m).src=IM_NY;
  }

  if ( document.getElementById("mp"+m) != null ) {
    document.getElementById("mp"+m).style.backgroundColor=MV_BG;
  }

  m = 0;
  am = 0;

  if ( alm == 0 ) {
    document.getElementById("almenu").innerHTML='';
  }

  if ( bal == 0 ) {
    document.getElementById("menu_bal").innerHTML='';
  }


  if ( ban == 0 ) {
    document.getElementById("banner_jobb").style.display='none';
  } else {
    document.getElementById("banner_jobb").style.display='block';
  }

  xmlhttp3=GetXmlHttpObject();
  xmlhttp3.onreadystatechange=stateChangedC;
  xmlhttp3.open("GET",url,true);
  xmlhttp3.send(null);

}

function menu_fej(nyelv,lang) {
  xmlhttp4=GetXmlHttpObject();
  xmlhttp4.onreadystatechange=stateChangedD;
  xmlhttp4.open("GET","menuk.php?lg="+nyelv+"&lh="+lang+"&fn=menu_fej",true);
  xmlhttp4.send(null);
}

function menu_fent(nyelv,lang) {
  xmlhttp5=GetXmlHttpObject();
  xmlhttp5.onreadystatechange=stateChangedE;
  xmlhttp5.open("GET","menuk.php?lg="+nyelv+"&lh="+lang+"&fn=menu_fent"+wlink(1),true);
  xmlhttp5.send(null);
}

function lent(nyelv,lang) {
  xmlhttp6=GetXmlHttpObject();
  xmlhttp6.onreadystatechange=stateChangedF;
  xmlhttp6.open("GET","menuk.php?lg="+nyelv+"&lh="+lang+"&fn=lent"+wlink(2),true);
  xmlhttp6.send(null);
}


function stateChangedD() {
  if (xmlhttp4.readyState==4) {
    document.getElementById("menu_fej").innerHTML=xmlhttp4.responseText;
  }
}

function stateChangedE() {
  if (xmlhttp5.readyState==4) {
    document.getElementById("menu_fent").innerHTML=xmlhttp5.responseText;
  }
}

function stateChangedF() {
  if (xmlhttp6.readyState==4) {
    document.getElementById("lent").innerHTML=xmlhttp6.responseText;
  }
}

function stateChanged() {
  if (xmlhttp.readyState==4) {
    document.getElementById("tartalom").innerHTML=xmlhttp.responseText;
    if ( document.getElementById("mp"+xm) != null )
      document.getElementById("mp"+xm).style.backgroundColor=MO_BG;
    document.getElementById('tartalom').style.visibility='visible';
    if ( bjv == 1 ) {
      document.getElementById("banner_jobb").style.display='block';
    }
  }
}

function stateChangedA() {
  if (xmlhttp2.readyState==4) {
    document.getElementById("almenu").innerHTML=xmlhttp2.responseText;
    document.getElementById("almenu").style.visibility='visible';
    document.getElementById("amp"+xm).style.backgroundColor=MO_BG;
  }
}

function stateChangedB() {
  if (xmlhttp2.readyState==4) {
    document.getElementById("menu_bal").style.display='block';
    document.getElementById("menu_bal").style.visibility='visible';
    document.getElementById("menu_bal").innerHTML=xmlhttp2.responseText;
    document.getElementById("amp"+xm).style.backgroundColor=MO_BG;
  }
}

function stateChangedC() {
  if (xmlhttp3.readyState==4) {
    document.getElementById("tartalom").innerHTML=xmlhttp3.responseText;
    document.getElementById("tartalom").style.visibility='visible';
  }
}

function play() {

 lejatszo = document.createElement('span');

 lejatszo.innerHTML =
  '<object '+
  'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '+
  'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab '+
  '#version=6,0,0,0" '+
  'width="0" height="0" id="player" align="middle">'+
  '<param name="wmode" value="transparent" />'+
  '<param name="allowScriptAccess" value="sameDomain" />'+
  '<param name="flashVars" value="theLink=m.mp3" />'+
  '<param name="movie" value="playmp3.swf" />'+
  '<param name="quality" value="high" />'+
  '<embed '+
  'src="playmp3.swf" flashVars="theLink=m.mp3"'+
  'quality="high" wmode="transparent" width="0" height="0" name="player"'+
  'align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" '+
  'pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

 var he=document.getElementById('zene');

 he.innerHTML='<a onclick="stop();"><img src="images/off.gif" border="0"></a>';

}

function stop() {

 lejatszo.removeChild(lejatszo.firstChild);
// lejatszo.parentNode.removeChild(lejatszo);
 lejatszo = null;

 var he=document.getElementById('zene');
 he.innerHTML='<a onclick="play();"><img src="images/on.gif" border="0"></a>';

}
