// JavaScript Document

//Use this to set the date to which the timer counts down to

//Edit line 23. Input your desired date using the format below:
//
// 		newYear = new Date(yyyy, 00 - 1, dd, hh, mm, ss);
//
// where yyyy = year, oo = month (e.g. Sep = 09), dd = day, hh = hour (e.g. 5pm = 17), mm = min and ss = seconds
//
// for example, July 12th, 2012, at 18:43pm would be written as below:
//
// 		newYear = new Date(2012, 07 - 1, 12, 18, 43, 00);
	
	//modify line 23 below to use your own launch date, following the instructions above:


$(document).ready(function(){
	var newYear = new Date(); 
	newYear = new Date(2011, 12 - 1, 06, 19, 00, 00);
	$('#months p').countdown({
		until: newYear, 
		format: 'yODHMS',
		layout: '{on}'
	});
	$('#days p').countdown({
		until: newYear, 
		format: 'ODHMS',
		layout: '{dn}'
	});
	$('#hours p').countdown({
		until: newYear, 
		format: 'ODHMS',
		layout: '{hn}'
	});
	$('#minutes p').countdown({
		until: newYear, 
		format: 'ODHMS',
		layout: '{mn}'
	});
	$('#seconds p').countdown({
		until: newYear, 
		format: 'ODHMS',
		layout: '{sn}'
	});



//email mailing-list submit 
$('#submitform').submit(function(){
	
		var action = $(this).attr('action');
		
		$("#message").slideUp(750,function() {
		$('#message').hide();
		
 		$('#submit')
			.after('<img src="images/ajax-loader.gif" class="loader" />')
			.attr('disabled','disabled');
		
		$.post(action, { 
			email: $('#email').val()
		},
			function(data){
				document.getElementById('message').innerHTML = data;
				$('#message').slideDown('slow');
				$('#submitform img.loader').fadeOut('slow',function(){$(this).remove()});
				$('#submitform #submit').attr('disabled',''); 
				if(data.match('success') != null) $('#submitform').slideUp('slow');
				
			}
		);
		
		});
		
		return false; 
	
	});
	




});

