$(function(){
	var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
	if(ie7){
		$("#ulNavigation > li").hover(
			function(){
				$(this).find("ul:first").css("top", "38px");
				$(this).find("ul:first").css("background-color", "#679D2B");
				$(this).find("li a").css({"border":"0", "display":"block", "width":"100%"});
			},
			function(){
				$(this).find("ul:first").css("top", "-999px");
			}
		);
		
		$("#ulNavigation > li ul li").hover(
			function(){
				$(this).css("background-color", "#F6DF17");
				$(this).find("a").css("background-color", "#F6DF17");
			},
			function(){
				$(this).css("background-color", "#679D2B");
				$(this).find("a").css("background-color", "#679D2B");
			}
		);
	}
});

function rollTruck() {
    if (isScrolledIntoView('#imgFooterTrailer') == true) {
        $("#imgFooterTrailer").animate({
            left: "130px"
        }, 1500);        
    }
};

var resizeTimer = null;
$(window).bind('scroll', function() {
    if (resizeTimer) clearTimeout(resizeTimer);
    resizeTimer = setTimeout(rollTruck, 100);
});

function isScrolledIntoView(elem) {
    var docViewTop = $(window).scrollTop();
    var docViewBottom = docViewTop + $(window).height();

    var elemTop = $(elem).offset().top;
    var elemBottom = elemTop + $(elem).height();

    return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom));
}
