jQuery(document).ready(
	function() {
	    $("#bigGreyBar li:last").css({ 'border-right': 'none' });
	    $("#bigGreyBar li:first").css({ 'border-left': 'none' });

	    var panel = $("#pullOut");
	    var high = $("#highlight");
	    $(".menuItem").hover(function() {
	        var mens = $(".menuItem");
	        for (var i = 0; i != mens.length; i++) {
	            if (mens[i] == this) {

	            } else {
	                $(mens[i]).find('ul').stop(true, true);
	                $(mens[i]).find('ul').slideUp(300);
	            }
	        }
	        $(".menuItem").css({ 'backgroundPosition': '0px 0px' });
	        var myPos = $(this).position();
	        var myWidth = $(this).width();
	        myWidth = ($(high).width() / 2) - Math.round(myWidth / 2);
	        high.stop(true, true);
	        $(this).css({ 'backgroundPosition': '0px -18px' });
	        high.animate({ "top": myPos.top - 30, "left": myPos.left - (myWidth) }, 300);
	        panel.stop(true, true);
	        panel.slideDown(600);
	        $(this).find('.mainMenuInt').slideDown(600);

	    },
		function() {
		});

	    $(".content, #content, #homeContent").hover(function() {
	        panel.stop(true, true);
	        panel.slideUp(300);
	        $(".mainMenuInt").stop(true, true);
	        $(".mainMenuInt").slideUp(300);
	    }, function() { });

	    $(".mainMenuInt li").hover(function() {
	        $(this).find("ul").slideDown('fast');
	    }, function() {
	        $(this).find("ul").slideUp('fast');
	    });

//	    $("#bigGreyBar li:first, li:last").hover(function() {
//	        $(this).stop(true);
//	        $(this).animate({ backgroundPosition: "0px 0px" }, 300);
//	    },
//		function() {
//		    $(this).stop(true);
//		    $(this).animate({ backgroundPosition: "300px 0px" }, 300);
//		});

	    var items = $('#projects ul').find("li");
	    $(items[0]).css({ 'display': 'block' });
	    var count = 0;
	    $(items[count]).animate({ left: 0 }, 500);

	    $("#projects #next").click(function() {
	        $(items[count]).stop(true);
	        $(items[count]).animate({
	            left: 1 - ($(document).width())
	        });
	        count++;
	        if (count > (items.length - 1)) count = 0;
	        $(items[count]).css({
	            'left': $(document).width(), 'display': 'block'
	        });
	        $(items[count]).animate({
	            left: 0

	        }, 500);
	    });

	    $("#projects #prev").click(function() {
	        $(items[count]).stop(true);
	        $(items[count]).animate({
	            left: $(document).width()

	        });
	        count--;
	        if (count < 0) count = (items.length - 1);
	        $(items[count]).css({
	            'left': 1 - ($(document).width()), 'display': 'block'
	        });
	        $(items[count]).animate({
	            left: 0
	        }, 500);
	    });

	}
);
