jQuery(document).ready(function(){
	jQuery("#slider").slideView();
	//show slider and video preview
	jQuery('.home #slider ul').fadeIn('slow');
	jQuery('.home .stripTransmitter').show();

	$("#sendmail").click(function(){
		var valid = '';
		var isr = 'Favor preencher o campo ';
		var name = $("#name").val();
		var mail = $("#mail").val();
		if (name.length<1) {
			valid += isr+'nome<br />';
		}
		if (mail.length<1) {
			valid += isr+'e-mail<br />';
		} else if (!mail.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)) {
			valid += 'Favor digitar um e-mail v&aacute;lido<br />';
		}
		if (valid!='') {
			$("#response").fadeIn("slow");
			$("#response").html('<div class="alertError">'+valid+'</div>');
		}
		else {
			var datastr ='name=' + name + '&mail=' + mail;
			$("#response").fadeIn("slow");
			$("#response").html("Por favor aguarde .... ");
			wait = setTimeout("send('"+datastr+"')",2000);
		}
		return false;
	});
	
	function send(datastr){
		$.ajax({	
			type: "POST",
			url: "http://www.catho.com.br/carreira-sucesso/mail.php?1=2",
			data: datastr,
			cache: false,
			success: function(html){
			$("#response").fadeIn("slow");
			$("#response").html(html);
			//setTimeout('$("#response").fadeOut("slow")',2000);
		}
		});
		clearTimeout(wait);
	}
});
