var tmp_timestamp_scroll;
$(function() {
    $(window).scroll(function(){
        var time = new Date();
        tmp_timestamp_scroll = time.getTime();
        setTimeout('scroll_event('+time.getTime()+')',300);
    });
    
    $("#headnav").append('<li id="overlap"></li>');
    if ($("#headnav a.rex-current").length > 0){
        $("#overlap")
            .width($("#headnav a.rex-current").width())
            .height($("#nav").height())
            .css("left", $("#headnav a.rex-current").position().left)
            .data("origLeft", ($("#headnav a.rex-current").position().left))
            .data("origWidth", $("#headnav a.rex-current").parent().width())
            .data("origColor", $("#headnav a.rex-current").attr("rel"));
    }
    else{
        $("#overlap")
            .width(0)
            .height($("#nav").height())
            .css("left", 0)
            .data("origLeft", 0)
            .data("origWidth", 0)
            .data("origColor", "transparent");
    }
    
    $("#headnav a").hover(function() {
        $(this).css('backgroundColor', "transparent");
        $("#headnav a.rex-current").css("color", "#000000");
        
        $("#overlap").stop().animate({
            left: ($(this).position().left),
            width: $(this).parent().width(),
            backgroundColor: $(this).attr("rel")
        });
    }, function() {
        $("#overlap").stop().animate({
            left: $("#overlap").data("origLeft"),
            width: $("#overlap").data("origWidth"),
            backgroundColor: $("#overlap").data("origColor")
        });
        $("#headnav a.rex-current").css("color", "#ffffff");
    });
    $("#headnav a.rex-current").mouseenter().css("color", "#ffffff");
	
	$('#quality li, #qualitystart li').fadeTo('slow', 0.30);
	$('#quality li, #qualitystart li').hover(function() {
		$(this).fadeTo(500, 1.00);
	  }, function(){
		$(this).fadeTo(500, 0.30);  
	  });

	$("tbody tr:odd, .maschinenartikel p:odd, .maschinen-neu-td:odd").addClass("odd");
	$("tbody tr, .maschinenartikel p, .maschinen-neu-td").hover(function(){
		$(this).addClass("over");
	}, function(){
		$(this).removeClass("over");
	});
		$("p.maschinen-neu-td span").click(function(){
			window.location = $(this).parent().find("span a").attr("href");
			 return false;
		});
		$("p.maschinen-neu-td span").css("cursor", "pointer");
	$("a[href^='\#']").click(function(e){
	  e.preventDefault();
	  document.location.hash=this.href.substr(this.href.indexOf('#')+1);
	})
});


function scroll_event(ts){
    if(ts == tmp_timestamp_scroll){
        $('#col1, #col2').stop().animate({'margin-top':(($(window).scrollTop() <= 151) ? 0 : $(window).scrollTop()-144)},1000);
    }
}
document.write('<style>.noscript { display: none; }</style>');
