//default global value
defaultItemLevelOnePosition	= [];
defaultItemLevelOneSize = [];
defaultItemLevelOneItemOff = [];
defaultItemLevelOneStyle = [];
defaultItemLevelOneUrl = [];
defaultItemLevelSecondSize = [];
defaultItemLevelSecondItemOff = [];
defaultItemLevelSecondLevelOff = [];
defaultItemLevelSecondStyle = [];
defaultItemLevelSecondUrl = [];
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(){
// JScript Top Menu
var PositionSpan=document.getElementById('MenuPositionSpan')
var left_pos=findPosX(PositionSpan);
var top_pos=findPosY(PositionSpan);
agent = navigator.userAgent;
//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";
opera_pos_left = 0;
opera_pos_top = 0;
level_off = 20;
//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 FoundTopMenuItems = 
		[
			// default value for first level - position, size, item off, style nad url
			{"itemPosition": [left_pos + opera_pos_left, top_pos + opera_pos_top], "itemSize": [12,90], "itemOff": [90,0], "itemStyle": [TOP_STYLE_ON, TOP_STYLE_OVER], "itemUrl": "none"},
			
           	{"itemName": "News", "itemUrl": "http://www.fondazione-delbianco.org/inglese/index_i.htm", "itemSize": [16, 50], "itemOff": [50,0]},
			//first level
			{"itemName": "Who we are", "itemSize": [16, 100], "itemOff": [100,0],"itemSubMenu":                 
			[	//second level
				// default value for second level - size, item off, level off, style and url
				{"itemSize": [14, 135], "itemOff": [0,14], "itemLevelOff": [0,level_off], "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER], "itemUrl": "none"},
  				
           		{"itemName": "Manifesto", "itemUrl": "http://www.fondazione-delbianco.org/inglese/manifesto.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "History", "itemUrl": "http://www.fondazione-delbianco.org/inglese/history.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Statute", "itemUrl": "http://www.fondazione-delbianco.org/inglese/statute.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Mission", "itemUrl": "http://www.fondazione-delbianco.org/inglese/mission.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Commitees", "itemUrl": "http://www.fondazione-delbianco.org/inglese/scientcomitat.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Foundation organs", "itemUrl": "http://www.fondazione-delbianco.org/inglese/foundationorg.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "President's portraits", "itemUrl": "http://www.fondazione-delbianco.org/inglese/portraits.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
				
				{"itemName": "Acknowledments", "itemUrl": "http://www.fondazione-delbianco.org/inglese/acknow.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
				{"itemName": "Press Survey", "itemUrl": "http://www.fondazione-delbianco.org/inglese/press.html ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
              	
				{"itemName": "Links", "itemUrl": "http://www.fondazione-delbianco.org/inglese/links.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]}
				
            ]},
			//first level
			{"itemName": "What we do", "itemSize": [16, 100], "itemOff": [100,0],"itemSubMenu":                 
			[	//second level
				// default value for second level - size, item off, level off, style and url
				{"itemSize": [14, 145], "itemOff": [0,14], "itemLevelOff": [0,level_off], "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER], "itemUrl": "none"},
  				
           		{"itemName": "Meetings & Events", "itemUrl": "http://www.fondazione-delbianco.org/inglese/meeting.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Exhibitions", "itemUrl": "http://www.fondazione-delbianco.org/inglese/meeting.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Competition", "itemUrl": "http://www.fondazione-delbianco.org/inglese/competition.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Conferences", "itemUrl": "http://www.fondazione-delbianco.org/inglese/meeting.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Conserts", "itemUrl": "http://www.fondazione-delbianco.org/inglese/meeting.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Young artists", "itemUrl": "http://www.fondazione-delbianco.org/inglese/young.html", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
				
				{"itemName": "Restored Masterpieces", "itemUrl": "http://www.fondazione-delbianco.org/inglese/masterpieces.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
				
				{"itemName": "Library", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
				
				{"itemName": "Availabe Catalogues", "itemUrl": "http://www.fondazione-delbianco.org/inglese/vendita.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]}
           		
            ]},
			//first level
			{"itemName": "Take part our activity", "itemSize": [16, 165], "itemOff": [165,0],"itemSubMenu":                 
			[	//second level
				// default value for second level - size, item off, level off, style and url
				{"itemSize": [14, 180], "itemOff": [0,14], "itemLevelOff": [0,level_off], "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER], "itemUrl": "none"},
  				
           		{"itemName": "Students workshops", "itemUrl": "http://www.fondazione-delbianco.org/inglese/prog05_06/prog_05-06.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Meetings & Conferences", "itemUrl": "http://www.fondazione-delbianco.org/inglese/prog05_06/prog_05-06.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Courses", "itemUrl": "http://www.fondazione-delbianco.org/inglese/prog05_06/prog_05-06.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Florence expo", "itemUrl": "http://www.florence-expo.com/ ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
				
				{"itemName": "Propose Your Event", "itemUrl": "mailto:info@fondazione-delbianco.org?subject=Propose Your Event with Romualdo Del Bianco Foundation", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
								
				{"itemName": "Become Expert", "itemUrl": "mailto:info@fondazione-delbianco.org?subject=Become Expert of Romualdo Del Bianco Foundation", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
												
				{"itemName": "Among Youth", "itemUrl": "http://www.fondazione-delbianco.org/inglese/bacheca.htm ", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
																
				{"itemName": "Among Academicians", "itemUrl": "http://www.fondazione-delbianco.org/inglese/amongacademicians.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]}
           		
            ]},
           	//first level
			{"itemName": "Newspaper", "itemSize": [16, 90], "itemOff": [90,0],"itemSubMenu":                 
			[	//second level
				// default value for second level - size, item off, level off, style and url
				{"itemSize": [14, 105], "itemOff": [0,14], "itemLevelOff": [0,level_off], "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER], "itemUrl": "none"},
  				
           		{"itemName": "Last Edition", "itemUrl": "http://www.fondazione-delbianco.org/inglese/magazine/Last_edition/index.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Newspaper n9", "itemUrl": "http://www.fondazione-delbianco.org/inglese/magazine/N_9/index.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Newspaper n8", "itemUrl": "http://www.fondazione-delbianco.org/pdf/magazine/news-from-florence-no-8.pdf", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Newspaper n7", "itemUrl": "http://www.fondazione-delbianco.org/pdf/magazine/news-from-florence-no-7.pdf", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Newspaper n6", "itemUrl": "http://www.fondazione-delbianco.org/pdf/magazine/news-from-florence-no-6.pdf", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Newspaper n5", "itemUrl": "http://www.fondazione-delbianco.org/pdf/magazine/news-from-florence-no-5.pdf", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
           		
           		{"itemName": "Newspaper n4", "itemUrl": "http://www.fondazione-delbianco.org/pdf/magazine/news-from-florence-no-4.pdf", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
				
           		{"itemName": "Newspaper n3", "itemUrl": "http://www.fondazione-delbianco.org/pdf/magazine/news-from-florence-no-3.pdf", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
				
				{"itemName": "Newspaper n2", "itemUrl": "http://www.fondazione-delbianco.org/inglese/magazine/N_2/index.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]},
				
				{"itemName": "Newspaper n1", "itemUrl": "http://www.fondazione-delbianco.org/inglese/magazine/N_1/index.htm", "itemStyle": [SUB_STYLE_ON, SUB_STYLE_OVER]}
				
            ]}
           	
			//first level
			
		];
		
FoundMenu(FoundTopMenuItems, 'FoundTopMenu');
menuBuilded=true;
}

var menuBuilded=false
function onResizeRebuildMenu(){
if (!menuBuilded)
	return;
try	{
	if (document.getElementById('FoundTopMenu') != null){
		document.body.removeChild(document.getElementById('FoundTopMenu'));
	}
}catch(e){}
BuildMenu();
}


//Main function
function FoundMenu(menuItems, menuName)
{
	//default values for first item level
	defaultItemLevelOnePosition = menuItems[0].itemPosition;
	defaultItemLevelOneSize = menuItems[0].itemSize;
	defaultItemLevelOneItemOff = menuItems[0].itemOff;
	defaultItemLevelOneStyle = menuItems[0].itemStyle;
	defaultItemLevelOneUrl = menuItems[0].itemUrl;

	//defining actual position for first level
	actualPosition = [];
	actualPosition[0] = defaultItemLevelOnePosition[0];
	actualPosition[1] = defaultItemLevelOnePosition[1];
	
	//creating element for printing tags
	element = document.createElement("Span");
	element.id = menuName;

	//loop for menuItems.length items
	// : create new menuItem
	stringHtmlTags = "";
	i = 1;
	for (i; i < menuItems.length; i++)
	{
		//setting position for current item
		currentItemPosition = (menuItems[i].itemPosition == null) ? actualPosition : menuItems[i].itemPosition;
		//setting other values for current item
		currentItemName = (menuItems[i].itemName == null) ? "undefined" : menuItems[i].itemName;
		currentItemSize = [];
		currentItemSize[0] = (menuItems[i].itemSize == null) ? defaultItemLevelOneSize[0] : menuItems[i].itemSize[0];
		currentItemSize[1] = (menuItems[i].itemSize == null) ? defaultItemLevelOneSize[1] : menuItems[i].itemSize[1];
		currentItemStyle = (menuItems[i].itemStyle == null) ? defaultItemLevelOneStyle : menuItems[i].itemStyle;
		currentItemUrl = (menuItems[i].itemUrl == null) ? defaultItemLevelOneUrl : menuItems[i].itemUrl;
		currentItemDescription = (menuItems[i].itemDescription == null) ? "" : menuItems[i].itemDescription;
		currentItemEffect = (menuItems[i].itemEffect == null) ? "" : menuItems[i].itemEffect;
		currentItemOff = [];
		currentItemOff[0] = (menuItems[i].itemOff == null) ? defaultItemLevelOneItemOff[0] : menuItems[i].itemOff[0];
		currentItemOff[1] = (menuItems[i].itemOff == null) ? defaultItemLevelOneItemOff[1] : menuItems[i].itemOff[1];
		currentItemSubMenu = (menuItems[i].itemSubMenu == null) ? null : menuItems[i].itemSubMenu;
		
		//string with html tags
		stringHtmlTags += FoundMenuItem(i, currentItemName, currentItemPosition, currentItemSize, currentItemStyle, currentItemUrl, currentItemDescription, currentItemSubMenu, currentItemEffect, menuName);
		//setting actual position as enter for next item
		actualPosition[0] += currentItemOff[0];
		actualPosition[1] += currentItemOff[1];
	}

	//writing html tags into element and writing to document
	element.innerHTML = stringHtmlTags;
	//joining element with body element
	document.body.appendChild(element);
}

//Definition for one first level item
function FoundMenuItem(itemLevelOneId, itemName, itemPosition, itemSize, itemStyle, itemUrl, itemDescription, itemSubMenu, itemEffect, menuName)
{
	//number of members menu second level
	subMenuItemLength = (itemSubMenu == null)? 0 : itemSubMenu.length;
	var subMenuItemOff = 0;
	for (menuItemNum=1; menuItemNum < subMenuItemLength; menuItemNum++)
	{
		subMenuItemOff += (itemSubMenu[menuItemNum].itemSize == null) ? itemSubMenu[0].itemOff[1] : itemSubMenu[menuItemNum].itemSize[0];
	}
	//event onClick ( go on url or nothing)
	actionOnClick = (itemUrl == "none") ? '' : ' onclick="location.href=\'' + itemUrl + '\';"';
	//text in status bar
	actionStatusBar = (itemDescription == "") ? '' : ' self.status = \'' + itemDescription + '\';';
	//creating output string
	outputStringHtmlTags = "";
	outputStringHtmlTags += '<table id="tableLevelOne_' + itemLevelOneId + '_' + menuName + '" height="' + itemSize[0] + '" width="' + itemSize[1] + '" cellspacing="0" cellpadding="0" border="0" style="position: absolute; z-index: 1000; left: ' + itemPosition[0] + 'px; top: ' + itemPosition[1] + 'px">';
	outputStringHtmlTags += '<tr><td id="levelOne_' + itemLevelOneId + '_' + menuName + '" width="100%" height="100%" class="' + itemStyle[0];
	if (itemEffect == "")
	{
		outputStringHtmlTags += '" onmouseover="ShowHideSubMenu(\'visible\',' +  itemLevelOneId + ', \'' + menuName + '\'); this.className=\'' + itemStyle[1] + '\'; ' + actionStatusBar + '" onmouseout="this.className=\'' + itemStyle[0] + '\'; ShowHideSubMenu(\'hidden\',' +  itemLevelOneId + ', \'' + menuName + '\');"';
	}
	if (itemEffect == "SlideUp")
	{
		outputStringHtmlTags += '" onmouseover="SlideUpSubMenu(\'visible\',' +  itemLevelOneId + ', ' + subMenuItemOff + ',\'' + menuName + '\'); this.className=\'' + itemStyle[1] + '\'; ' + actionStatusBar + '" onmouseout="this.className=\'' + itemStyle[0] + '\'; SlideUpSubMenu(\'hidden\',' +  itemLevelOneId + ', ' + subMenuItemOff + ', \'' + menuName + '\');"';
	}
	outputStringHtmlTags += actionOnClick + '>' + itemName + '</td></tr></table>';
	if (subMenuItemLength > 0) outputStringHtmlTags += FoundSubMenuItem(itemLevelOneId, itemPosition, itemStyle, itemSubMenu, subMenuItemOff, itemEffect, menuName);
	return outputStringHtmlTags;
}

//Definition for second level items
function FoundSubMenuItem(itemLevelOneId, itemLevelOnePosition, itemLevelOneStyle, subMenuItems, subMenuItemOff, itemEffect, menuName)
{
	//default values for second item level
	//pokud to bude hazet chybu = musi se vytvorit kanaly a subkanaly v CMS (1. a 2. uroven navigace)
	defaultItemLevelSecondSize[0] = (subMenuItems[0].itemSize == null) ? 20 : subMenuItems[0].itemSize[0];
	defaultItemLevelSecondSize[1] = (subMenuItems[0].itemSize == null) ? 20 : subMenuItems[0].itemSize[1];
	defaultItemLevelSecondItemOff[0] = (subMenuItems[0].itemOff == null) ? 20 : subMenuItems[0].itemOff[0];
	defaultItemLevelSecondItemOff[1] = (subMenuItems[0].itemOff == null) ? 20 : subMenuItems[0].itemOff[1];
	defaultItemLevelSecondLevelOff[0] = (subMenuItems[0].itemLevelOff == null) ? 20 : subMenuItems[0].itemLevelOff[0];
	defaultItemLevelSecondLevelOff[1] = (subMenuItems[0].itemLevelOff == null) ? 20 : subMenuItems[0].itemLevelOff[1];
	defaultItemLevelSecondStyle = subMenuItems[0].itemStyle;
	defaultItemLevelSecondUrl = subMenuItems[0].itemUrl;
	defaultItemLevelSecondUrlTarget = "_self";
	//enter position for sub menu
	itemSubMenuActualPosition = [];
	itemSubMenuActualPosition[0] = itemLevelOnePosition[0];
	itemSubMenuActualPosition[1] = itemLevelOnePosition[1];
	//setting position for table
	itemSubMenuPosition = [];
	itemSubMenuPosition[0] = itemSubMenuActualPosition[0] + defaultItemLevelSecondLevelOff[0];
	itemSubMenuPosition[1] = itemSubMenuActualPosition[1] + defaultItemLevelSecondLevelOff[1];
	//creating table 
	stringSubMenuHtmlTags = "";
	stringSubMenuHtmlTags += '<table id="levelSecond_' + itemLevelOneId + '_' + menuName + '" width="' + defaultItemLevelSecondSize[1] + '" cellspacing="0" cellpadding="0" border="0" style="visibility: hidden; position: absolute; z-index: 1000; left: ' + itemSubMenuPosition[0] + 'px; top: ' + itemSubMenuPosition[1] + 'px">';

	//creating string with html tags
	itemSubMenuItemOff = [];
	j = 1;
	for (j; j < subMenuItems.length; j++)
	{
		//setting other values for current item
		itemSubMenuName = (subMenuItems[j].itemName == null) ? "undefined" : subMenuItems[j].itemName;
		itemSubMenuStyle = (subMenuItems[j].itemStyle == null) ? defaultItemLevelSecondStyle : subMenuItems[j].itemStyle;
		itemSubMenuUrl = (subMenuItems[j].itemUrl == null) ? defaultItemLevelSecondUrl : subMenuItems[j].itemUrl;
		itemSubMenuUrlTarget = (subMenuItems[j].itemTarget == null) ? defaultItemLevelSecondUrlTarget : subMenuItems[j].itemTarget;
		itemSubMenuItemOff[0] = (subMenuItems[j].itemOff == null) ? defaultItemLevelSecondItemOff[0] : subMenuItems[j].itemOff[0];
		itemSubMenuItemOff[1] = (subMenuItems[j].itemOff == null) ? defaultItemLevelSecondItemOff[1] : subMenuItems[j].itemOff[1];
		itemSubMenuDescription = (subMenuItems[j].itemDescription == null) ? "" : subMenuItems[j].itemDescription;
		//event onClick ( go on url or nothing)
		if (itemSubMenuUrlTarget == defaultItemLevelSecondUrlTarget)
		{
			actionSubMenuOnClick = (itemSubMenuUrl == "none") ? '' : ' onclick="location.href=\'' + itemSubMenuUrl + '\';"';
		}
		else
		{
			itemLinkBegin = '<a href=\'' + itemSubMenuUrl + '\' target=\'' + itemSubMenuUrlTarget + '\'>';
			itemLinkEnd =  '</a>';
		}
		//text in status bar
		actionSubMenuStatusBar = (itemSubMenuDescription == "") ? '' : ' self.status = \'' + itemSubMenuDescription + '\';';

		//string with html tags
		if (itemSubMenuUrlTarget == defaultItemLevelSecondUrlTarget)
		{
			if (itemEffect == "")
			{
				stringSubMenuHtmlTags += '<tr><td width="100%" height="' + itemSubMenuItemOff[1] + '" class="' + itemSubMenuStyle[0] + '" onmouseover="this.className=\'' + itemSubMenuStyle[1] + '\'; ShowHideSubMenu(\'visible\',' +  itemLevelOneId + ', \'' + menuName + '\'); document.getElementById(\'levelOne_' + itemLevelOneId + '_' + menuName + '\').className = \'' + itemLevelOneStyle[1] + '\';' + actionSubMenuStatusBar + '" onmouseout="this.className=\'' + itemSubMenuStyle[0] + '\'; ShowHideSubMenu(\'hidden\',' +  itemLevelOneId + ', \'' + menuName + '\'); document.getElementById(\'levelOne_' + itemLevelOneId + '_' + menuName + '\').className = \'' + itemLevelOneStyle[0] + '\';"' + actionSubMenuOnClick + '>' + itemSubMenuName + '</td></tr>';
			}
			if (itemEffect == "SlideUp")
			{
				stringSubMenuHtmlTags += '<tr><td width="100%" height="' + itemSubMenuItemOff[1] + '" class="' + itemSubMenuStyle[0] + '" onmouseover="this.className=\'' + itemSubMenuStyle[1] + '\'; SlideUpSubMenu(\'visible\',' +  itemLevelOneId + ', ' + subMenuItemOff + ',\'' + menuName + '\'); document.getElementById(\'levelOne_' + itemLevelOneId + '_' + menuName + '\').className = \'' + itemLevelOneStyle[1] + '\';' + actionSubMenuStatusBar + '" onmouseout="this.className=\'' + itemSubMenuStyle[0] + '\'; SlideUpSubMenu(\'hidden\',' +  itemLevelOneId + ', ' + subMenuItemOff + ',\'' + menuName + '\'); document.getElementById(\'levelOne_' + itemLevelOneId + '_' + menuName + '\').className = \'' + itemLevelOneStyle[0] + '\';"' + actionSubMenuOnClick + '>' + itemSubMenuName + '</td></tr>';
			}
		}
		else
		{
			if (itemEffect == "")
			{
				stringSubMenuHtmlTags += '<tr>' + itemLinkBegin + '<td width="100%" height="' + itemSubMenuItemOff[1] + '" class="' + itemSubMenuStyle[0] + '" onmouseover="this.className=\'' + itemSubMenuStyle[1] + '\'; ShowHideSubMenu(\'visible\',' +  itemLevelOneId + ', \'' + menuName + '\'); document.getElementById(\'levelOne_' + itemLevelOneId + '_' + menuName + '\').className = \'' + itemLevelOneStyle[1] + '\';' + actionSubMenuStatusBar + '" onmouseout="this.className=\'' + itemSubMenuStyle[0] + '\'; ShowHideSubMenu(\'hidden\',' +  itemLevelOneId + ', \'' + menuName + '\'); document.getElementById(\'levelOne_' + itemLevelOneId + '_' + menuName + '\').className = \'' + itemLevelOneStyle[0] + '\';">' + itemSubMenuName + '</td>' + itemLinkEnd + '</tr>';
			}
			if (itemEffect == "SlideUp")
			{
				stringSubMenuHtmlTags += '<tr>' + itemLinkBegin + '<td width="100%" height="' + itemSubMenuItemOff[1] + '" class="' + itemSubMenuStyle[0] + '" onmouseover="this.className=\'' + itemSubMenuStyle[1] + '\'; SlideUpSubMenu(\'visible\',' +  itemLevelOneId + ', ' + subMenuItemOff + ',\'' + menuName + '\'); document.getElementById(\'levelOne_' + itemLevelOneId + '_' + menuName + '\').className = \'' + itemLevelOneStyle[1] + '\';' + actionSubMenuStatusBar + '" onmouseout="this.className=\'' + itemSubMenuStyle[0] + '\'; SlideUpSubMenu(\'hidden\',' +  itemLevelOneId + ', ' + subMenuItemOff + ',\'' + menuName + '\'); document.getElementById(\'levelOne_' + itemLevelOneId + '_' + menuName + '\').className = \'' + itemLevelOneStyle[0] + '\';">' + itemSubMenuName + '</td>' + itemLinkEnd + '</tr>';
			}
		}
	}
	
	stringSubMenuHtmlTags += '</table>';
	return stringSubMenuHtmlTags;
}

//function for show and hide submenu items
function ShowHideSubMenu(action, itemLevelOneId, menuName)
{
	if (document.getElementById('levelSecond_' + itemLevelOneId + '_' + menuName) != null)
	{
		document.getElementById('levelSecond_' + itemLevelOneId + '_' + menuName).style.visibility = action;
	}
	
	try
	{
		if (action == 'hidden')
		{
			ShowHideQuicktime('visible');
		}
		else
		{
			ShowHideQuicktime('hidden');
		}
	}
	catch(e){}
}

//function for show and hide and sliding up submenu items
function SlideUpSubMenu(action, itemLevelOneId, itemOff, menuName)
{
	//if in cookie is set that bottom menu is always on, then nothing do it
	if (GetSlidingOnOff() != "True")
	{
		
		if (document.getElementById('levelSecond_' + itemLevelOneId + '_' + menuName) != null)
			{document.getElementById('levelSecond_' + itemLevelOneId + '_' + menuName).style.visibility = action;}
	
		step = 1;
		for (i=0; i < itemOff; i++)
		{
			if (action == "visible") 
			{
				document.getElementById('tableLevelOne_' + itemLevelOneId + '_' + menuName).style.posTop -= step;
				document.getElementById('levelSecond_' + itemLevelOneId + '_' + menuName).style.posTop -= step;
			}
			else
			{
				document.getElementById('tableLevelOne_' + itemLevelOneId + '_' + menuName).style.posTop += step;
				document.getElementById('levelSecond_' + itemLevelOneId + '_' + menuName).style.posTop += step;
			}
		}
	}
}

function GetSlidingOnOff()
{
	valueName = "BottomMenuAlwaysOn=";
	cookieString = document.cookie.indexOf(";", 0);
	retString = "";
	if (unescape(document.cookie.substring(0, valueName.length)) == valueName)
	{
		retString = unescape(document.cookie.substring(valueName.length, cookieString));
	}
	else
	{
		retString = "New"
	}
	return retString;
}

function SetSlidingOnOff()
{
	valueName = "BottomMenuAlwaysOn=";
	resultString = GetSlidingOnOff();
	if (resultString == "True") 
	{
		document.cookie = valueName + "False"; 
	}
	if (resultString == "False") 
	{
		document.cookie = valueName + "True"; 
	}
	SetSlidingImages();	
}

function SetSlidingImages()
{
	valueName = "BottomMenuAlwaysOn=";
	resultString = GetSlidingOnOff();
	if (resultString == "True") 
	{
		document.images("SlidingOnOffImage").src = "/centria/images/blue/ButtonSlideOn.gif";
	}
	else
	{
		document.images("SlidingOnOffImage").src = "/centria/images/blue/ButtonSlideOff.gif";
	}

}

