function mainmenu(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
} // This function makes the drop down menu more eye-catching and adds a sliding animation.
	
function slide(what){
	$("#switch").fadeOut();
	var slideimg = $(what).children("img");
	$(slideimg).css({top: "0px"});
	var height = $(slideimg).height();
	var scrollto = height-275;
	$(slideimg).animate({top: "-" + scrollto +"px"},18000,function(){ // Change 18000 for the duration of the slide. You may need to increase it or decrease it if your slide images are bigger or smaller.
	$("#switch").fadeIn();
	});
}// This is the initialising function for the portfolio slider on the homepage 

 $(document).ready(function(){
	mainmenu();

	$("#switch a").click(function(){
		var chosenSlide = $(this).attr("href");
		$("#slider img").stop().css({top: "0px"});
		
		var s_index = chosenSlide.split("slide");
		
			$("#slider").scrollTop(positions[''+s_index[1]-1+'']);
		slide(chosenSlide);
		return false;
	});
	$("#switch").hide();
	$("#portfolio").hover(function(){
		$("#switch").fadeIn("fast");
	},function(){
		$("#switch").fadeOut("fast");
	});
	
	$(".portfolio-item").hover(function(){
		$(this).children("a").children("span").fadeIn("fast");
	},function(){
		$(this).children("a").children("span").fadeOut("fast");
	});
	
	
});