/* Calculate for youself how many days there's left before the site launches. You can also check the counter after you set the date in the below code. Just write the startDays only once! Example: If you know your site will launch in exactly 1 year, you should write 365 days in the star
var startDays = 500;

$(document).ready(function(){
	
	/* Change the time to count down to */
	$("#time").countdown({
		date: "january 30, 2012", /* Counting to a date */
		offset: 0,
		hoursOnly: false,
		onComplete: function( event ) {
		
			$(this).html("<span class='complete'>Este site será lançado hoje!</span>");
			$("#progressbar").css("display", "none"); /* When the countdown reaches above 100%, there's no use in displaying the progressbar */
			$(".tool").css("display", "none");
		},
		leadingZero: true
		
	});
	
	/* The percentage of the progressbar */
	$("#progressbar").progressbar({
		value: percent
	});
	
	/* The position of the tooltip, where the percentage number is in */
	$("#percentage .tool").css({
		marginLeft: percent +"%"
	}).append(percent+"%");
	
	/* The "notify" form validation */
	$('#btn-submit').click(function() {  
				
		$(".error").hide();
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		var emailblockReg =  /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)(?!aol.com)([\w-]+\.)+[\w-]{2,4})?$/; 

		var emailaddressVal = $("#notify_by_mail").val();
		if(emailaddressVal == '') {
			$("#notify_by_mail").after('<span class="error">Por favor informe seu endereço de e-mail.</span>');
			hasError = true;
		} else if(!emailReg.test(emailaddressVal)) {	
			$("#notify_by_mail").after('<span class="error">Informe um e-mail válido.</span>');
			hasError = true;
		} 

		if(hasError == true) { return false; }
		
	});	
	
	$(".email").val("Assine nossa newsletter...");
	
	$('.email').click(
		function() {
			if (this.value == 'Assine nossa newsletter...') {
				this.value = '';
			}
		}
	);
	
	$('.email').blur(
		function() {
			if (this.value == '') {
				this.value = 'Assine nossa newsletter...';
			}
		}
	);
