$(document).ready(function() {

// Gallery Hover Effects
$("#gallery li").mouseover(function(){
       $(this).css({
              "border-color" : "#CD119E"
       });	   
});
$("#gallery li").mouseout(function(){
       $(this).css({
              "border-color" : ""
       });	   
});
$("#gallery li img").mouseover(function(){
	$(this).css({
		"opacity" : "0.8"
	});
});
$("#gallery li img").mouseout(function(){
	$(this).css({
		"opacity" : ""
	});
});

// Contact Form Functions

$("#contact .send").mouseover(function() {
	$(this).addClass("send_over");
});
$("#contact .send").mouseout(function() {
	$(this).removeClass("send_over");
});

//Submit
$("#contact .send").click(function(){
	
	var name = $("#name").val();
	var tel = $("#tel").val();
	var email = $("#email").val();
	var message = $("#message").val();
	var dataString = "name=" + name + "&tel=" + tel + "&email=" + email + "&message=" + message;
	
	//alert(dataString);
	
	if(name == ""){
		$("#name").css({
				"background-color" : "#FFA5A5",
				"border-color" : "red"
		});
		$("#name").focus();
		return false;
	}else{
		$("#name").css({
			"background-color" : "",
			"border-color" : ""
		});
	}	
	
	if(email == ""){
		$("#email").css({
				"background-color" : "#FFA5A5",
				"border-color" : "red"
		});
		$("#email").focus();
		return false;
	}else{
		$("#email").css({
			"background-color" : "",
			"border-color" : ""
		});
	}	

	if(message == ""){
		$("#message").css({
				"background-color" : "#FFA5A5",
				"border-color" : "red"
		});
		$("#message").focus();
		return false;
	}else{
		$("#message").css({
			"background-color" : "",
			"border-color" : ""
		});
	}

	$("#buttons").html("<img src='images/spinner.gif' class='spinner' />");
	
	
	$.ajax({
		type: "POST",
		url: ("bin/sendmail.php"),
		data: dataString,
        cache: "false",
		success: function(html){
		
		$("#buttons").html("Reloading Page...");
		$("input, textarea").val("");
		$("#content h1").html("Message Sent!");
            
		setTimeout(function() {
			location.reload();												
		}, 1500)
		
		}
	});
	
	
	
	
	
	
	
	
	
	
});

$("#contact .reset").click(function(){
	$("#contact input, #contact textarea").val("");
	$("#contact input, #contact textarea").css({
		"background-color" : "",
		"border-color" : ""
	});
});




});