jQuery.fn.fadeToggle = function(speed, easing, callback) {
        return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

function toggleContent(div) {
	//alert($('#sites').css('display'));
	$('#about').hide();
	$('#sites').hide();
	$('#media').hide();
	$('#movies').hide();
	$('#programs').hide();
	$('#contact').hide();
	$('#' + div + '').fadeToggle(); 
}

// preload first on window.load
$(window).bind('load', function() {
		var preload = new Array();
		$(".over").each(function() {
				s = $(this).attr("src").replace(/\.(.+)$/i, "-over.$1");
				preload.push(s)
					});
		var img = document.createElement('img');
		$(img).bind('load', function() {
				if(preload[0]) {
					this.src = preload.shift();
				}
			}).trigger('load');
	});

$(function() {
		$("img.over").hover(function() {
				$(this).attr("src", $(this).attr("src").split(".").join("-over."));
			}, function() {
				$(this).attr("src", $(this).attr("src").split("-over.").join("."));
			});
	});

function showCase(type, num) {
	$('#case').html("");
	$('#case').hide();
	$('#case').load('/ajax/case/' + type + '/' + num);
	$('#content').hide();
	$('#case').fadeIn("slow");
}

function closeCase(type) {
	$('#case').html("");
	$('#case').hide();
	$('#content').fadeIn("slow");
}

function showAbout() {
	$('#about').html("");
	$('#about').hide();
	$('#about').load('/ajax/about/');
	$('#content').hide();
	$('#about').fadeIn("slow");
}

function closeAbout() {
	$('#about').html("");
	$('#about').hide();
	$('#content').fadeIn("slow");
}
