$(function() {
  $('input.input').css({backgroundColor:"#FFFFFF"});
  $('input.input').focus(function(){
    $(this).css({backgroundColor:"#FFDDAA"});
  });
  $('input.input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });

	// registration ajax procedure
  $("input#quote").click(function() {
		// validate and process form
		// first hide any error messages
		
	var name = $("input#name").val();
	if (name == "") { $("input#name").focus(); return false; }

	var street = $("input#street").val();
	if (street == "") { $("input#street").focus(); return false; }
    
	var job = $("input#job").val();
	if (job == "") { $("input#job").focus(); return false; }
    
    var city = $("input#city").val();
	if (city == "") { $("input#city").focus(); return false; }    

	var company = $("input#company").val();
	if (company == "") { $("input#company").focus(); return false; }
	
	var state = $("input#state").val();
	if (state == "") { $("input#state").focus(); return false; }

	var phone = $("input#phone").val();
	if (phone == "") { $("input#phone").focus(); return false; }

	var country = $("input#country").val();
	if (country == "") { $("input#country").focus(); return false; }

	var email = $("input#email").val();
	if (email == "") { $("input#email").focus(); return false; }
	
	var zip = $("input#zip").val();
	if (zip == "") { $("input#zip").focus(); return false; }
	
	var product = $("input#product").val();
	if (product == "") { $("input#product").focus(); return false; }
	
	var comments = $("textarea#comments").val();

	var dataString = 'name='+ name + '&company='+ company + '&street='+ street + '&email=' + email + '&phone=' + phone + '&city=' + city + '&job=' + job + '&state=' + state + '&zip=' + zip + '&country=' + country + '&product=' + product + '&comment=' + comments;

	$.ajax({
      type: "POST",
      url: "quote.php",
      data: dataString,
      success: function(r) {
	    $('#contact_form').html("<div id='message'></div>");  
	    $('#message').html("<h2><font color='black'>Thank you for your submission.</font></h2>")  
	    .append(r)  
	    .hide()  
	    .fadeIn(1500, function(){}); 
      }
     });
    return false;
	});
	
	
		// forgot password screen
  $("a#forgotform").click(function() {

	    $('#contact_form').html("<div id='message'></div>");  
	    $('#message').html('<form name="form1" method="post" action="" id="contact">\
<table border="0" cellpadding="0" cellspacing="0" summary="content" class="t5">\
<tr valign="top">\
<td width="299">\
<font color="black">Name:</font><br /><input name="Name" class="input" id="Name" /><br />\
<font color="black">E-mail Address:</font><br /><input name="Email" class="input" id="Email" /><br />\
<font color="black">Phone:</font><br /><input name="Phone" class="input" id="Phone" /><br />\
<input type="button" name="submit" value="Submit" id="forgot" class="but">\
<input type="reset" name="reset" value="Start Over" class="but">\
</td>\
<td width="7">&nbsp;</td>\
<td width="299"><font color="black">Comments &amp; Questions:</font><br />\
<textarea name="Message" class="txtar" id="Message"></textarea><br />\
</td></tr>\
</table></form>')  
	      
		    .hide()  
		    .fadeIn(1500, function(){}); 
			
			// passsword request procedure
		  $("input#forgot").click(function() {
				// validate and process form
				// first hide any error messages
				
			var name = $("input#Name").val();
			if (name == "") { $("input#Name").focus(); return false; }
		
			var email = $("input#Email").val();
			if (email == "") { $("input#Email").focus(); return false; }
		
			var phone = $("input#Phone").val();
			if (phone == "") { $("input#Phone").focus(); return false; }
				
			var comments = $("textarea#Message").val();
		
			var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&comment=' + comments + '&forgot=forgot';
		
			$.ajax({
		      type: "POST",
		      url: "quote.php",
		      data: dataString,
		      success: function(r) {
			    $('#contact_form').html("<div id='message'></div>");  
			    $('#message').html("<h2><font color='black'>Thank you for your submission.</font></h2>")  
			    .append(r)  
			    .hide()  
			    .fadeIn(1500, function(){}); 
		      }
		     });
		    return false;
			});

	});
	
	
		
});

