// JavaScript Document


$(document).ready(function()
{
	$("#navigation").css({'width': '1px', 'overflow': 'hidden'});
	$("#navigation").animate({'width': '257px'}, 900);
	
	//Anti-captcha
	$(".antiCaptcha").val("Valid");
	
	//Left navigation roll-overs
	$("#navigation a img").not(".noRoll").hover(function ()
	{
			
			$(this).attr('src', $(this).attr('src').replace("1.gif", "2.gif"));
	}, function() 
	{
			$(this).attr('src', $(this).attr('src').replace("2.gif", "1.gif"));
	});
	
	
	$("#request_info_form .submit_info_div input").hover(function()
	{
		$(this).attr('src', 'images/submit_infoB.gif');
	}, function()
	{
		$(this).attr('src', 'images/submit_infoA.gif');
	});


	$(".request_info_button").click(function()
	{
		$(".content").fadeOut('fast', function()
		{
			$(this).load("request_information.php", null, function()
			{
				$(this).fadeIn('normal');
				
				//Roll Over Button
				$("#request_info_form .submit_info_div input").hover(function()
				{
					$(this).attr('src', 'images/submit_infoB.gif');
				}, function()
				{
					$(this).attr('src', 'images/submit_infoA.gif');
				});
	
				//Fill in hidden variable on form to show which page request was sent from
				$("#from_page").val($("h1:first").text());
				
				//Validate Request Info Form
				$("#request_info_form").submit(function ()
				{
					
					var everything = $("#email").val() + $("#phone").val() + $("#website").val();
					everything = everything.replace(/^\s+|\s+$/g, '');
					if(everything == "")
					{
						alert("You need to fill out the form to submit it!");
						return false;
					} else {
						return true;
					}
				});
			});
		});
	});

	$("#contact_form .submit_info_div input").hover(function()
	{
		$(this).attr('src', 'images/submit_infoB.gif');
	}, function()
	{
		$(this).attr('src', 'images/submit_infoA.gif');
	});
	
	//Validate Contact Form
	$("#contact_form").submit(function ()
	{
		
		var everything = $("#email").val() + $("#phone").val() + $("#website").val() + $("#message").val();
		everything = everything.replace(/^\s+|\s+$/g, '');
		if(everything == "")
		{
			alert("You need to fill out the form to submit it!");
			return false;
		} else {
			return true;
		}
	});
	
	//Validate Free Evaluation Form
	$("#request_info_form").submit(function ()
	{
		
		var everything = $("#email").val() + $("#phone").val() + $("#website").val();
		everything = everything.replace(/^\s+|\s+$/g, '');
		if(everything == "")
		{
			alert("You need to fill out the form to submit it!");
			return false;
		} else {
			return true;
		}
	});



});