$(document).ready(function() {
	$("a#donate").bind("click", function() {
		$("#donate_form").submit()
	});

	$("a#single_1").fancybox();
		
	$("a#single_2").fancybox({
		'zoomOpacity'			: true,
		'overlayShow'			: true,
		'overlayOpacity'		: 0.6,
		'zoomSpeedIn'			: 300,
		'zoomSpeedOut'			: 300
	});
	
	$("a#single_3").fancybox({
		'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack'
	});
	
	$("a.group").fancybox({
		'hideOnContentClick': false,
		'zoomOpacity'			: true,
		'overlayOpacity'		: 0.6,
		'overlayShow'			: true,
		'zoomSpeedIn'			: 300,
		'zoomSpeedOut'			: 300
	});
	
	// attach the onclick event to each anchor tag with a class of "div-toggle"
	$("a.div-toggle").click(function () {
	    // fade-in/out the element with the id of "my-div"
	    $("#main_content").fadeToggle();
   		$("#mailing_form").fadeToggle();
	    // return false to prevent the anchor tag from following the href rule
	    return false;
	});
	
	$("a.cancel").click(function () {
	    // fade-in/out the element with the id of "my-div"
	 	$("#mailing_form").hide();    
		$("#main_content").fadeToggle();
	    // return false to prevent the anchor tag from following the href rule
	    return false;
	});

});


$(document).ready(function() {
						   
	$('#music_details').wrap('<div id="content-wrapper"></div>');
						   
	function pageload(hash) {
		if(hash) {
			$("#content-wrapper").load(hash + ".html #music_details",'',function(){
				$('#content-wrapper').show('normal');
				$('#load').fadeOut('normal');												   
			});
		} else {
			$("#content-wrapper").load("index.html #music_details"); //default
		}
	}
	$.historyInit(pageload);			   

	$('#music_links a').click(function(){
								  
		var hash = $(this).attr('href');
		hash = hash.replace(/^.*#/, '');
		hash = hash.substr(0,hash.length-5);

		$('#content-wrapper').hide('fast',function(){$.historyLoad(hash)});
		$('#load').remove();
		$('#wrapper').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		return false;
		
	});

});


// $(document).ready(function() {
// 	
// 	// $('#music_details').load('/path/to/foo.html');
// 	
//     // Check for hash value in URL
//     var hash = window.location.hash.substr(1);
//     var href = $('#cd_links a').each(function(){
//         var href = $(this).attr('href');
//         if(hash==href.substr(0,href.length-5)){
//             var toLoad = hash+'.html #music_details';
//             $('#music_details').load(toLoad)
//         } 
//     });
//     
//     $('#cd_links a').click(function(){
//     
//     var toLoad = $(this).attr('href')+' #music_details';
// 	$('#load').remove();
//     $('#music_details').slideUp(loadContent);
// 	$('#load').fadeIn('normal');
//     window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
//     function loadContent() {
//     	$('#music_details').load(toLoad,'',showNewContent())
//     }
//     function showNewContent() {
//     	$('#music_details').slideDown('normal',hideLoader());
//     }
//     function hideLoader() {
//     	$('#load').hide();
//     }
//     return false;
//     
//     });    
// });   
    
jQuery.fn.fadeToggle = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle'}, speed, easing, callback);
};







