/*
	System menu pro SCORE online (http://www.score.cz)

	(c) 2000 Nostromo (http://www.nostromo.cz), programoval Svatopluk Švec
	
	verze 2.0 (12.7.2000) : layery jsou pouze rolety, 3x menší layer kód, 4x rychlejší init, 5x rychlejší load
	
	Skript vychází z navbar.js, Copyright 1999 by Mike Hall, Web address: http://www.brainjar.com                                        *
	Skript používá Dynamic Drive DHTML code library (http://dynamicdrive.com)
*/
var mainmenubar;
var lmenu = Array();
var actmenu = 0;

// These variables are used to determine if a resize event is a true one.
// Necessary due to a bug in older NS4 releases.
var origWidth;
var origHeight;

// pozice hlaniho menu + sirka
var mainmenubarX = 154, mainmenubarY = 83 + 5;
var mainmenubarWidth = 500;
var mainmenubarHeight = 26;

var mainmenubarTrackX = false,mainmenubarTrackY = false;

// -------- INIT START ----------

menu = new Array();

// tato cast je generovana pomoci cust_accel.php3


// recenze 
menu[0] = new Array( 
	"0","0", 
	"140","140",
	"RECENZE","index.php?w=10",
	 "Serious Sam: The Second Encounter","index.php?w=2&kod=3020",
"Planescape: Torment","index.php?w=2&kod=3441",
"Madden  2002","index.php?w=2&kod=1414",
"NHL 2002","index.php?w=2&kod=1410",
"Operation Flashpoint","index.php?w=2&kod=5",
"Hlavní strana","index.php?w=10");

// obsahy 
menu[1] = new Array( 
	"92","0", 
	"120","120",
"OBSAHY","index.php?w=11",
 "Obsah čísla 185","index.php?w=4&kod=171",
"Obsah čísla 184","index.php?w=4&kod=170",
"Obsah čísla 183","index.php?w=4&kod=169",
"Obsah čísla 180","index.php?w=4&kod=168",
"Obsah čísla 179","index.php?w=4&kod=167",
"Hlavní strana","index.php?w=11");

// prvni pomoc 
menu[2] = new Array(
	"200","0",
	"80","120",
	"SCORE","",
	"Cheaty","index.php?w=15",
	"Patche","index.php?w=23",
	"Trainery","index.php?w=22",
	"Návody","index.php?w=16",
	"Češtiny","index.php?w=24",
	"Zákysník","phorum.php?w=2&kr=14"); 

// audity 
menu[3] = new Array( 
	"306","0", 
	"140","140", 
	"SCORE","",
	"Registrace", "phorum.php?w=4",
	"Hlavni strana","phorum.php",
	"Uživatelé", "phorum.php?w=5",
	"Ikony", "index.php?w=2&kod=2633",
	"Nápověda", "index.php?w=2&kod=2904",
	"Logout", "phorum.php?w=10");
 
// extra
menu[4] = new Array(
	"390","0",
	"100","100",
	"SCORE","",
	"Shareware","index.php?w=20",
	"Dema","index.php?w=21",
	"Od čtenářů","index.php?w=30",
	"Laboratoř","index.php?w=17",
	"Galerie","index.php?w=43",
	"Splashes","index.php?w=2&kod=2628",
	"Linky","index.php?w=42",
  "Kupte si hru","http://www.score.cz/",
	"Kniha přání","phorum.php?w=2&kr=12");
 
// kontakty 
menu[5] = new Array( 
	"480","0", 
	"120","120",
	"SCORE","", 
	"Předplatné SCORE", "http://www.send.cz/index.php?action=newspaper_details&lang=cs&paper_id=290", 
	"Redakce", "index.php?w=50", 
	"Externisté", "index.php?w=51", 
	"Inzerce", "http://www.omegagroup.cz/inzerce.html",
	"Centauri Production", "http://www.centauriproduction.cz",
	"Audio", "http://www.audiomag.cz",
	"T3 Online", "http://www.t3online.cz",
	"Omega Publishing", "http://www.omegagroup.cz",
	"VideoDomácíKino", "http://www.videomag.cz");


mainmenubarWidth = 600;

// ------------ INIT END ------------------	
	
function SCOREMenuInit() {

	BuildMenus();
	InitMenus();
}

function BuildMenus() {
	
var i,j,k,jend;
var menuposx,menuposy,menuwidth,menuheight;
var hdrimgnorm,hdrimgover;
var menuitemwidth,menuitemheight;
var mainlayercode;
var layercodename;
var menustart,menuend;

	mainlayercode = '';
	menuitemheight = 20; // vyska jednotlivych polozek (nadpisu) clenu menu

	j=0;
		// speedup : nyni se vytvari pouze layer jednotlivych rolet, ty jsou realizovany jako tabulka s hrefy

	for( i = 0; i < menu.length; i++ ){
		
		menuposx = menu[i][0];
		menuposy = menu[i][1];	
		menuwidth = menu[i][2];
		menuheight = menu[i][3];
		hdrimgnorm = menu[i][4];
		hdrimgover = menu[i][5];
		jend = ( menu[i].length - 4 ) / 2;

			// nyni vytvorit layer pro cele jedno menu - menu[i]
			// menu layer, obsahujici v sobe jednotlive cleny menu vcetne headeru
		if (isMinNS4)
			mainlayercode += '<layer name="menu'+(i + 1)+'" width='+menuwidth+' visibility=hidden>\n';
		if (isMinIE4 || isMinIE5)
			mainlayercode += '<div id="menu'+(i + 1)+'" style="position:absolute; width:'+menuwidth+'px; visibility:hidden;">\n';
			
			

			// pro kazdy clen aktualni rolety = pro kazdy clen 'jmeno, hlink', skok tedy o 2
		for (k = 4; k < menu[i].length; k += 2) {
				// pole obsahuje na sudych pozicich jmena zdroju, na lichych hlinky zdroju
			j = (k - 4 ) / 2;
			jmeno = menu[i][k];
			link = menu[i][k + 1];
			
				// prvni sublayer layeru daneho menu bude header, ktery obsahuje mouseover obrazek s nazvem menu a aktivni list
			if (j == 0)
				mainlayercode += '<a href="'+link+'"><table width="'+menuwidth+'" border="0" cellspacing="0" cellpadding="0" align="center">\n<tr><td colspan="3"><img src="priv-icons/mnu-hdr.gif" width="70" height="26" border="0" alt="'+jmeno+'"></td></tr></a>\n';
     			else { // dalsi sublayery = jednotlivi clenove menu - rolety

				if( j == 1 ){	// start ?
					mainlayercode += '<tr>'+
    '<td width="5"><img src="priv-icons/mnu-11.gif" width="5" height="7"></td>'+
    '<td background="priv-icons/mnu-12.gif" width="'+(menuwidth - 10)+'"><img src="priv-icons/mnu-12.gif" width="40" height="7"></td>'+
    '<td width="5"><img src="priv-icons/mnu-13.gif" width="5" height="7"></td></tr>\n';
				}

				mainlayercode += '<tr><td bgcolor="#B4C6C0" background="priv-icons/mnu-21.gif" width="5"><img src="priv-icons/mnu-21.gif" width="5" height="16"></td>'+
    '<td bgcolor="#B4C6C0" width="'+(menuwidth-10)+'"><a href="'+link+'"><font size="1"><b>'+jmeno+'</b></font></a></td>'+
    '<td bgcolor="#B4C6C0" width="5" background="priv-icons/mnu-23.gif"><img src="priv-icons/mnu-23.gif" width="5" height="16"></td></tr>\n';

// mainlayercode += '  <layer name="dmmy'+layercodename+'" width='+menuwidth+'>' + '</layer>\n';
	
			} // ifelse
    		} // for polozky jednoho menu

			// posledni radka tabulky = okrouhle dole
		mainlayercode += '<tr> '+
    '<td width="5"><img src="priv-icons/mnu-31.gif" width="5" height="7"></td>'+
    '<td background="priv-icons/mnu-32.gif" width="'+(menuwidth - 10)+'"><img src="priv-icons/mnu-32.gif" width="40" height="7"></td>'+
    '<td width="5"><img src="priv-icons/mnu-33.gif" width="5" height="7"></td></tr>\n';
    		
			// ukonceni jednoho layeru 'menu' , obsahujiciho cele jedno submenu s headerem
    		if (isMinNS4)
				mainlayercode += '</table>\n</layer>\n';
    		if (isMinIE4)
				mainlayercode += '</table>\n</div>\n';

	} // for jednotliva menu
	

		// Vytvorit vsechna tato menu pomoci javascriptu jako novy layer 'navbar', ktery v sobe obsahuje layeru rolet
	if (isMinNS4) {
		mainmenubar = new Layer(mainmenubarWidth);
		mainmenubar.document.writeln(mainlayercode);
		mainmenubar.document.close();
		clipLayer(mainmenubar, 0, 0, mainmenubarWidth, getWindowHeight());
	}

	if (isMinIE4 || isMinIE5) {
		mainlayercode = '<div id="mainmenubar" style="position:absolute;' + ' width:'+mainmenubarWidth+'px;' + ' height:'+ (getWindowHeight() - mainmenubarY) +'px;' + ' overflow:hidden;">' +mainlayercode+ '</div>\n';

		// Insert HTML code at end of page. For IE4, need to scroll window to
		// end of page, insert and scroll back to correct bug.

		if (!isMinIE5) {
			x = getPageScrollX();
			y = getPageScrollY();
			window.scrollTo(getPageWidth(), getPageHeight());
		}
//		document.writeln(mainlayercode);
                if(document.all){
                  document.body.insertAdjacentHTML("beforeEnd", mainlayercode);
                } else {
                  var range = document.createRange();
                  range.setStartAfter(document.body.lastChild);
                  var docFrag = range.createContextualFragment(mainlayercode);
                  document.body.appendChild(docFrag);
                }


		if (!isMinIE5)
			window.scrollTo(x, y);

		mainmenubar = getLayer("mainmenubar");
	
	} // if

} // konec funkce buildmenus

function InitMenus(){

var x,y,z,j,i;
var layer;
var width;

	if (!isMinNS4 && !isMinIE4)
		return;
	
	// Fix for resize bug.
	if (isMinNS4) {
		origWidth  = window.innerWidth;
		origHeight = window.innerHeight;
	}
	
	window.onresize = mainmenubarReload;

	moveLayerTo(mainmenubar, mainmenubarX, mainmenubarY);
	showLayer(mainmenubar);

	// Get each menu, position it, initialize it and set up event handling.

	x = 0;
	y = 0;
	i = 0;
	
	layer = getLayer("menu" + (i + 1))
	
	while ((layer = getLayer("menu" + (i + 1), window)) != null) {

			// Set menu width.
		x = menu[i][0];
		y = menu[i][1];
		width = menu[i][3];

			// Initialize the menu container.
		lmenu[i] = layer;
		moveLayerTo(layer, x, y);

			// Initialize the three layers that make up each menu item.
		z = 0;
		j = 0;
	
		// Set up clipping sizes for menu container.
		on = getHeight(layer);

		lmenu[i].offWidth  = width;
		lmenu[i].offHeight = mainmenubarHeight;
		lmenu[i].onWidth   = width;
		lmenu[i].onHeight  = on;
		lmenu[i].onmouseover = mainmenubarMenuOn;
		lmenu[i].onmouseout  = mainmenubarMenuOff;
		
		clipLayer(lmenu[i], 0, 0, lmenu[i].offWidth, lmenu[i].offHeight);

			// Display the menu container layer.
		showLayer(lmenu[i]);
		i++;

	} // while menu layer

		// Save bar height = height stazene pozice napr. posledniho menu
	mainmenubarHeight = lmenu[i-1].offHeight;

		// Clip base layer so it won't interfere with underlying page.
	clipLayer(mainmenubar, 0, 0, mainmenubarWidth, mainmenubarHeight);

		// Set tracking.
	if (mainmenubarTrackX || mainmenubarTrackY) {
		mainmenubarScroll();
		if (isMinNS4)
			setInterval('mainmenubarScroll()', 20);
		if (isMinIE4)
			window.onscroll = mainmenubarScroll;
	}

} // konec funkce initmenus




//*****************************************************************************
// Event handlers for the navigation bar.
//*****************************************************************************

function mainmenubarScroll() {

var x, y, d;
var max;

	//alert("scrolling mainmenubar");
	// Adjust navigation bar position based on current scroll amounts.

	x = mainmenubarX;
	d = getPageScrollX() - mainmenubarX;

	if (mainmenubarTrackX && d > 0)
		x += d;

	y = mainmenubarY;
	d = getPageScrollY() - mainmenubarY;
	
	if (mainmenubarTrackY && d > 0)
		y += d;

	// For IE, set limits to prevent infinite scrolling as bar is moved.
	if (isMinIE4) {
		max = Math.max(getPageWidth(), mainmenubarWidth) - (mainmenubarX + mainmenubarWidth);
		x = Math.max(mainmenubarX, Math.min(x, max));
		max = Math.max(getPageHeight(), getWindowHeight())  - getWindowHeight() - mainmenubarHeight + mainmenubarY;
		y = Math.max(mainmenubarY, Math.min(y, max));
	}

		// Reposition the navigation bar.
	moveLayerTo(mainmenubar, x, y);
}


function mainmenubarMenuOn() {

var i;
	
	for( i = 0; i < lmenu.length; i++ )
		clipLayer(lmenu[i],0,0,mainmenubarWidth,lmenu[i].offHeight);

		// Display the menu by clipping containter to full view.
	clipLayer(this, 0, 0, this.onWidth, this.onHeight);
		// rozclipnout vysku take main rodice na vysku menu
	clipLayer(mainmenubar, 0, 0, mainmenubarWidth, this.onHeight);
}


function mainmenubarMenuOff() {

		// zaclipnout menu i mainmenubar na vysku headeru
	clipLayer(this, 0, 0, this.offWidth, this.offHeight);
	clipLayer(mainmenubar, 0, 0, mainmenubarWidth, this.offHeight);
}

function mainmenubarReload() {

		// Reload page in case of a browser resize. First make sure it's a true resize.
	if (isMinNS4 && origWidth == window.innerWidth && origHeight == window.innerHeight)
		return;

return;
	window.location.href = window.location.href;
}
<!-- safestamp technology (c) 2000 Nostromo http://www.nostromo.cz -->

<!-- safestamp technology (c) 2000 Nostromo http://www.nostromo.cz -->

