$(document).ready(function() {

// 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
     $('#mce-EMAIL').focus(function(){
     	if($(this).val() == 'Enter your email address'){
     		$(this).val('');
     	}
     });
      
	 $('#mce-EMAIL').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");
	
	
/* 	CONTACT FORM
/* ----------------------------------------- */		
	
	$(document).ready(function() { 	
		var options = { 
		target: '#alert'
	}; 
		$('#contactForm').ajaxForm(options); 
	}); 
	
	$.fn.clearForm = function() {
	  return this.each(function() {
		var type = this.type, tag = this.tagName.toLowerCase();
		if (tag == 'form')
		  return $(':input',this).clearForm();
		if (type == 'text' || type == 'password' || tag == 'textarea')
		  this.value = '';
		else if (type == 'checkbox' || type == 'radio')
		  this.checked = false;
		else if (tag == 'select')
		  this.selectedIndex = -1;
	  });
	};
	



});
