/*** onLoad ***/
$(document).ready(function()
{

/*** Images in Slideleiste zentrieren ***/
if ($.browser.msie)
{
  $(".slide img").each(function() 
  {
	var hoehe = (130 - $(this).height()) / 2;
	$(this).css("margin-top",hoehe);
  }); 
}

/*** Scrollfunktionen aktivieren ***/
$("#go_right").click(function()
{
	scroll_left();
}); 
$("#go_left").click(function()
{
	scroll_right();
}); 

/*** Submenus positionieren ***/
move_submenus();

/*** Breite der Unterpunkte anpassen ***/
$("div.sub_item").each(function()
{
	$(this).css("width",($(this).parents("div.submenu:first").width() - 32));
});



/*** Click-Event für Oberpunkte erzeugen ***/
$("div.submenu").each(function() 
{
	var name = $(this).attr("id");
	var nr = name.split("_");
	var menu = "#menu_" + nr[1];
	
	if (nr[1] != "5")
	{
		$(menu).click(function()
		{
			var name = $(this).attr("id");
			var nr = name.split("_");
			var submenu = "#submenu_" + nr[1];
			if (!$(submenu).is(":visible"))
			{
				$(".submenu").hide();
				$(submenu).show();
			}
			else
			{
				$(submenu).hide();
			}
		});
                
                $(menu + " a").click(function() {
                        $(this).parents("div:first").click();
                        return false;
                });
	}

if (nr[1] == "64") $(this).find("div.sub_item:last a:first").css("color","#CC4F17");
});



/*** Submenus verstecken ***/		
$(".submenu").hide();
$(".submenu").css("visibility","visible");

/*** Neues Positionieren der Submenus onResize ***/
$(window).resize(function()
{
	move_submenus();
});

if ( $.browser.msie && $.browser.version == '6.0' ) 
{
	$("div.sub_item a").hover(
	function()
	{
		$(this).parents("div.sub_item:first").css("background","url(img/unternavi_pfeil_over.gif) right center no-repeat #640D0E");
	},
	function()
	{
		$(this).parents("div.sub_item:first").css("background","transparent");
	});
}

/*** Link über ganze Breite der Submenü-Punkte ***/
$("div.sub_item").each(function()
{
	$(this).click(function()
	{
		var link = $(this).children("a:first").attr("href");
		window.location.href = link;
	});
});

if ($("div.overview").length > 0)
{
  $("div.model_overview img").hover(
  function()
  {
    $(this).parents("div.picture_overview:first").css("background","url(/en/wLayout/design/img/over_uebersicht.png) top center transparent");
  },
  function()
  {
    $(this).parents("div.picture_overview:first").css("background","none");
  });
  
  $("div.logo_overview img").hover(
  function()
  {
    $(this).parents("div.picture_overview:first").css("background","url(/en/wLayout/design/img/over_uebersicht.png) top center transparent");
  },
  function()
  {
    $(this).parents("div.picture_overview:first").css("background","none");
  });
}

});
/* Ende onLoad */