/* Author: Jeffrey R. Gould

*/

// $('#slider').after('\
// <div id="frame">\
//     <div id="tl" class="ir" />\
//     <div id="tc" class="ir" />\
//     <div id="tr" class="ir" />\
//     <div id="cl" class="ir" />\
//     <div id="cr" class="ir" />\
//     <div id="bl" class="ir" />\
//     <div id="bc" class="ir" />\
//     <div id="br" class="ir" />\
//  </div>\
// ');

$('#slider').cycle({
  prev: '#left-arrow',
  next: '#right-arrow',
  timeout: 15000,
  pause: 1,
  speed: 1000,
  fx: 'scrollHorz'
});

$('#slider article').hover(function(){
  $this = $(this);
  $this.find('div.info').stop().animate({
    top:0
  }, 1000);
}, function(){
  $this = $(this);
  $this.find('div.info').stop().animate({
    top:210
  }, 1000);
})


var contactForm = jQuery("#contact-form form").validate({
			submitHandler: function(form) {
				jQuery(form).ajaxSubmit({
				  beforeSubmit: function(arr, $form, options){
				    $('#contact-form form').hide();
				    $('#contact-form').append('<div id="loading"/>');
				  },
					success: function(response, status, xhr){
					  if(response.status == "success"){
					    $('#contact-form').append('<div id="submit-resp" class="success" style="display:none;"><p>Thanks for dropping a line!</p></div>');
					  }else{
					    $('#contact-form').append('<div id="submit-resp" class="fail" style="display:none;"><p><em>Oops!</em> It looks like something went wrong - why don\'t you just <a href="mailto:us@underseje.com">email us instead</a>? Thanks!</p></div>');
					    console.log(response.status);
					  }
					  $('#loading').fadeOut(500);
					  $('#submit-resp').fadeIn(1000);
					}
				});
			}
		});





















