$(document).ready(function() {


$(".helloMain").click(function() {
	
	$(this).addClass("helloActive");

	$(".workingMain").addClass("working").removeClass("workingActive")
	$(".loadmainPart").load('hello.php');

 });

$(".workingMain").click(function() {

	$(this).addClass("workingActive");
	$(".helloMain").addClass("hello").removeClass("helloActive");
	$(".loadmainPart").load('working.php');

 });


$(".click_pp_left").click(function() {

	$(".slide_pp").animate({
								
		'marginLeft' : "+=823px"							
								
		});
				   
 });

$(".click_pp_right").click(function() {

	$(".slide_pp").animate({

		'marginLeft' : "-=823px"
		
	  });

 });

$("#comment").click(function() {
							 
	$(this).val("");
	$(this).css({"color":"#878B90"});

})

$("#email").click(function() {
						   
	$(this).val("");
	$(this).css({"color":"#878B90"});

})

$("#email2").click(function() {
						   
	$(this).val("");
	$(this).css({"color":"#878B90"});

})

$(function(){
			$('#commentForm').submit(function(e){
				e.preventDefault();
				// disable co
				$.post('index.php',$('#commentForm').serialize(),function(data){
					//alert($("#commentForm #comment").findSerialize());
					// handle the response
					//addMessages("Thanks you!");
					
					if($('#commentForm #comment').val()=="Comments can't be null") {
					alert($('#commentForm #comment').val());
					}
					
					else {
						
					if(data.match('not valid format')){
						$("#email").val("Invalid Email Format");
						$("#email").css({"color":"red"});
					}
					
					else if($('#commentForm #comment').serialize().match('COMMENTS')){
						$("#comment").val("Comments can't be null");
						$("#comment").css({"color":"red"});
					}
						
					else {
					$("#email").val("Thank You!");
					$("#email").css({"color":"green"});
					}
				 }
					// enable
				})
			})
			
			$('#newsletterForm').submit(function(e){
				e.preventDefault();
				// disable co
				$.post('index.php',$('#newsletterForm').serialize(),function(data){
					//alert(data);
					// handle the response
					//addMessages("Thanks you!");
					//alert(data);
					if(data.match('not valid format')){
						$("#email2").val("Invalid Email Format");
						$("#email2").css({"color":"red"});
					}
					else {
					$("#email2").val("Thank You!");
					$("#email2").css({"color":"green"});
					}
					// enable
				})
			})
		})

});
