$(function(){
	var jImaxContentSwitcher = $("#content .content-switcher");
	
	$("li:not(.selected) .d-cn", jImaxContentSwitcher).hide();
	
	$.eventBus.bind("imax-content-switch", function(event, data){
		$(".imax-content:visible")
		.add(".d-cn", data.items.not(".selected"))
			[jQuery.support.opacity ? "fadeOut" : "hide"](jQuery.support.opacity ? 750 : null);
		
		$(".imax-" + data.new_value)
		.add(".d-cn", data.selected_item)
			[jQuery.support.opacity ? "fadeIn" : "show"](jQuery.support.opacity ? 750 : null);
	});
	
	var oImaxContentSwitcher = new SimpleSwitcher({
		jContainer: jImaxContentSwitcher,
		type: "imax-content",
		data: {
			items: true,
			selected_item: true
		},
		location_hash: true
	});
	

	var jCalibrationButton = $(".calibration .d-button");
	var jjCalibrationImages = $(".calibration .img img");
	
	jjCalibrationImages.css("opacity", 0.7);

	jCalibrationButton.click(function(){
		jjCalibrationImages.animate( { marginLeft: 0, marginTop: 0 }, 750, function(){
			jCalibrationButton.hide();
			$(".calibration .calibrated").removeClass("hidden");
		});
	});
});
