// JavaScript Document

$(function() { 
		   
  $('a.lightsGal').zoomimage({
			centered: true
		});
		   
  $(".button").click(function() {   
    // validate and process form here 
	
	var name = $("input#name").val();  
	var email = $("input#email").val();  
	var comments = $("textarea#comments").val();
	
	var error = "none";
	
	if (name=="" || name=="who are you?") {
		$("input#name").val("who are you?");
		error = "yes";
	}
	
	if (comments=="" || comments=="what can i help you with?") {
		$("textarea#comments").val("what can i help you with?");
		error = "yes";
	}
	
	var dataString = 'name='+ name + '&email=' + email + '&comments=' + comments;  

	error = "none";
	
	var emailRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;
		
	if(emailRegExp.test(email)){ 
		$.ajax({  
		  type: "POST",  
		  url: "scripts/process.php",  
		  data: dataString,  
		  success: function() {  
			$('#form').html("<div id='message'></div>");  
			$('#message').html("<h4>Thanks!</h4><p>I'll try to respond to all inquiries within 24 hours. My apologies if it takes any longer.</p><br /><p>Regards,<br /><br/><em>Matt</em> -- \\m/_(>.<)_\\m/<p>")   
			.hide()  
			.fadeIn(500, function() {  
			});  
		  }  
		}); 
		
		return false;
		
	}
	else {
		$("input#email").val("oh no! invalid email!");
		return false;
	} 
	
  }); 
		
	$(".details").click(function(){
								 
	  var panel = $(this).attr("id");
	  
	  if(panel == "jesse") {
		  
	  	$("#jessebutts").slideToggle("fast");
	  
	  }
	  
	  if(panel == "erin") {
		  
	  	$("#eringallo").slideToggle("fast");
	  
	  }
	  
	  if(panel == "spring") {
		  
	  	$("#springcm").slideToggle("fast");
	  
	  }
	  
	  if(panel == "bill") {
		  
	  	$("#billwitte").slideToggle("fast");
	  
	  }
	  
	  
	});
	
	$(".panel").click(function(){
								 
	  var panel = $(this).slideToggle("fast");
	  
	});
	
	
});  