//activeButton zeigt an welcher Button gerade Aktiv, dass heisst geklickt ist
var activeButton = "";
var activeSubNaviButton = "";



function initMainMenu()
{
	preloadImages('images/startseite/navi/profile_a.gif', 'images/startseite/navi/products_a.gif', 
				'images/startseite/navi/it_management_ia.gif', 'images/startseite/navi/support_ia.gif',
				'images/subnavis/profile/referenzen_a.gif', 'images/subnavis/profile/partner_a.gif', 
				'images/subnavis/profile/jobs_a.gif', 'images/subnavis/profile/standorte_a.gif',
				'images/subnavis/products/hardware_a.gif', 'images/subnavis/products/software_a.gif',
				'images/subnavis/products/security_a.gif', 'images/subnavis/products/service_a.gif',				
				'images/haupt_navi_2/login_a.gif', 'images/haupt_navi_2/contact_a.gif',
				'images/haupt_navi_2/sitemap_a.gif','images/subnavis/it_management/consulting_a.gif',
				'images/subnavis/it_management/network_a.gif', 'images/subnavis/it_management/security_a.gif',
				'images/subnavis/support/news_a.gif', 'images/subnavis/support/newsLetter_a.gif', 
				'images/subnavis/support/newsArchive_a.gif', 'images/subnavis/support/itKuerzel_a.gif', 
				'images/subnavis/support/downloads_a.gif', 'images/subnavis/profile/phil_a.gif');
	
}



/**
 *
 * Handles a click on the given button
 *
 * @param string the button that has been clicked
 * @access public
 *
 **/
function buttonClick(which)
{
	if ( which != 'profile' 
		&& (which == activeButton || which == activeSubNaviButton) )
	{
		return;
	}
	
	
	if ( which == "profile" )
	{		
		activeButton = "profile";
		activeSubNaviButton = "";		
	}

	
	else if ( which == "products" )
	{
		activeButton = "products";
		activeSubNaviButton = "";		
	}

	
	else if ( which == "it_management" )
	{
		activeButton = "products";
		activeSubNaviButton = "";		
	}

	else if ( which == "support" )
	{
		activeButton = "support";	
		activeSubNaviButton = "";		
	}
	
	else if ( which == "sitemap" )
	{
		activeButton = "sitemap";	
		activeSubNaviButton = "";		
	}
	
	else if ( which == "shop" )
	{
		activeButton = "shop";	
		activeSubNaviButton = "";		
	}
	
	else if ( which == "contact" )
	{
		activeButton = "contact";	
		activeSubNaviButton = "";		
	}


	// Profile Subnavi Buttons
	else if ( which == "philosophie" )
	{
		activeButton = "profile";
		activeSubNaviButton = "philosophie";
	}
	
	else if ( which == "referenzen" )
	{
		activeButton = "profile";
		activeSubNaviButton = "referenzen";		
	}

	else if ( which == "partner" )
	{
		activeButton = "profile";
		activeSubNaviButton = "partner";		
	}

	else if ( which == "jobs" )
	{
		activeButton = "profile";
		activeSubNaviButton = "jobs";
		
	}

	else if ( which == "standorte" )
	{
		activeButton = "profile";
		activeSubNaviButton = "standorte";	
	}
	
	
	// Products Subnavi Buttons
	else if ( which == "hardware" )
	{
		activeButton = "products";
		activeSubNaviButton = "hardware";		
	}
	
	else if ( which == "software" )
	{
		activeButton = "products";
		activeSubNaviButton = "software";		
	}
	
	else if ( which == "network" )
	{
		activeButton = "products";
		activeSubNaviButton = "network";		
	}
	
	else if ( which == "security" )
	{
		activeButton = "products";
		activeSubNaviButton = "security";		
	}
	
	
	// Support Subnavi Buttons
	else if ( which == "itKuerzel" )
	{
		activeButton = "support";
		activeSubNaviButton = "itKuerzel";	
	}
	
	else if ( which == "downloads" )
	{
		activeButton = "support";
		activeSubNaviButton = "downloads";	
	}		
	
	/*
	else if ( which == "newsletter" )
	{
		freeFixedImage('sub');
		fixImage('sub', 'newsLetterPic', 'images/subnavis/support/newsletter_ia.gif');
				
		activeButton = "support";
		activeSubNaviButton = "newsletter";	
	}
	*/
	else if ( which == "news" )
	{
		activeButton = "support";
		activeSubNaviButton = "news";
	}
	
	else if ( which == "newsletter" )
	{
		activeButton = "support";
		activeSubNaviButton = "newsletter";
	}
	
	else if ( which == "new_media" )
	{
		activeButton = "support";
		activeSubNaviButton = "new_media";
	}
	
	else if ( which == "news2" )
	{
		activeButton = "support";
		activeSubNaviButton = "news2";	
	}
	
	else if ( which == "xscreen" )
	{
		activeButton = "support";
		activeSubNaviButton = "xscreen";
	}
	else if ( which == "xcard" )
	{
		activeButton = "support";
		activeSubNaviButton = "xcard";
	}

	else
	{
		//alert("Button not available: " + which);
		activeButton = "";
		activeSubNaviButton = "";			
	}
	
	if ( navigator.cookieEnabled == true )
		//alert("Cookies enabled");
		
	//set cookie to remember current position of navi and subnavi
	document.cookie = "sigNavi=" + activeButton + "&" + activeSubNaviButton;
	//alert("current cookie value: " + document.cookie);
}


function buttonOver(which)
{
	if ( which == activeButton || which == activeSubNaviButton )
	{
		return;
	}

	if ( which == "profile" )
	{
		swapImgRestore('main');
		
		//fixImage(null, 'shopPic', 'images/navigation/shop_off.gif');  
		swapImage('main', 'profilePic', 'images/startseite/navi/profile_a.gif');
		
		if ( getFixedLayer() != "" )
		{
			hideLayers(getFixedLayer());
		}
		displayLayers('subNaviProfileLayer');
		fixLayer('subNaviProfileLayer');
	}

	else if ( which == "products" )
	{
		swapImgRestore('main');
		//fixImage(null, 'shopPic', 'images/navigation/shop_off.gif');  
		swapImage('main', 'productsPic', 'images/startseite/navi/products_a.gif');
		
		if ( getFixedLayer() != "" )
		{
			hideLayers(getFixedLayer());
		}
		displayLayers('subNaviProductsLayer');
		fixLayer('subNaviProductsLayer');
	}

	else if ( which == "it_management" )
	{
		//fixImage(null, 'shopPic', 'images/navigation/shop_off.gif');  
		swapImgRestore('main');
		swapImage('main', 'it_managementPic', 'images/startseite/navi/it_management_a.gif');
		if ( getFixedLayer() != "" )
		{
			hideLayers(getFixedLayer());
		}
		displayLayers('subNaviITManagementLayer');
		fixLayer('subNaviITManagementLayer');
	}

	else if ( which == "support" )
	{	
		swapImgRestore('main');
		//fixImage(null, 'shopPic', 'images/navigation/shop_off.gif');  
		swapImage('main', 'supportPic', 'images/startseite/navi/support_a.gif');
		if ( getFixedLayer() != "" )
		{
			hideLayers(getFixedLayer());
		}
		displayLayers('subNaviSupportLayer');
		fixLayer('subNaviSupportLayer');
	}


	// 2. Hauptnavi Buttons
	else if ( which == "login" )
	{
		swapImgRestore('main');
		swapImage('main', 'loginPic', 'images/haupt_navi_2/login_a.gif');
		
		if ( getFixedLayer() != "" )
		{
			hideLayers(getFixedLayer());
		}
	}	
	else if ( which == "contact" )
	{
		swapImgRestore('main');
		swapImage('main', 'contactPic', 'images/haupt_navi_2/contact_a.gif');
		
		if ( getFixedLayer() != "" )
		{
			hideLayers(getFixedLayer());
		}
		displayLayers('subNaviContactLayer');
		fixLayer('subNaviContactLayer');
	}	
	else if ( which == "sitemap" )
	{
		swapImgRestore('main');
		swapImage('main', 'sitemapPic', 'images/haupt_navi_2/sitemap_a.gif');
		
		if ( getFixedLayer() != "" )
		{
			hideLayers(getFixedLayer());
		}
	}



	// Subnavi Profile Buttons
	else if ( which == "philosophie" )
	{
		swapImage('sub', 'philosophiePic', 'images/subnavis/profile/phil_a.gif');
	}
	else if ( which == "referenzen" )
	{
		swapImage('sub', 'referenzenPic', 'images/subnavis/profile/referenzen_a.gif');
	}
	else if ( which == "partner" )
	{
		swapImage('sub', 'partnerPic', 'images/subnavis/profile/partner_a.gif');
	}
	else if ( which == "jobs" )
	{
		swapImage('sub', 'jobsPic', 'images/subnavis/profile/jobs_a.gif');
	}
	else if ( which == "standorte" )
	{
		swapImage('sub', 'standortePic', 'images/subnavis/profile/standorte_a.gif');
	}


	// Subnavi Products Buttons
	else if ( which == "hardware" )
	{
		swapImage('sub', 'hardwarePic', 'images/subnavis/products/hardware_a.gif');
	}
	else if ( which == "software" )
	{
		swapImage('sub', 'softwarePic', 'images/subnavis/products/software_a.gif');
	}
	else if ( which == "security" )
	{
		swapImage('sub', 'securityPic', 'images/subnavis/products/security_a.gif');
	}
	else if ( which == "network" )
	{
		swapImage('sub', 'networkPic', 'images/subnavis/products/network_a.gif');
	}

	// Subnavi IT Management Buttons
	else if ( which == "consulting" )
	{
		swapImage('sub', 'consultingPic', 'images/subnavis/it_management/consulting_a.gif');
	}
	else if ( which == "networkIT" )
	{
		swapImage('sub', 'networkITPic', 'images/subnavis/it_management/network_a.gif');
	}
	else if ( which == "security2" )
	{
		swapImage('sub', 'security2Pic', 'images/subnavis/it_management/security_a.gif');
	}	
	

	// Subnavi Support Buttons
	else if ( which == "news" )
	{
		swapImage('sub', 'newsPic', 'images/subnavis/support/news_a.gif');
	}
	else if ( which == "newsLetter" )
	{
		swapImage('sub', 'newsLetterPic', 'images/subnavis/support/newsLetter_a.gif');
		//swapImage('sub', 'newsLetterPic', 'images/subnavis/support/happy_a.gif');
	}
	else if ( which == "newsArchive" )
	{
		swapImage('sub', 'newsArchivePic', 'images/subnavis/support/newsArchive_a.gif');
	}
	else if ( which == "itKuerzel" )
	{
		swapImage('sub', 'itKuerzelPic', 'images/subnavis/support/itkuerzel_a.gif');
	}
	else if ( which == "downloads" )
	{
		swapImage('sub', 'downloadsPic', 'images/subnavis/support/downloads_a.gif');
	}


	// Subnavi Contact Buttons
	else if ( which == "infoSupport" )
	{
		swapImage('sub', 'infoSupportPic', 'images/subnavis/contact/infosupport_a.gif');
	}
	else if ( which == "email" )
	{
		swapImage('sub', 'emailPic', 'images/subnavis/contact/email_a.gif');
	}
	else if ( which == "standort" )
	{
		swapImage('sub', 'standortPic', 'images/subnavis/contact/standort_a.gif');
	}
}




function buttonOut(which)
{
	if ( which == activeButton || which == activeSubNaviButton )
	{
		return;
	}


	if ( which == "profile" )
	{
		//swapImgRestore('main');

		//if ( getFixedLayer() != "subNaviProfileLayer" )
		//{
			//hideLayers('subNaviProfileLayer');
			//displayLayers(getFixedLayer());
		//}
	}

	else if ( which == "products" )
	{
		/*swapImgRestore('main');

		if ( getFixedLayer() != "subNaviProductsLayer" )
		{
			hideLayers('subNaviProductsLayer');
			displayLayers(getFixedLayer());
		}*/
	}

	else if ( which == "it_management" )
	{
		/*swapImgRestore('main');

		if ( getFixedLayer() != "subNaviITManagementLayer" )
		{
			hideLayers('subNaviITManagementLayer');
			displayLayers(getFixedLayer());
		}*/
	}

	else if ( which == "support" )
	{
		/*swapImgRestore('main');

		if ( getFixedLayer() != "subNaviSupportLayer" )
		{
			hideLayers('subNaviSupportLayer');
			displayLayers(getFixedLayer());
		}*/
	}


	// 2. Hauptnavi Buttons
	else if ( which == "login" )
	{
		swapImgRestore('main');
	}	
	else if ( which == "contact" )
	{
		/*swapImgRestore('main');

		if ( getFixedLayer() != "subNaviContactLayer" )
		{
			hideLayers('subNaviContactLayer');
			displayLayers(getFixedLayer());
		}*/
	}	
	else if ( which == "sitemap" )
	{
		swapImgRestore('main');
	}




	// subnavi Profilfe buttons
	else if ( which == "philosophie" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "referenzen" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "partner" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "jobs" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "standorte" )
	{
		swapImgRestore('sub');
	}


	// subnavi Products buttons
	else if ( which == "hardware" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "software" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "security" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "network" )
	{
		swapImgRestore('sub');
	}


	// Subnavi IT Management Buttons
	else if ( which == "consulting" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "networkIT" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "security2" )
	{
		swapImgRestore('sub');
	}


	// Subnavi Support Buttons
	else if ( which == "news" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "newsLetter" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "newsArchive" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "itKuerzel" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "downloads" )
	{
		swapImgRestore('sub');
	}
	// Subnavi Support Buttons
	else if ( which == "infoSupport" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "email" )
	{
		swapImgRestore('sub');
	}
	else if ( which == "standort" )
	{
		swapImgRestore('sub');
	}


	
}