
// start slider

$(document).ready(function() {
	$('#coda-slider-1').codaSlider();
});


// prepend the span tag to the photo gallery
$(function() {
	$(".gallery a, a.productImages").prepend("<span></span>");
});

// send the email
      // let's start the jQuery while I wait.
      // step 1: onload - capture the submit event on the form.
      $(function() { // onload...do
        $('#form').submit(function() {
          // now we're going to capture *all* the fields in the
          // form and submit it via ajax.
          
          // :input is a macro that grabs all input types, select boxes
          // textarea, etc.  Then I'm using the context of the form from 
          // the initial '#contactForm' to narrow down our selector
          var inputs = [];
          $(':input', this).each(function() {
            inputs.push(this.name + '=' + escape(this.value));
          })
          
          // now if I join our inputs using '&' we'll have a query string
          jQuery.ajax({
            data: inputs.join('&'),
            url: this.action,
            timeout: 2000,
            error: function() {
              console.log("Failed to submit");
            },
            success: function(r) { 
           if (r == 1) {
			   
			   $('form').slideUp('slow');
			   $('p#please').slideUp('slow');
			$("h1").after('<p id="success" style="display:none;">Your message was sent successfully! We will contact you as soon as possible. </p>');
	$('#success').slideDown('slow');
		   }
		   else {
			   alert(r)
		   }
				   
			 
			  
            }
          }) // checkout http://jquery.com/api for more syntax and options on this method.
          
          // re-test...
          // by default - we'll always return false so it doesn't redirect the user.
          return false;
        })
      })

