$(document).ready(function() {
	$('#slides').cycle({ 
		speed:   300, 
		timeout: 9000,
		fastOnEvent: 1,
        prev:   '#prev',
        next:   '#next',
		pager:  '#index'
	}); 

	/*
	$('#centerpiece img').bind("load", function (){
		$('#centerpiece')
			.css('visibility','visible')
			.hide()
			.fadeIn();
	});
	*/
	$("#search input")
		.addClass('prompt')
		.val('Search')
		.focus(function(){
			$("#search input.prompt")
				.val('')
				.removeClass('prompt')
		});

	//$("#right h2:gt(0)").css('margin-top', 25);

	if($(window).width()>480) {
		function menuFocus() {
			$(this).children('.submenu').fadeIn(120);
		}
		function menuBlur() {
			$(this).children('.submenu').fadeOut(420);
		}
		$("#main_menu ul li")
			.hover(menuFocus, menuBlur)
	}
	$(".main_menu ul li div a:last").css('border-right', 'none');

	/*
	$(".main_menu ul li.current_item div a").dropShadow({
		left:0,
		top:0,
		blur:5,
		opacity:0.45
	});
	*/

	$(".gallery a, .lightbox").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false
	});

	/*
	$(".gallery a").click(function() {
		var imageviewer = window.open('', 'imageviewer', 'width=655,height=550,resizable=yes,location=no,toolbar=no');
		imageviewer.document.open();
		imageviewer.document.write('<html><head><title>Photo</title></head><body style="font-family:arial">');
		imageviewer.document.write('<img src="'+($(this).attr('href'))+'" />');
		var caption = $(this).children('img').attr('alt');
		if (caption)
			imageviewer.document.write('<p>'+caption+'</p>');
		imageviewer.document.write('</body></html>');
		imageviewer.document.close();
		imageviewer.focus();
		return false;
	});
	*/

	$(".bio a").click(function() {
		$(this).parent().children('div').toggle();
		return false;
	});

	function handleInvestmentChoices() {
		if ($('[value="allocation"]').attr("checked")=="checked") {
			$('[name="vehicle_allocation"]').removeAttr('disabled');
		} else {
			$('[name="vehicle_allocation"]').attr('disabled','disabled').removeAttr('checked');
		}
		if ($('[value="own_allocation"]').attr("checked")=="checked") {
			$('[name^="own_allocation_"]').removeAttr('disabled');
		} else {
			$('[name^="own_allocation_"]').attr('disabled','disabled').val('');
		}
	}

	$('#investment_choices input').click(handleInvestmentChoices);
	handleInvestmentChoices();
});

