function mainmenu() {
	$("#nav li a").hover(function(){
		$(this).find('ul:first:hidden').show().fadeTo(200,1.0);
	},function(){
		$(this).find('ul:first').fadeTo(200,0.0).hide();
	});
}

$(document).ready(function() {
	//$(" #nav ul ").css({display: "none"}); // Opera Fix				
	//mainmenu();

	function projectImage() {
		var IMAGE_WIDTH = 520;
		var IMAGE_HEIGHT = 384;
		
		$('#project-image-wrapper').css({opacity: "0"});	// hide the image viewer
	
		// setup the project image controller, which is empty on load
		var numImages = $("#project-image ul li").length;
	
		// set up the image controller and image links
		var controllerString = "";
		for (var i = 1; i <= numImages; i++) {
			controllerString += '<a href="#" id="' + i + '" class="button">' + i + '</a> | ';
			if (i == numImages) {
				controllerString +=  '<a href="#" id="btn-next" class="button">&gt;&gt;</a>';
			}
		}
		$('#project-image-controller').html(controllerString);
		$('#project-image-controller a:first').css({color: "#d4001b"});
		$('#project-image-controller a.button').click(function(event) {
			$(this).siblings('a').css({color: "#000"}); // set the other links to be black
			event.preventDefault();

			if ( $(this).attr("id") == "btn-next" ) {
				// get current offset
				var currOffset = $('#project-image ul').css("top").replace("px","");
				var currIndex = Math.ceil( -(currOffset/IMAGE_HEIGHT) + 1);
				if (currIndex == numImages) { var nextIndex = 1; } else { var nextIndex = currIndex+1; } //if at the end of the list, loop to 1
				var offset = -(nextIndex - 1)*IMAGE_HEIGHT;
//				alert("currOffset: " + currOffset + "\n currIndex: " + currIndex + "\n nextIndex: " + nextIndex + "\n offset: " + offset);
				$('#project-image-controller #' + nextIndex).css({color: "#d4001b"});
				$('#project-image ul').animate({top: offset}, 800, "easeOutQuart");
			} else {
				$(this).css({color: "#d4001b"});
				var offset = -($(this).attr("id") - 1)*IMAGE_HEIGHT;
				$('#project-image ul').animate({top: offset}, 800, "easeOutQuart");
			}
		});

		$('#project-image-wrapper').fadeTo(700,1.0); // fade in the image viewer
	};
	projectImage();


	function imageMatrix() {
		$('#image-matrix img').hover(
			function () {
				$(this).fadeTo(200,0.5);
			}, 
			function () {
				$(this).fadeTo(200,1.0);
			}
		);

	};
	imageMatrix();




/*		$('#project-thumbnails img').click(function(evt) {
			evt.preventDefault();
			$('#project-thumbnails img').not(this).fadeTo(500, 0.67).removeClass("active");
			$(this).fadeTo(500, 1.0).addClass("active");

			var thumbSrc = $(this).attr("src");
			var thumbAlt = $(this).attr("alt");
			if (!thumbAlt) { thumbAlt = " "; };
			var largeSrc = thumbSrc.replace("t.jpg", ".jpg");
			$('#project-image').fadeTo(500, 0, function() {
				$('#project-image').html('<img src="'+largeSrc+'" alt="'+thumbAlt+'" />');
				$('#project-image').fadeTo(500, 1.0);

			});
		});
*/

});







