jQuery.noConflict();
jQuery(document).ready(function(){


	/*
	  * FORM ***
	*/
	
	
	jQuery("#formMail").submit(function(){
		jQuery.ajax({
			type: "POST",
			url: "sendMail.php",
			data: jQuery(this).serialize(),
			success: function(response) {
				jQuery("#alert").ajaxComplete(function() {
					if(response == 'ok') {
						jQuery(this).html('<p>Your message has been sent. Thanks!</p>');
						jQuery("#name, #email, #subject, #message").val('');
						jQuery(this).stop().animate({
 							opacity: 1
 						}, 400, function(){
							interval = setInterval(hideAlert, 8000);
						});
					} else {
						jQuery(this).html(response);
						jQuery(this).stop().animate({
 							opacity: 1
 						}, 400, function(){
							interval = setInterval(hideAlert, 4000);
						});
					}
				});
			}
		});
		return false;
	});
	
	var hideAlert = function(){
		clearInterval(interval);
		jQuery("#alert").stop().animate({opacity:0}, 400);
	};

});
