jQuery( function($) {
		// on DOM load:
	
		// Superfish menu code
		$("ul.sf-menu").superfish({
									animation:   {opacity:'show',height:'show'},
									disableHI: 'true'
								}); 
		
		// min-height:
		var main = $('#main');
		if (main.height() < 500) {
			main.height('500px');	
		}
		
		
		/////////// PORTFOLIO ////////////
		
		// Takes a jQuery object which is the image to show.
		function showPortfolioImage( jqueryImage ) {
			jqueryImage.css('zIndex', 2).siblings().css('zIndex', 1);
		}
		
		
		$("a.portfolio-rollover").each( function() {
			var postID = $(this).attr('post'),
				img = $('img[post=' + postID + ']'),
				fancyboxLink = $('a.fancybox[post=' + postID + ']');
				
			if (img.length) {
				$(this).data('img', img);	
			}
			
			if (fancyboxLink.length) {
				$(this).data('fancyboxLink', fancyboxLink);	
			}			
		}).mouseover( function() {
			var img = $(this).data('img');
			
			if (img) {
				showPortfolioImage(img);
			}
		}).click(function(e) {
			var fancyboxLink = $(this).data('fancyboxLink');
			
			if (fancyboxLink) {
				e.preventDefault();
				fancyboxLink.click();
			}		
		});
		
		
		
		
	});
