/*@cc_on
(function(f){
 window.setTimeout =f(window.setTimeout);
 window.setInterval =f(window.setInterval);
})(function(f){return function(c,t){var a=[].slice.call(arguments,2);return f(function(){c.apply(this,a)},t)}});
@*/

function ie_67()
{
 if ($.browser.msie && ($.browser.version.substr(0, 1)=='6' | $.browser.version.substr(0, 1)=='7')) result = true; else result = false;
 return result;
}

function ie_6()
{
 if ($.browser.msie && $.browser.version.substr(0, 1)=='6') result = true; else result = false;
 return result;
}

$(document).ready(function(){
 if (!ie_6()) $("#n-menu table div").each(function () {$(this).append('<span style="display:block; background:url(\'images/shadow_bottom.png\'); height:11px;"></span>');});
 $("#n-menu table div table tr").each(function () {
  $(this).append('<td style="width:10px; padding:0px; overflow:hidden;">' + (ie_6() ? '' : '<div class="right-shadow-top"></div><div class="right-shadow-bottom"></div>') + '</td>');
 });

 $("#n-menu table td:last-child").prev().find("div table tr td:last-child .right-shadow-top").css("display", "none");
 $("#n-menu table td:last-child").prev().find("div table tr td:last-child .right-shadow-bottom").css("marginTop", "0");

 $("#n-menu > table > tbody > tr > td > div").css({"width": $("#n-menu").width() + "px"});
 
 $("#n-menu > table > tbody > tr > td > div").css("left", $.browser.mozilla ? $("#n-menu").position().left : 0 + "px");
 $("#n-menu > table:first-child > tbody > tr > td").css({"height": "58px"});
 

 $("#n-menu > table > tbody > tr > td > div").each(function() {$(this).find("table td:not(:last-child)").css("backgroundColor", $(this).parent().find("a").css("color"));$(this).find("table").css("width", $(this).width() - 10 + "px");});
 $("#n-menu > table").css("width", $("#n-menu").width() + "px");

 $("#n-menu > table > tbody > tr > td").css("padding","0px 5px");
 $("#n-menu > table > tbody > tr > td:first-child").addClass("first");
 $("#n-menu > table > tbody > tr > td:last-child").prev().addClass("last");
 
 
 //$("#n-menu table div table td a:first-child").css({"fontSize": "15px", "fontWeight": "bold", "marginBottom": "15px"});
 $("#n-menu table div table td a.category").css({"fontSize": "15px", "fontWeight": "bold", "marginBottom": "15px"});
 
 $("#n-menu table div table td a").each(function () {$(this).append("<br>");});
 $("#n-menu table div table td a.category").each(function () {$(this).append("<br>");});
 
 
 setTimeout(function() {
  $("#n-menu table td div table tr td:last-child").each(function() {
  $(this).find(".right-shadow-bottom").css("height", ($(this).height() - ($(this).find(".right-shadow-top").css("display")=="none" ? 0 : 54) ) + "px");
  
  setTimeout(function() {
  $("#n-menu > table > tbody > tr > td > div").css("display","none"); 
  $("#n-menu > table:first-child > tbody > tr > td > div").css("marginTop", (ie_67() ? 54 : ($.browser.webkit || $.browser.opera || $.browser.mozilla || ($.browser.msie && $.browser.version.substr(0, 1)=='8') ? 28 : ($.browser.msie && $.browser.version.substr(0, 1)=='9' ? 31 : 30))) + "px");
  $("#n-menu > table:last-child > tbody > tr > td > div").css("marginTop", ie_67() ? "29px" : ($.browser.msie && $.browser.version.substr(0, 1)=='9' ? "6px" : "3px"));
  }, 5);
 });
 }, 400);
 
 
 
 $("#n-menu table div table td a").hover(
  function() {$(this).css({"color": $(this).parent().parent().parent().parent().parent().parent().css("backgroundColor"), "backgroundColor": "#fff"});},
  function() {$(this).css({"backgroundColor": $(this).parent().parent().parent().parent().css("backgroundColor"), "color": "#fff"});});
  
 $("#n-menu > table > tbody > tr > td").hover(
 function() {
  if ($(this).css("backgroundColor")=="transparent" || $(this).css("backgroundColor")=='rgba(0, 0, 0, 0)')
   {
    f = window.setTimeout(function(obj) {
     obj.find(" > div").css("display","block");
     obj.addClass("active");
     obj.css("backgroundColor", obj.find("a").css("color")) ;
     if (!ie_6()) obj.next().css({"backgroundImage": "url('images/little_shadow.png')", "backgroundRepeat": "no-repeat"});
     obj.find("a").css("color","#fff");
     window.setTimeout(function(ff) {ff.parent().parent().parent().css("zIndex","3");}, 50, obj);
    }, 400, $(this));
   } else clearTimeout(h);
 },
 function() {
  if ($(this).css("backgroundColor")!="transparent" && $(this).css("backgroundColor")!='rgba(0, 0, 0, 0)')
   {
    h = window.setTimeout(function(obj) {
     obj.find(" > div").css("display","none");
     obj.removeClass("active");
     obj.find("a").css("color", obj.css("backgroundColor"));
     obj.css("background", "transparent") ;
     obj.next().css({"background": "transparent"});
     
     $("#n-menu > table:first-child").css("zIndex", "1");
     $("#n-menu > table:last-child").css("zIndex", "2");
     
    }, 200, $(this));
   }
   else clearTimeout(f);
 });
});


$(document).ready( function() {
	// Wir muesse die Funktion an den Link binden, da 
	// die Listen untereinander verschachtelt sind
	$('#categorynav li li > a').bind('mouseover', function() {
		$(this).parent("li").each(function(i) {
			$(this).addClass("activemo");
		});	
	});
	
	$('#categorynav li li > a').bind('mouseout', function() {
		$(this).parent("li.activemo").each(function(i){
            $(this).removeClass("activemo");
        });
	});
	
	// Navigation account
	$('#accountnav li > a').bind('mouseover', function() {
		$(this).parent("li").each(function(i) {
			$(this).addClass("activemo");
		});	
	});
	
	$('#accountnav li > a').bind('mouseout', function() {
		$(this).parent("li.activemo").each(function(i){
            $(this).removeClass("activemo");
        });
	});
});
