$(document).ready(function(){
//Default

//Actions on click
$("div#Home.MenuItem a").click(function () {
	 loadcontent("home");
	 return false;
    });

$("div#Foto.MenuItem a").click(function () {
 	 loadcontent("foto");
	 return false;
    });

$("div#People.MenuItem a").click(function () {
	  loadcontent("people");
	  return false;
    });

$("div#Help.MenuItem a").click(function () {
	loadcontent("help");

	return false;
    });

function loadcontent(page){
$("#content").show().empty().load("pages/" + page + ".html");

}

//end document ready
  });


function Clear(obj) {
if(obj.value == 'Find') obj.value = '';
}


function messageBox(msg) {
$("#message-box").empty().append(msg);
$("#message-box").fadeIn("fast", function() {
										 
		  $(this).fadeTo(2000, 0.50);
								 									 
										 
										 
										 });
	
}


	   
								 
									   
									   
									  




function getAttention(to) {
$(to).css("border","1px solid red");
}



function FormCheck() {


 var error=0;
 $(".required").each(function () { $(this).css("border", "0px none transparent");

 if ($(this).val() == '' || $(this).val() == 'Name(required)'   ) {
 getAttention($(this));
 messageBox("Enter your name");
 error ++;
 return false;
 
 }

 if ($(this).val() == '' || $(this).val() == 'Email(required)'   ) {
 getAttention($(this));
 messageBox("Enter your email");
 error ++;
 return false;
 }
 
 
   //check email
 var reg = /^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\._-]+\.[a-zA-Z]{2,4}$/;
 var address = document.getElementById('email').value;
 if(reg.test(address) == false) {
 getAttention($("#email"));
 messageBox("Your email is incorrect");
 error ++;
 }
 


 if ($(this).val() == '' || $(this).val() == 'Start typing here'   ) {
 getAttention($(this));
 messageBox("Enter your message");
 error ++;
 return false;
 }
 
 

  //check email end


 }); //end each();
  

if (error != 0)  return false;


return true;



 }
 






/*Send form*/
function SendForm() {
if (FormCheck() == true)  {
/*if start*/
var str=$("form[name='qwe']").serialize();
$.ajax({
   type: "POST",
   url: "sendform.php",
   data: str,
   success: function(msg){
	var reg = msg.match(/Message has been sent/);
   HideContactForm($("#cf"),reg);
   
   }


 });


}
/*end if*/

      }
	/*Send form end*/



function HideContactForm(formid,reg) {
	$("#message-box").hide();
	formid.slideUp(2000, function(){
	alert(reg);							  
								  
								  });
	}
