/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "images/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("news_bg.png","aboutus_bg.png","strukture_bg.png","projects_bg.png","link_bg.png");

overSources = new Array("news_bg_over.png","aboutus_bg_over.png","strukture_bg_over.png","projects_bg_over.png","link_bg_over.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();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("&#1058;&#1077;&#1082;&#1091;&#1097;&#1080; &#1085;&#1086;&#1074;&#1080;&#1085;&#1080;","index.php","");
subInfo[1][2] = new Array("&#1050;&#1086;&#1085;&#1082;&#1091;&#1088;&#1089;&#1080; &#1080; &#1087;&#1086;&#1082;&#1072;&#1085;&#1080;","competitions.php","");
subInfo[1][3] = new Array("&#1040;&#1088;&#1093;&#1080;&#1074;","archives.php","");

subInfo[2][1] = new Array("&#1053;&#1072;&#1096;&#1072;&#1090;&#1072; &#1074;&#1080;&#1079;&#1080;&#1090;&#1082;&#1072;","about.php","");
subInfo[2][2] = new Array("&#1052;&#1080;&#1089;&#1080;&#1103;, &#1094;&#1077;&#1083;&#1080;, &#1087;&#1088;&#1080;&#1086;&#1088;&#1080;&#1090;&#1077;&#1090;&#1080;","mission.php","");
subInfo[2][3] = new Array("&#1045;&#1082;&#1080;&#1087;","team.php","");
subInfo[2][4] = new Array("&#1048;&#1085;&#1092;&#1086;&#1088;&#1084;&#1072;&#1094;&#1080;&#1086;&#1085;&#1085;&#1080; &#1090;&#1086;&#1095;&#1082;&#1080;","infopoints.php","");
subInfo[2][5] = new Array("&#1055;&#1072;&#1088;&#1090;&#1085;&#1100;&#1086;&#1088;&#1089;&#1082;&#1072; &#1087;&#1086;&#1076;&#1082;&#1088;&#1077;&#1087;&#1072;","support.php","");

subInfo[3][1] = new Array("&#1045;&#1074;&#1088;&#1086;&#1087;&#1077;&#1081;&#1089;&#1082;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1072;&#1094;&#1080;&#1086;&#1085;&#1077;&#1085; &#1094;&#1077;&#1085;&#1090;&#1098;&#1088;","edc.php","");
subInfo[3][2] = new Array("Europe <i>Direct</i>","europedirect.php","");
subInfo[3][3] = new Array("&#1044;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1072;&#1094;&#1080;&#1086;&#1085;&#1077;&#1085; &#1094;&#1077;&#1085;&#1090;&#1098;&#1088; &#1085;&#1072; &#1057;&#1098;&#1074;&#1077;&#1090;&#1072; &#1085;&#1072; &#1045;&#1074;&#1088;&#1086;&#1087;&#1072;","edcoe.php","");
subInfo[3][4] = new Array("&#1056;&#1077;&#1089;&#1091;&#1088;&#1089;&#1077;&#1085; &#1094;&#1077;&#1085;&#1090;&#1098;&#1088; &#8220;&#1054;&#1090;&#1074;&#1086;&#1088;&#1077;&#1085;&#1072; &#1074;&#1088;&#1072;&#1090;&#1072;&#8221; ","opendoor.php","");
subInfo[3][5] = new Array("&#1062;&#1077;&#1085;&#1090;&#1098;&#1088; &#1079;&#1072; &#1076;&#1080;&#1089;&#1090;&#1072;&#1085;&#1094;&#1080;&#1086;&#1085;&#1085;&#1086; &#1086;&#1073;&#1091;&#1095;&#1077;&#1085;&#1080;&#1077;","school","");

subInfo[4][1] = new Array("1997&#1075;. - 2000&#1075;.","9700.php","");
subInfo[4][2] = new Array("2000&#1075;. - 2005&#1075;.","0005.php","");
subInfo[4][3] = new Array("2005&#1075;. - 2010&#1075;.","0510.php","");

subInfo[5][1] = new Array("&#1045;&#1074;&#1088;&#1086;&#1087;&#1077;&#1081;&#1089;&#1082;&#1080; &#1080;&#1085;&#1089;&#1090;&#1080;&#1090;&#1091;&#1094;&#1080;&#1080; &#1080; &#1086;&#1088;&#1075;&#1072;&#1085;&#1080;","eio.php","");
subInfo[5][2] = new Array("&#1045;&#1083;&#1077;&#1082;&#1090;&#1088;&#1086;&#1085;&#1085;&#1080; &#1076;&#1086;&#1082;&#1091;&#1084;&#1077;&#1085;&#1090;&#1080; &#1085;&#1072; &#1080; &#1079;&#1072; &#1045;&#1057;","edocs.php","");
subInfo[5][3] = new Array("&#1056;&#1077;&#1095;&#1085;&#1080;&#1094;&#1080; &#1079;&#1072; &#1087;&#1086;&#1085;&#1103;&#1090;&#1080;&#1103;&#1090;&#1072; &#1089;&#1074;&#1098;&#1088;&#1079;&#1072;&#1085;&#1080; &#1089; &#1045;&#1057;","diction.php","");


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



//*** 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();

