var loginwindow=0;

function GetWindowWidth(){

   if(window.innerWidth){
      if((document.body.offsetWidth)&&(window.innerWidth!=document.body.offsetWidth))
         return document.body.offsetWidth;
      return(window.innerWidth); // Mozilla
    }

    if(document.documentElement.clientWidth)
       return document.documentElement.clientWidth; // IE6

    if(document.body.clientWidth)
       return document.body.clientWidth; // IE DHTML-compliant any other
}

var wwidth=GetWindowWidth();
document.getElementById("container").style.left=parseInt((wwidth-750)/2);

function Show(menuid){
   document.getElementById(menuid).style.visibility="visible";
}

function Hide(menuid){
   document.getElementById(menuid).style.visibility="hidden";
}

function SwapImage(objname,imgname){
   document.images[objname].src=imgname;
}

function MakeMenu(menuid,data,left,top,w,bkg) { 
var img=new Image(); 
   document.write("<DIV ID='"+menuid+"' STYLE='z-index:10;position:absolute;left:"+left+";top:"+top+";visibility:hidden;' onmouseover=\"Show('"+menuid+"');\" onmouseout=\"Hide('"+menuid+"');\">");
   document.write("<TABLE WIDTH='"+w+"' CELLPADDING=0 CELLSPACING=0 BORDER=0 BACKGROUND='pic/menu/"+bkg+"'>");
   document.write("<TR HEIGHT=10><TD></TD></TR>");
   for (i=0;i<data.length;i++) {
      document.write("<TR HEIGHT=30><TD ALIGN=CENTER VALIGN=MIDDLE><A HREF='"+data[i][1]+"' BORDER=0 onmouseover=\"SwapImage('"+menuid+String(i)+"','pic/menu/"+data[i][0]+"');\" onmouseout=\"SwapImage('"+menuid+String(i)+"','pic/blank.gif');\"><IMG SRC='pic/blank.gif' NAME='"+menuid+String(i)+"' BORDER=0 WIDTH=154 HEIGHT=30></A></TD></TR>");
      img.src="pic/menu/"+data[i][0];
   }
   document.write("<TR HEIGHT=4><TD></TD></TR>");
   document.write("</TABLE></DIV>");
}

function MakeTopMenu(menuid,menuid2,pic,left,top,w){
var img=new Image(); 

   document.write("<DIV ID='"+menuid+"' STYLE='position:absolute;left:"+left+";top:"+top+";'>");
   document.write("<A onmouseover=\"SwapImage('i"+menuid+"','pic/menu/"+pic+"');Show('"+menuid2+"');\" onmouseout=\"SwapImage('i"+menuid+"','pic/blank.gif');Hide('"+menuid2+"');\">");
   document.write("<IMG SRC='pic/blank.gif' name=i"+menuid+" BORDER=0 WIDTH="+w+" HEIGHT=36>");
   document.write("</A></DIV>");
   img.src="pic/menu/"+pic;
}

function MakeHighlightLink(id,pic,left,top,width,height,link){
var img=new Image(); 

   document.write("<DIV ID='"+id+"' STYLE='position:absolute;left:"+left+";top:"+top+";border:'>");
   document.write("<A HREF='"+link+"' onmouseover=\"SwapImage('i"+id+"','"+pic+"');\" onmouseout=\"SwapImage('i"+id+"','pic/blank.gif');\">");
   document.write("<IMG SRC='pic/blank.gif' name=i"+id+" BORDER=0 WIDTH="+width+" HEIGHT="+height+">");
   document.write("</A></DIV>");
   img.src=pic;
}

function gomb(link,szoveg){
   document.write("<TABLE CELLPADDING=0 CELLSPACING=0>");
   document.write("<TR><TD WIDTH=10 HEIGHT=25><IMG SRC='pic/main/gomb_bal.jpg'></TD>");
   document.write("<TD BACKGROUND='pic/main/gomb_kozep.jpg'><A HREF='"+link+"'>"+szoveg+"</A></TD>");
   document.write("<TD WIDTH=10 HEIGHT=25><IMG SRC='pic/main/gomb_jobb.jpg'></TD></TR>");
   document.write("</TABLE>");
}

function DrawMenu() {

   var mm1=new Array();
   mm1[0]=new Array("almenu1_HKK_on.png","?k=1");
   mm1[1]=new Array("almenu1_AF_on.png","?k=11");
   mm1[2]=new Array("almenu1_TH_on.png","?k=5");
   mm1[3]=new Array("almenu1_WW_on.png","?k=9");
   mm1[4]=new Array("almenu1_poker_on.png","?k=10");
   MakeMenu("almenu1",mm1,68,150,175,"almenu1.png?3");

   var mm2=new Array();
   mm2[0]=new Array("almenu2_MK_on.png","?k=2");
   mm2[1]=new Array("almenu2_DD_on.png","?k=6");
   mm2[2]=new Array("almenu2_WH_on.png","?k=12");
   MakeMenu("almenu2",mm2,215,150,175,"almenu2.png");

   var mm3=new Array();
   mm3[0]=new Array("almenu3_hirek_on.png","?k=7");
   mm3[1]=new Array("almenu3_cikkek_on.png","?a=tipp&k=7");
   mm3[2]=new Array("almenu3_forum_on.png","?a=forum&k=7");
   mm3[3]=new Array("almenu3_JI_on.png","?c=228&k=7");
   mm3[4]=new Array("almenu3_arlista_on.png","?a=arlista&k=7");
   MakeMenu("almenu3",mm3,350,150,175,"almenu3.png");

   var mm4=new Array();
   mm4[0]=new Array("almenu4_hirek_on.png","?k=4");
   mm4[1]=new Array("almenu4_forum_on.png","?a=forum&k=4");
   mm4[2]=new Array("almenu4_JI_on.png","?c=22&k=4");
   mm4[3]=new Array("almenu4_SZJ_on.png","?c=21&k=4");
   mm4[4]=new Array("almenu4_arlista_on.png","?a=arlista&k=4");
   MakeMenu("almenu4",mm4,485,150,175,"almenu4.png");

   var mm5=new Array();
   mm5[0]=new Array("almenu5_hirek_on.png","?k=8");
   mm5[1]=new Array("almenu5_cikkek_on.png","?a=tipp&k=8");
   mm5[2]=new Array("almenu5_forum_on.png","?a=forum&k=8");
   mm5[3]=new Array("almenu5_konyv_on.png","?c=229&k=8");
   mm5[4]=new Array("almenu5_arlista_on.png","?a=arlista&k=8");
   MakeMenu("almenu5",mm5,575,150,175,"almenu5.png");

   MakeHighlightLink("hirek","pic/menu/felsomenu_hirek_on.png",0,120,86,36,"?a=hirek");
   MakeTopMenu("m1","almenu1","felsomenu_KJ_on.png",86,120,139);
   MakeTopMenu("m2","almenu2","felsomenu_FJ_on.png",225,120,147);
   MakeTopMenu("m3","almenu3","felsomenu_TJ_on.png",372,120,135);
   MakeTopMenu("m4","almenu4","felsomenu_SZJ_on.png",507,120,140);
   MakeTopMenu("m5","almenu5","felsomenu_konyvek_on.png",647,120,103);
}

function alalmenu(k,c){
   document.write(
     "<IMG SRC='pic/blank.gif' HEIGHT='20'><CENTER><DIV STYLE='BACKGROUND:url(\"pic/menu/felsomenu2.png\");WIDTH:417px;HEIGHT:72px;' ALT='Menü'>"+
     "</DIV></CENTER><BR>");

   MakeHighlightLink("felsomenu2_1","pic/menu/felsomenu2_hirek_on.png",270,176,181,36,"?k="+String(k));
   MakeHighlightLink("felsomenu2_2","pic/menu/felsomenu2_cikkek_on.png",451,176,155,36,"?a=tipp&k="+String(k));
   MakeHighlightLink("felsomenu2_3","pic/menu/felsomenu2_forum_on.png",606,176,81,36,"?a=forum&k="+String(k));
   MakeHighlightLink("felsomenu2_4","pic/menu/felsomenu2_verseny_on.png",270,212,153,36,"?a=verseny&k="+String(k));
   MakeHighlightLink("felsomenu2_5","pic/menu/felsomenu2_JI_on.png",423,212,144,36,"?c="+String(c)+"&k="+String(k));
   MakeHighlightLink("felsomenu2_6","pic/menu/felsomenu2_arlista_on.png",567,212,120,36,"?a=arlista&k="+String(k));
}

function openSubwin(wname,src,width,height) 
 {
     wpars='status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1,resizable=0,dependent=1,width='+width+',height='+height;
	newwindow=window.open(src,wname,wpars);
	if (window.focus) {newwindow.focus()}
 } 
