$(function() {
	$('.error').hide();
	$('input.text-input').css({backgroundColor:"#FFFFFF"});
	$('input.text-input').focus(function(){
		$(this).css({backgroundColor:"#dee6f2"});
	});
	$('input.text-input').blur(function(){
		$(this).css({backgroundColor:"#FFFFFF"});
	});
	
	$(".button").click(function() {
		// validate and process form
		// first hide any error messages
		$('.error').hide();
		
		var name = $("input#name").val();
		if (name == "") {
			$("label#name_error").show();
			$("input#name").focus();
			return false;
		}
		var password = $("input#ourFundPass").val();
			if (password == "") {
			$("label#password_error").show();
			$("input#ourFundPass").focus();
			return false;
		}
		
		
		var dataString = 'name='+ name + '&ourFundPass=' + password;
		//alert (dataString);return false;
		
		$.ajax({
			type: "POST",
			url: "bin/process.htm",
			data: dataString,
			success: function() {
				$('#ourFundsForm').html("<div id='message'></div>");
				$('#message').html("<p class='noBorder'><strong>We are unable to process your request at this time,</strong><br />please try again later. If this issue persists, please <a href='../contact-us/index.htm' class='learnMore'>contact us &nbsp;&nbsp;&nbsp;</a></p>")
				.hide()
				.fadeIn(1500, function() {
					$('#message').append("");
				});
			}
		});
		return false;
	});
});
runOnLoad(function(){
	$("input#name").select().focus();
});
