/********************************************
*
*  Copyright: emion interaktive medien GmbH
*  http://www.emion.de | info@emion.de
*  mschmidt@20080611 1204
*
*********************************************/

$(document).ready(function(){

	$("#seh").mouseover(function() { $("#se").css("background","#f5f5f5"); } );
	$("#seh").mouseout(function() { $("#se").css("background","#fff"); } );
	$("#se").mouseover(function() {	$("#se").css("background","#f5f5f5"); } );
	$("#se").mouseout(function() { $("#se").css("background","#fff"); } );
	
	$("#rr input").focus(function() { $(this).css("border","1px solid #cf1717"); } );
	$("#rr input").blur(function() { $(this).css("border","1px solid #bfbfbf"); } );
	$("#rr button").mouseover(function() { $(this).css("color","#cf1717"); } );
	$("#rr button").mouseout(function() { $(this).css("color","#666"); } );
	$("#rr button").focus(function() { $(this).css("color","#cf1717"); } );
	$("#rr button").blur(function() { $(this).css("color","#666"); } );
	
	$("#loginform input").focus(function() { $(this).css("border","1px solid #cf1717"); } );
	$("#loginform input").blur(function() { $(this).css("border","1px solid #bfbfbf"); } );
	$("#loginform button").mouseover(function() { $(this).css("color","#cf1717"); } );
	$("#loginform button").mouseout(function() { $(this).css("color","#666"); } );
	$("#loginform button").focus(function() { $(this).css("color","#cf1717"); } );
	$("#loginform button").blur(function() { $(this).css("color","#666"); } );
	
	});
	

var navigaktiv, navigtimer;

function navig(button,subnavig)
	{
	var subnavig = document.getElementById(subnavig);
	var button = document.getElementById(button);

	if((button == 0) || (subnavig == 0)) { return; }
	
	button.onmouseover = function()
		{
		$(button).css("background","#cf1717").css("color","#fff");
		if(navigaktiv)
			{
			navigaktiv.style.display = 'none';			
			}
		this.aktiv();
	
		if(navigtimer == 0) { return; }
	
		clearTimeout(navigtimer);
		}
		
	button.onmouseout = function()
		{
		$(button).css("background","#fff").css("color","#cf1717");
		navigtimer = setTimeout('verstecken()',100);
		}
		
	button.onclick = button.onfocus = function()
		{
		if(navigaktiv == 0)
			{
			this.aktiv();
			}
		else
			{
			navigaktiv.style.display = 'none';
			navigaktiv = 0;
			}
		}
		
	button.aktiv = function()
		{
		var pos = position(this);
		subnavig.style.left = pos.left - 1 + 'px';
		subnavig.style.top = pos.top + this.offsetHeight + 'px';
		subnavig.style.display = "inline";
		navigaktiv = subnavig;
		}
		

	subnavig.onmouseover = function()
		{
		$(button).css("background","#cf1717").css("color","#fff");
		if(navigtimer == 0)	{ return; }
		clearTimeout(navigtimer);
		}

	subnavig.onmouseout = function()
		{
		$(button).css("background","#fff").css("color","#cf1717")
		navigtimer = setTimeout('verstecken()',100);
		}
	}


function verstecken()
	{
	if(navigaktiv)
		{
		navigaktiv.style.display = 'none';
		}
	}

function position(element)
	{
	var left = 0;
	var top = 0;
	while(element != null)
		{
		left += element.offsetLeft;
		top  += element.offsetTop;
		element = element.offsetParent;
		}
	return {left:left,top:top}
	}


$(document).ready(function(){
	if($("#unternehmen").length > 0)  { navig("unternehmen","nav_unternehmen"); }
	if($("#produkte").length > 0)  { navig("produkte","nav_produkte"); }
	if($("#kundenbereich").length > 0)  { navig("kundenbereich","nav_kundenbereich"); }
	if($("#kontakt").length > 0)  { navig("kontakt","nav_kontakt"); }
	
	if($("#company").length > 0)  { navig("company","nav_unternehmen"); }
	if($("#products").length > 0)  { navig("products","nav_produkte"); }
	if($("#customer-section").length > 0)  { navig("customer-section","nav_kundenbereich"); }
	if($("#contact").length > 0)  { navig("contact","nav_kontakt"); }
	});