		function findPosX(obj)
		{
			var curleft = 0;
			if (obj.offsetParent)
			{
				while (obj.offsetParent)
				{
					curleft += obj.offsetLeft
					obj = obj.offsetParent;
				}
			}
			else if (obj.x)
				curleft += obj.x;
			return curleft;
		}

		function findPosY(obj)
		{
			var curtop = 0;
			if (obj.offsetParent)
			{
				while (obj.offsetParent)
				{
					curtop += obj.offsetTop
					obj = obj.offsetParent;
				}
			}
			else if (obj.y)
				curtop += obj.y;
			return curtop;
		}
		function BuildMenu()
		{
		//----------------------------------------
		// Skoda Top Menu Items
		// JScript source code for SkodaTopMenu
		// S K O D A   A U T O   a . s .
		//----------------------------------------

		//detect menu span and position
		var PositionSpan=document.getElementById('MenuPositionSpan')
		var left_pos=findPosX(PositionSpan);
		var top_pos=findPosY(PositionSpan);

		//detect browser type
		//bwExplorer = (navigator.appName == 'Microsoft Internet Explorer') ? "True" : "False";
		bwNetscape = (navigator.appName == 'Netscape') ? "True" : "False";
		agent = navigator.userAgent;
		if (((agent.toLowerCase().indexOf('opera 7')>-1) || (agent.toLowerCase().indexOf('opera/7')>-1))) 
                {bwOpera = "True";} else {bwOpera = "False";}

		//defining styles for different browsers
		var TOP_STYLE_ON = "TopOn";
		var TOP_STYLE_OVER = "TopOver";
		var SUB_STYLE_ON = "SubOn";
		var SUB_STYLE_OVER = "SubOver";
		var SUB_STYLE_ON_BOTTOM = "SubOnBottom";
		var SUB_STYLE_OVER_BOTTOM = "SubOverBottom";
		opera_pos = 1;
		level_off = 20;
		if (bwNetscape == "True") 
			{ 
				opera_pos = 1;
				level_off = 20;
				TOP_STYLE_ON = "TopOn";
				TOP_STYLE_OVER = "NetscapeTopOver";
				SUB_STYLE_ON = "SubOn";
				SUB_STYLE_OVER = "NetscapeSubOver";
				SUB_STYLE_ON_BOTTOM = "SubOnBottom";
				SUB_STYLE_OVER_BOTTOM = "SubOverBottom";
			}
		if (bwOpera == "True") 
			{ 
				opera_pos = 4;
				level_off = 22;
				TOP_STYLE_ON = "OperaTopOn";
				TOP_STYLE_OVER = "OperaTopOver";
				SUB_STYLE_ON = "SubOn";
				SUB_STYLE_OVER = "SubOver";
				SUB_STYLE_ON_BOTTOM = "SubOnBottom";
				SUB_STYLE_OVER_BOTTOM = "SubOverBottom";
			}

		//Definition of menu items
		//Item attributes : itemName, itemPosition[left,top], itemSize[height,width], itemOff[left,top],
		//					itemLevelOff[left,top], itemUrl, itemStyle[styleOn, styleOff], itemDescription

		var skodaTopMenuItems =
		[
			// default value for first level - position, size, item off, style nad url
			{"itemPosition": [left_pos + opera_pos, top_pos + opera_pos],
                                         "itemSize": [12,90],
                                         "itemOff": [90,0],
                                         "itemStyle": [TOP_STYLE_ON, TOP_STYLE_OVER], "itemUrl": "none"},

			//first level
			{"itemName": "Centrum Szkolenia", "itemSize": [14, 130], "itemOff": [130,0],"itemSubMenu":
			[	//second level
				// default value for second level - size, item off, level off, style and url
				{"itemSize": [14, 210], "itemOff": [0,14], "itemLevelOff": [0,level_off], "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER], "itemUrl": "none"},

           		{"itemName": "&#187; Centrum Szkolenia", "itemUrl": "index.php3?action=centrum", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Obozy i seminaria szkoleniowe", "itemUrl": "index.php3?action=obozy", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

			{"itemName": "&#187; Imprezy integracyjne", "itemUrl": "index.php3?action=imprezy", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

			{"itemName": "&#187; Galeria zdjęć", "itemUrl": "index.php3?action=galeria", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Kontakt", "itemUrl": "index.php3?action=kontakt", "itemDescription": "Kontakt", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Praca - Polska", "itemUrl": "index.php3?action=praca&w=pl", "itemDescription": "Praca", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Praca - Europa", "itemUrl": "index.php3?action=praca&w=eu", "itemDescription": "Praca", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

              	{"itemName": "&nbsp;", "itemStyle": [SUB_STYLE_ON_BOTTOM, SUB_STYLE_OVER_BOTTOM]}
            ]},



			//first level
			{"itemName": "Agencja Ochrony", "itemSize": [16, 120], "itemOff": [140,0],"itemSubMenu":
			[	//second level
				// default value for second level - size, item off, level off, style and url
				{"itemSize": [14, 141], "itemOff": [0,14], "itemLevelOff": [0,level_off], "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER], "itemUrl": "none"},

           		{"itemName": "&#187; Agencja Ochrony", "itemUrl": "index.php3?action=agencja", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Bank Danych", "itemUrl": "index.php3?action=cobrabaza", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Oferta", "itemUrl": "index.php3?action=agencja_oferta", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Prezentacja", "itemUrl": "index.php3?action=agencja_prezentacja", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Gwarancje", "itemUrl": "index.php3?action=agencja_gwarancje", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Referencje", "itemUrl": "index.php3?action=agencja_referencje", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Cennik", "itemUrl": "index.php3?action=agencja_cennik", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Kontakt", "itemUrl": "index.php3?action=kontakt", "itemDescription": "Kontakt", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

              	{"itemName": "&nbsp;", "itemStyle": [SUB_STYLE_ON_BOTTOM, SUB_STYLE_OVER_BOTTOM]}
            ]},



			//first level
			{"itemName": "Szkoła", "itemSize": [16, 60], "itemOff": [130,0],"itemSubMenu":
			[	//second level
				// default value for second level - size, item off, level off, style and url
				{"itemSize": [14, 170], "itemOff": [0,14], "itemLevelOff": [0,level_off], "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER], "itemUrl": "none"},

           		{"itemName": "&#187; Akty Prawne", "itemUrl": "index.php3?action=akty_prawne", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Galeria", "itemUrl": "index.php3?action=galeria", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Imprezy integracyjne", "itemUrl": "index.php3?action=szkola_imprezy", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Stypendia", "itemUrl": "index.php3?action=szkola_stypendia", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Zapisz się do szkoły", "itemUrl": "index.php3?action=szkola_form", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Warunki przyjęcia", "itemUrl": "index.php3?action=szkola_warunki_przyjecia", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Sieć Szkół COBRA", "itemUrl": "index.php3?action=siec_szkol", "itemDescription": "Kontakt", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Dlaczego warto ?", "itemUrl": "index.php3?action=szkola_dlaczego", "itemDescription": "Kontakt", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Migawki z życia Szkoły", "itemUrl": "index.php3?action=szkola_migawki", "itemDescription": "Kontakt", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Opinie absolwentów", "itemUrl": "index.php3?action=szkola_opinie", "itemDescription": "Kontakt", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Warunki nauczania<br>&nbsp;", "itemUrl": "index.php3?action=szkola_warunki", "itemDescription": "Kontakt", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

				{"itemName": "&#187; Elitarne Studium <br>&nbsp;&nbsp;Kariery Zawodowej", "itemUrl": "index.php3?action=stud_kar_zaw", "itemDescription": "Kontakt", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		{"itemName": "&#187; Elitarne Studium <br>&nbsp;&nbsp;Medyczne", "itemUrl": "index.php3?action=stud_med", "itemDescription": "Kontakt", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

              	{"itemName": "&nbsp;", "itemStyle": [SUB_STYLE_ON_BOTTOM, SUB_STYLE_OVER_BOTTOM]}
            ]},



			//first level
			{"itemName": "Multimedia", "itemSize": [16, 100], "itemOff": [120,0],"itemSubMenu":
			[	//second level
				// default value for second level - size, item off, level off, style and url
				{"itemSize": [14, 121], "itemOff": [0,14], "itemLevelOff": [0,level_off], "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER], "itemUrl": "none"},

           		{"itemName": "&#187; Galeria zdjęć", "itemUrl": "index.php3?action=galeria", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

           		{"itemName": "&#187; Filmy", "itemUrl": "index.php3?action=filmy", "itemDescription": "", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},

              	{"itemName": "&nbsp;", "itemStyle": [SUB_STYLE_ON_BOTTOM, SUB_STYLE_OVER_BOTTOM]}
            ]}

		];

		SkodaMenu(skodaTopMenuItems);
		menuBuilded=true;
		}

		var menuBuilded=false

		function onResizeRebuildMenu()
		{
			if (!menuBuilded)
				return;
			try
			{
				if (document.getElementById('MainMenuSpan') != null)
					{document.body.removeChild(document.getElementById('MainMenuSpan'));}
			}catch(e){}
			BuildMenu();
		}
