$(document).ready(function(){
	$("#reenviar").click(function(){
		$(".faleconosco form").animate({opacity:1});
		$(".enviado").fadeOut("slow");
		$(".faleconosco input, .faleconosco textarea").attr("value","");
		$(".faleconosco input.envia").attr("value","Enviar outro e-mail");
		$(".faleconosco input, .faleconosco textarea").removeAttr("disabled");
		$(this).fadeOut("slow");
	})
	
	$('.bloco').cycle({ 
    	fx:     'fade',
	    speed:   300, 
	    timeout: 10000, 
		next:   '#proximo',
		prev:   '#anterior',
		pager:  '#nav'
	})
	
	$(".bloco-clipping li").hover(function(){
		$(".bloco-clipping li div").show();
	})
})

//Envio

var time_variable;

	function getXMLObject(){
		var xmlHttp = false;
		try {
		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")
	}
		catch (e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e2) {
				xmlHttp = false
			}
		}
		if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
			xmlHttp = new XMLHttpRequest();
		}
		return xmlHttp;
}

var xmlhttp = new getXMLObject();

function ajaxFunction() {
	var getdate = new Date();
	if(xmlhttp) { 
		var email = document.getElementById("email");
		xmlhttp.open("POST","envia.php",true);
		xmlhttp.onreadystatechange  = handleServerResponse;
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.send("email=" + email.value);
		$(".faleconosco form").animate({opacity:0.2});
		$(".faleconosco input, .faleconosco textarea").attr("disabled",true);
		$(".enviado").fadeIn("slow").html("enviado com sucesso");
		$("#reenviar").fadeIn("slow");
	}
}

function handleServerResponse() {
	if (xmlhttp.readyState == 4) {
		if(xmlhttp.status == 200) {
			document.getElementById("enviado").innerHTML=xmlhttp.responseText;
		}
	}
}