$(document).ready(function() {

	// Uniform Forms!!
	$("select:not('.no-script'), input:submit:not('.no-script'), input:text:not('.no-script'), input:password, input:checkbox, input:radio, input:file, textarea").uniform();
	$('.dropdown_link').change( dropdown_links );
	$('#new_investment_sheet_form').submit( new_investment_sheet );
	
	/*$(".science-vid").fancybox({
		'autoDimensions' : 'FALSE',
		'width'  : '700',
		'height' : '394'		
	});
	
	$(".art-vid").fancybox({
		'autoDimensions' : 'FALSE',
		'width'  : '700',
		'height' : '394'		
	});
	
	$(".risk-vid").fancybox({
		'autoDimensions' : 'FALSE',
		'width'  : '700',
		'height' : '394'		
	});*/
	
	$('a[target=_blank]').click(
		function()
		{
			return confirm("You are leaving the RiverFront website, is this ok?");
		}
	);
});


function new_investment_sheet()
{
	var target_action = $('#new_investment_sheet_offering option:selected').attr('value');

	if(target_action && target_action != '')
	{
		if($('#new_investment_sheet_offering_amount').val() && $('#new_investment_sheet_offering_amount').val() > 0)
		{
			$(this).attr('action', target_action);
			return true;			
		}	
		else
		{
			$("#new_investment_sheet_offering_amount_error").show().fadeOut(1000);
		}
	}
	else
	{
		$("#new_investment_sheet_offering_error").show().fadeOut(1000);
	}
	
	return false;
}

function dropdown_links()
{
	var redirect 	= $('option:selected', this).attr('value');
	var target 		= $('option:selected', this).attr('target');
	if(redirect != '')
	{
		if(target == '_blank')
		{
			if(confirm("You are leaving the RiverFront website, is this ok?") == true)
			{
				//window.open(redirect);
				window.location = redirect;
			}
		}
		else
		{
			window.location = redirect;
		}
		
	}
}
