/* Author: 
	Tamara Pearce
*/

//  clickable box --------------------------------------------------------------	

$("#featured li").click(function(){
	window.location=$(this).find("a").attr("href");return false;
});


$(window).load(	
	function() {
		$("#li-banner").sp_Li_Slider({						
			animation				: "Regular-Custom",	// type of Animation: Regular, Random, Regular-Custom, Random-Custom, Regular-Exception, Random-Exception  			
			transitions				: 'Sqr-Down Sqr-Ex-Random',		// None|transition_name(s) // List of custom animations - for full list please reference to the preview 
			auto_play 				: true,   		// true|false - auto play on start
			repeat	 				: true,			// true|false|number - how many times to repeat all slides
			goToSlideOnStart		: 1,			// value //any slide number starting from 1 or url?sp_slide=2
			pauseOnMouseOver		: false,		// true|false
		
			delay     				: 2000,			// value // time period of a photos displaying /default - 3000 (3 sec)
			trans_period			: 800,			// value // time period of chenging the photos /default - 1000 (1 sec)
			vert_sections			: 10,			// value // number of vertical sectors (only for Animation type Blind) /default - 15
			sqr_sections_Y			: 4,			// value // number of squeres by vertical (only for Animation type Sqr) /default - 5
			active_links			: true,			// true|false //activate links of photos /default - true
			buttons_show			: true,			// true|false //show all buttons 		/default - true
			play_pause_show			: true,			// true|false //show Play or Pause buttons	/default - true
			next_prev_show			: true,			// true|false //show Next or Prev buttons	/default - true
			auto_hide 				: true			// true|false // auto hide buttons ot start (when auto_play is true)

		});
	}
);

$(function() {
  $('.error').hide();
  
  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	var name = $("input#name").val();
	if (name == "") {
      $("label#name_error").show();
      $("input#name").focus();
      return false;
    }
	
	var email = $("input#email").val();
	if (email == "") {
      $("label#email_error").show();
      $("input#email").focus();
      return false;
    }
		
	var dataString = 'name='+ name + '&email=' + email;
	//alert (dataString);return false;
		
	$.ajax({
	type: "POST",
		url: "bin/process-newsletter.php",
		data: dataString,
		success: function() {
		$('#contact_form').html("<div id='message'></div>");
		$('#message').html("<h2>Newsletter Signup Submitted!</h2>")
		.append("<p>We will be in touch soon.</p>")
		.hide()
		.fadeIn(1000, function() {
			$('#message').append("<img id='checkmark' src='/img/check.png' />");
		});
		}
     });
    return false;
	});
});

runOnLoad(function(){
  $("input#name").select().focus();
});




