$(document).ready(function(){

	// Replace header with flash (if supported, does nothing w/o flash support)
	var base_url = $('base').attr('href');
		
	$('#header_logo').flash({
        'src':'images/header/header_logo.swf',
        'width':'1000',
        'height':'70',
		'wmode':'transparent',
		'flashvars': {'base_url': base_url}
	}); 

	// Check for svg support, requires modernizr.js
	if (Modernizr.svg){
		// if Modernizr.svg returns true, do nothing
	} else {
		// if Modernizr.svg fails, replace all svg's with png's
		$('img[src$=".svg"]').each(function() {
			$(this).attr("src", $(this).attr("src").split(".svg").join(".png"));
		});
	}
	
	// Preload navigational buttons to improve hover performance, requires 	
	$('#footer img, #header img').imgpreload
	({
		each: function()
		{
			var hvr_img = $(this).attr('src').split("btn_").join("btn_hvr_");
			$.imgpreload(hvr_img);
		}
	});
	
	// button hover actions for header and footer
	$('#footer a img, #header a img, #sign_guestbook').hover(function() {
		$(this).attr("src", $(this).attr("src").split("btn_").join("btn_hvr_"));
	}, function() {
		$(this).attr("src", $(this).attr("src").split("hvr_").join(""));
	});

	// set background for album hover
	$('.album_cover').css("background", function() {
		var hvr_img = $(this).find('img').attr("src").split("cvr_").join("cvr_hvr_");
		return "url("+hvr_img+") no-repeat";
	});
	
	// hover for album covers, stop() prevents queue build up
	$('.album_cover a img').hover(function() {
		$(this).stop().animate({opacity: [0, 'swing']}, 600);
	}, function() {
		$(this).stop().animate({opacity: [1, 'swing']}, 600);
	});

});

