$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto();/*remeber this for prettyPhoto - GREG!*/					   
	$('#image_slider').cycle({ fx:'scrollLeft', easing: 'easeInOutExpo', speed:800, timeout:4000, pause:1});
   //submission scripts
  $('.contactForm').submit( function(){
		//statements to validate the form	
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var email = document.getElementById('e-mail');
		if (!filter.test(email.value)) {
			$('.email-missing').show({duration:1500, easing:'easeOutElastic'});
		} else {$('.email-missing').hide();}
		if (document.cform.name.value == "") {
			$('.name-missing').show({duration:1500, easing:'easeOutElastic'});
		} else {$('.name-missing').hide();}	
		if (document.cform.message.value == "") {
			$('.message-missing').show({duration:1500, easing:'easeOutElastic'});
		} else {$('.message-missing').hide();}		
		if ((document.cform.name.value == "") || (!filter.test(email.value)) || (document.cform.message.value == "")){
			return false;
		} 
		
		if ((document.cform.name.value != "") && (filter.test(email.value)) && (document.cform.message.value != "")) {
			//hide the form
			/*setTimeout('$(".contactForm").slideUp("slow")', 1000);*/
		
			//show the loading bar
			$('.loader').append($('.bar'));
			$('.bar').css({display:'block'});
		
			//send the ajax request
			$.post('mail.php',{name:$('#name').val(),
							  email:$('#e-mail').val(),
							  message:$('#message').val()},
		
			//return the data
			function(data){
			  //hide the graphic
			  $('.bar').css({display:'none'});
			  $('.loader').append(data);
			  $("#mail_response").slideDown("slow");
			});
			
			//waits 2000, then closes the form and fades out
			/*setTimeout('$("#mail_response").slideUp("slow")', 3000);*/
			setTimeout('$(".contactForm").slideUp("slow")', 2000);
			
			//stay on the page
			return false;
		} 
  });//END OF CONTACT FORM//  
});//END

$("#copy_right").click(function () { 
      $('html, body').animate({scrollTop:0}, 'slow'); 
    });

$(function(contactPhotos) {
  var photoGraphs = 'img.contact_photo';
  $(photoGraphs).hover(function() {
  $(this).css({'z-index' : '3'});
	  $(this).stop()
		.animate({
			marginTop: '0px',
			marginLeft: '-9px',
			width: '226px',
			height: '95px'
		},{queue:false, duration:300, easing:'easeOutSine'});
		imageHover();
	
	  }, function () {
  $(this).css({'z-index' : '2'}); 
	  $(this).stop()
		.animate({
			marginTop: '10px',
			marginLeft: '10px',
			width: '195px',
			height: '82px'
		},{queue:false, duration:700, easing:'easeOutBounce'});
		imageOut();
	});
});

$(function(homeNav) {
  var photoGraphs = '.home_centerNav_images';
  $(photoGraphs).hover(function() {
  $(this).css({'z-index' : '3'});
	  $(this).stop()
		.animate({
			marginTop: '-2px',
			marginLeft: '5px',
			width: '293px',
			height: '148px'
		},{queue:false, duration:300, easing:'easeOutSine'});
		imageHover();
	
	  }, function () {
  $(this).css({'z-index' : '2'}); 
	  $(this).stop()
		.animate({
			marginTop: '0',
			marginLeft: '13px',
			width: '278px',
			height: '141px'
		},{queue:false, duration:700, easing:'easeOutBounce'});
		imageOut();
	});
});
