/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "http://www.poustka.com/buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1up.png","button2up.png","button3up.png","button4up.png","button5up.png","button6up.png","button7up.png","button8up.png","button9up.png","button10up.png","button11up.png","button12up.png","button13up.png","button14up.png","button15up.png","button16up.png","button17up.png","button18up.png","button19up.png","button20up.png","button21up.png","button22up.png","button23up.png","button24up.png","button25up.png","button26up.png");

overSources = new Array("button1over.png","button2over.png","button3over.png","button4over.png","button5over.png","button6over.png","button7over.png","button8over.png","button9over.png","button10over.png","button11over.png","button12over.png","button13over.png","button14over.png","button15over.png","button16over.png","button17over.png","button18over.png","button19over.png","button20over.png","button21over.png","button22over.png","button23over.png","button24over.png","button25over.png","button26over.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo = new Array();
subInfo[1] = new Array();
subInfo[2] = new Array();
subInfo[3] = new Array();
subInfo[4] = new Array();
subInfo[5] = new Array();
subInfo[6] = new Array();
subInfo[7] = new Array();
subInfo[8] = new Array();
subInfo[9] = new Array();
subInfo[10] = new Array();
subInfo[11] = new Array();
subInfo[12] = new Array();
subInfo[13] = new Array();
subInfo[14] = new Array();
subInfo[15] = new Array();
subInfo[16] = new Array();
subInfo[17] = new Array();
subInfo[18] = new Array();
subInfo[19] = new Array();
subInfo[20] = new Array();
subInfo[21] = new Array();
subInfo[22] = new Array();
subInfo[23] = new Array();
subInfo[24] = new Array();
subInfo[25] = new Array();
subInfo[26] = new Array();

//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("STA - společná televize zdarma","http://www.poustka.com/sta/sta.html","");

subInfo[2][1] = new Array("SDTV přijímače","http://www.poustka.com/sat/sdtv.html","");
subInfo[2][2] = new Array("SDTV komplety","http://www.poustka.com/sat/sdtv-sada.html","");
subInfo[2][3] = new Array("HDTV přijímače","http://www.poustka.com/sat/hdtv.html","");
subInfo[2][4] = new Array("HDTV komplety","http://www.poustka.com/sat/hdtv-sada.html","");
subInfo[2][5] = new Array("karta Skylink ICE","http://www.poustka.com/skylink/skylink.html","");
subInfo[2][6] = new Array("aktivace programů Skylink","http://www.poustka.com/skylink/skylinkplatby.html","");
subInfo[2][7] = new Array("karta CSlink / Gital","http://www.poustka.com/cslink/cslink.html","");
subInfo[2][8] = new Array("parabolické antény","http://www.poustka.com/sat/paraboly.html","");
subInfo[2][9] = new Array("LNB konvertory","http://www.poustka.com/sat/lnb.html","");
subInfo[2][10] = new Array("universální učící ovládač","http://www.poustka.com/doplnky/doplnky.html","");
subInfo[2][11] = new Array("bezdrátový přenos AV + IR","http://www.poustka.com/doplnky/doplnky.html","");
subInfo[2][12] = new Array("příslušenství SAT","http://www.poustka.com/prislusenstvi/prislusenstvi.html","");
subInfo[2][13] = new Array("instalace satelitů","http://www.poustka.com/sat/sat-mont.html","");
subInfo[2][14] = new Array("moderní TV LCD - LED - oLED","http://www.moderni-televize.cz/","");
subInfo[2][15] = new Array("teorie - satelitní technika","http://www.poustka.com/sat/sat-info.html","");

subInfo[3][1] = new Array("set-top-boxy","http://www.poustka.com/anteny/set-top-box.html","");
subInfo[3][2] = new Array("DVB-T antény","http://www.poustka.com/anteny/dvbt-anteny.html","");
subInfo[3][3] = new Array("universální učící ovládač","http://www.poustka.com/doplnky/doplnky.html","");
subInfo[3][4] = new Array("bezdrátový přenos AV + IR","http://www.poustka.com/doplnky/doplnky.html","");
subInfo[3][5] = new Array("příslušenství DVB-T","http://www.poustka.com/prislusenstvi/prislusenstvi.html","");
subInfo[3][6] = new Array("mapa pokrytí DVB-T signálu","http://www.poustka.com/anteny/mapa-pokryti.html","");
subInfo[3][7] = new Array("moderní TV LCD - LED - oLED","http://www.moderni-televize.cz/","");
subInfo[3][8] = new Array("teorie - DVB-T příjem","http://www.poustka.com/anteny/dvbt-info.html","");

subInfo[4][1] = new Array("barevné kamery s IR","http://www.poustka.com/kamery/kamery-ir.html","");
subInfo[4][2] = new Array("PVR rekordéry / kvadrátory","http://www.poustka.com/kamery/pvr.html","");
subInfo[4][3] = new Array("IR reflektory","http://www.poustka.com/kamery/ir-reflektory.html","");
subInfo[4][4] = new Array("příslušenství kamery","http://www.poustka.com/prislusenstvi/prislusenstvi.html","");
subInfo[4][5] = new Array("teorie - kamery / záznam","http://www.poustka.com/kamery/kamery-info.html","");

subInfo[5][1] = new Array("zabezpečovací systémy","http://www.poustka.com/ezs/alarmy.html","");
subInfo[5][2] = new Array("barevné značení rezistorů","http://www.poustka.com/rezistor/rezistor.html","");
subInfo[5][3] = new Array("teorie - zabezpečování","http://www.poustka.com/ezs/ezs-info.html","");

subInfo[6][1] = new Array("GSM moduly / komunikátory","http://www.poustka.com/gsm/moduly.html","");
subInfo[6][2] = new Array("teorie - GSM moduly","http://www.poustka.com/gsm/gsm-info.html","");

subInfo[7][1] = new Array("internet satelitní","http://www.poustka.com/internet/satelitni.html","");
subInfo[7][2] = new Array("internet bezdrátový MOSCOM","http://www.poustka.com/internet/moscom.html","");
subInfo[7][3] = new Array("Wifi pro Notebooke","http://www.poustka.com/internet/wifi.html","");

subInfo[8][1] = new Array("byty - rodinné domy - bary","http://www.poustka.com/ozvuceni/byty.html","");
subInfo[8][2] = new Array("plošné 100 Voltové ozvučení","http://www.poustka.com/ozvuceni/100volt.html","");
subInfo[8][3] = new Array("teorie - ozvučování","http://www.poustka.com/ozvuceni/ozvuceni-info.html","");

subInfo[9][1] = new Array("audio/video telefony","http://www.poustka.com/komunikace/videotelefon.html","");
subInfo[9][2] = new Array("...","http://www.poustka.com/komunikace/videotelefon.html","");
subInfo[9][3] = new Array("...","http://www.poustka.com/komunikace/videotelefon.html","");

subInfo[10][1] = new Array("slaboproudé rozvody","http://www.poustka.com/rozvody/slabo.html","");
subInfo[10][2] = new Array("silnoproudé rozvody","http://www.poustka.com/rozvody/silno.html","");

subInfo[11][1] = new Array("biometrické / otisky prstů","http://www.poustka.com/pristup/bio.html","");
subInfo[11][2] = new Array("kódové klávesnice","http://www.poustka.com/pristup/kodove.html","");
subInfo[11][3] = new Array("čipové přístupy RFID","http://www.poustka.com/pristup/rfid.html","");
subInfo[11][4] = new Array("…","http://www.poustka.com/pristup/pristup.html","");
subInfo[11][5] = new Array("teorie - přístupy","http://www.poustka.com/pristup/pristup-info.html","");

subInfo[12][1] = new Array("automatické závory 4 - 8 m","http://www.poustka.com/zavory/zavory.html","");
subInfo[12][2] = new Array("...","http://www.poustka.com/zavory/zavory.html","");

subInfo[13][1] = new Array("kompletní instalace na klíč","http://www.poustka.com/elektro/instalace.html","");
subInfo[13][2] = new Array("značení vypínačů","http://www.poustka.com/elektro/vypinace.html","");
subInfo[13][3] = new Array("značení IP krytí","http://www.poustka.com/elektro/ip-kryti.html","");
subInfo[13][4] = new Array("značení kabelů","http://www.poustka.com/elektro/kabely.html","");
subInfo[13][5] = new Array("typy LPZ zón","http://www.poustka.com/elektro/lpz.html","");
subInfo[13][6] = new Array("...","http://www.poustka.com/elektro/elektro.html","");
subInfo[13][7] = new Array("...","http://www.poustka.com/elektro/elektro.html","");

subInfo[14][1] = new Array("měření spotřeby el. energie","http://www.poustka.com/spotreba/spotreba.html","");
subInfo[14][2] = new Array("...","http://www.poustka.com/spotreba/spotreba.html","");

subInfo[15][1] = new Array("servis, generální opravy","http://www.poustka.com/pracky/pracky.html","");

subInfo[16][1] = new Array("slovník technických pojmů","http://www.poustka.com/slovnik/slovnik-pojmu.html","");

subInfo[17][1] = new Array("půjčovna nářadí","http://www.poustka.com/pujcovna/pujcovna-naradi.html","");
subInfo[17][2] = new Array("půjčovna set-top-boxů","http://www.poustka.com/pujcovna/pujcovna-set-top-box.html","");










//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 120;
var ySubOffset = 7;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub = false;
var delay = 1000;
totalButtons = upSources.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '" class="dropmenu" ');
		document.write('onMouseOver="overSub=true;');
		document.write('setOverImg(\'' + (x+1) + '\',\'\');"');
		document.write('onMouseOut="overSub=false;');
		document.write('setTimeout(\'hideSubMenu(\\\'submenu' + (x+1) + '\\\')\',delay);');
		document.write('setOutImg(\'' + (x+1) + '\',\'\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo[x+1][k+1][2] + '">');
			document.write( subInfo[x+1][k+1][0] + '</a>');
			document.write('</li>');
		}
		document.write('</ul>');
	}
	document.write('</div>');
}





//*** MAIN BUTTONS FUNCTIONS ***//
// PRELOAD MAIN MENU BUTTON IMAGES
function preload() {
	for ( x=0; x<totalButtons; x++ ) {
		buttonUp = new Image();
		buttonUp.src = buttonFolder + upSources[x];
		buttonOver = new Image();
		buttonOver.src = buttonFolder + overSources[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + overSources[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + upSources[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft(id) { 
	var el = getElement(id);
	if (el) { 
		xPos = el.offsetLeft;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		} 
		return xPos;
	} 
} 

// GET Y COORDINATE
function getRealTop(id) {
	var el = getElement(id);
	if (el) { 
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
}

// MOVE OBJECT TO COORDINATE
function moveObjectTo(objectID,x,y) {
	var el = getElement(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu(subID, buttonID) {
	hideAllSubMenus();
	butX = getRealLeft(buttonID);
	butY = getRealTop(buttonID);
	moveObjectTo(subID,butX+xSubOffset, butY+ySubOffset);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus() {
	for ( x=0; x<totalButtons; x++) {
		moveObjectTo("submenu" + (x+1) + "",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu(subID) {
	if ( overSub == false ) {
		moveObjectTo(subID,-500, -500);
	}
}



//preload();


