
$(document).ready(DOMLoaded);

/* do the font replacement
	*/
Cufon.replace('h1', {
	fontFamily: 'Avenir LT 45 Book'
});
Cufon.replace('h2', {
	fontFamily: 'Avenir LT 65 Medium'
});
Cufon.replace('strong', {
	fontFamily: 'Avenir LT 65 Medium'
});
Cufon.replace('#navigation a', {
	fontFamily: 'Avenir LT 65 Medium',
	hover: true
});

/* make the album thunbmails clickable
	*/
function enableAlbums () {
	$("a[rel='slideshow']").colorbox({
		slideshow: false,
		transition: "fade",
		slideshowSpeed: 5000,
		opacity: .5
	});
}

/* make the child rollovers fade
	*/
function makeChildRollOvers () {
	var selectors = [".Album", ".MultiPageAlternate", ".IndexedList", "#ID-1e888d"];
	for (var i=0; i<selectors.length; ++i) {
		var selector = selectors[i];
		$(selector + " .Children .Child .Graphic").css("opacity", 1);
		$(selector + " .Children .Child .Context").css("opacity", 0);
		$(selector + " .Children .Child .Context").each(function () {
//alert($(this).parent().html());
			var offset = (($(this).height()-$(this).parent().height())/2)*-1;
			$(this).css("top", offset);
		});
		$(selector + " .Children .Child").mouseenter(function () {
			$(".Graphic", this).fadeTo("fast", .33);
			$(".Context", this).fadeTo("fast", 100);
		});
		$(selector + " .Children .Child").mouseleave(function () {
			$(".Graphic", this).fadeTo("fast", 1);
			$(".Context", this).fadeTo("fast", 0);
		});
	}
}

/*
	this is the stuff for the homepage album viewer
	*/
function enableHome () {
	$('#ID-f4f41 .Children').cycle({
		fx: 'fade',
		sync:  true
	});
}

/*
	sugar functions
	*/
function DOMLoaded () {
	enableAlbums();
	makeChildRollOvers();
	enableHome();
}
