$(document).ready(function() {
	

/* 	AJAX MAILCHIMP SIGNUP FORM
/* ----------------------------------------- */
		
	/*///////////////////////////////////////////////////////////////////////
	Ported to jquery from prototype by Joel Lisenby (joel.lisenby@gmail.com)
	http://joellisenby.com
	
	original prototype code by Aarron Walter (aarron@buildingfindablewebsites.com)
	http://buildingfindablewebsites.com
	
	Distrbuted under Creative Commons license
	http://creativecommons.org/licenses/by-sa/3.0/us/
	///////////////////////////////////////////////////////////////////////*/

	$('#signup').submit(function() {
		// update user interface
		$('#response').html('Adding email address...');
		//alert(escape($('#emailadd').val());
		var objEmailField = document.getElementById('emailadd');
		//alert(objEmailField.value);
		// Prepare query string and send AJAX request
		$.ajax({
			url: 'ssi/store-address.php',
			//data: 'ajax=true&email=' + escape($('#emailadd').val()),
			data: 'ajax=true&email=' + objEmailField.value,			
			success: function(msg) {
				$('#response').html(msg);
			}
		});
	
		return false;
	});
	


// window.onload = function(){ alert("onload test"); }


/* 	REMOVE FORM TEXT ON FOCUS
/* ----------------------------------------- */			
	
	// Hotbox
	 $('#formSignUp').focus(function(){
     	if($(this).val() == 'Enter your email address'){
     		$(this).val('');
     	}
     });
      
	 $('#formSignUp').blur(function(){
      	if($(this).val() == ''){
      		$(this).val('Enter your email address');
      	}
     });
     
     
     // Modal Popup
     $('#formInput').focus(function(){
     	if($(this).val() == 'Enter your email address'){
     		$(this).val('');
     	}
     });
      
	 $('#formInput').blur(function(){
      	if($(this).val() == ''){
      		$(this).val('Enter your email address');
      	}
     });
     
     //Contact Form
     $('#full-name').focus(function(){
     	if($(this).val() == 'Full Name'){
     		$(this).val('');
     	}
     });
      
	 $('#full-name').blur(function(){
      	if($(this).val() == ''){
      		$(this).val('Full Name');
      	}
     });
     
     $('#telephone').focus(function(){
     	if($(this).val() == 'Contact Number'){
     		$(this).val('');
     	}
     });
      
	 $('#telephone').blur(function(){
      	if($(this).val() == ''){
      		$(this).val('Contact Number');
      	}
     });
     
     $('#email').focus(function(){
     	if($(this).val() == 'Your Email Address'){
     		$(this).val('');
     	}
     });
      
	 $('#email').blur(function(){
      	if($(this).val() == ''){
      		$(this).val('Your Email Address');
      	}
     });



/* 	TOP FONT PAGE SLIDER
/* ----------------------------------------- */	

	$('#hero').slides({
		preload: true,
		generateNextPrev: false,
		play: 7300,
		slideSpeed: 800
	});
	

/* 	FREE SAMPLE MODAL
/* ----------------------------------------- */

	$("a#inline").fancybox({
		'hideOnContentClick': false,
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'speedIn'		:	800, 
		'speedOut'		:	300
	});
	
	
/* 	OVERRIDE CSS STYLES
/* ----------------------------------------- */

	//Success Storey Last Item
	$("#success article.storey-wrap:last").addClass("last-item");
	
	
	
	$("ul#news-carousel li:nth-child(4)").addClass("last-item");
	



});
