$(document).ready(function(){
		
		$("#developersDiv img[title]").tooltip( {tip : '#demotip', effect: 'slide', predelay : '250'}); 
		$("div.clients img[title]").tooltip( {tip : '#clienttip', effect: 'slide', predelay : '250'});  
		
		var triggers = $("div.VistaButton[rel], a.contactText[rel]").overlay({expose : 'Gray', effect : 'apple', 
			onClose :
				function(){
					$("#email").attr('value', '');
					$("#title").attr('value', '');
					$("#notes").attr('value', '');
					$("#response").css("display", "none").css("background-color", "#FFF").html("");
					$("#formTable").fadeIn();
					$("#submitButton").css("display", "inline");
				}
				});
		
		$("table.button").click(function()
		{
			$(this).find("a#contact").trigger("click");
		});	
	
		$("#commentForm").validate(
			{
				submitHandler : function (form)
					{
						var email = $("#email").val();
						var title = $("#title").val();
						var notes = $("#notes").val();

						$("#submitButton").css("display", "none");
						$("#formTable").fadeOut("fast", function()
						{
							$("#response.noresponse").css("display", "block").html("Sending message .... ").fadeIn("slow");
						});
						
						$.post("mail.php", { email : $("#email").val(), title : $("#title").val(), notes : $("#notes").val() }, function(html){							
							$("#response").removeClass("noresponse").fadeIn("slow").html(html);
						});
					}
			});
		
		$("img.hov").animate( { opacity : 0.6 }, 500 );
		
		$("img.hov").mouseover(function() {
			$(this).animate( { opacity : 1 }, 200 );
		}).mouseout(function() {
			$(this).animate( { opacity : 0.6 }, 500 );
		});;
		
		$("div#hoverButton").mouseover(function() {
			$(this).css("opacity", "0.6");
		}).mouseout(function() {
			$(this).css("opacity", "1");
		});
		
		$("div.VistaButton").mouseover(function() {
			$(this).addClass("VistaButtonHover");
		}).mouseout(function() {
			$(this).removeClass("VistaButtonHover");
		});
		
   });
   function send(post_email, post_title, post_content){
				//$.post("mail.php", { email : 'lol', title : 'dadas', notes : 'dasdasd' }, function(html){
				//	$("#response").css("background-color", "#FFF").fadeIn("slow").html(html);
				//});
				$.post("mail.php", { tresc : 'ddd'}, function(data){
					$("div#error").html(data);
				});	
   };
   function send(datastr){
			$.ajax({	
				type: "POST",
				url: "mail.php",
				data: datastr,
				cache: false,
				success: function(html){
				$("#response").css("background-color", "#FFF").fadeIn("slow").html(html);
				},
				error : function () { 
					$("#response").css("background-color", "Red").fadeIn("slow").html("There's some errors to send the mail.<input type='submit' value='Try Again' id='submitButton' />");
					}
			});
		}
