$(function() {
		
            $(document).mouseup(function() {
				$("#loginform").mouseup(function() {
					return false;
				});
				
				$("a.close").click(function(e){
					e.preventDefault();
					$("#loginform").hide();
                    $(".lock").fadeIn();
				});
				
                if ($("#loginform").is(":hidden"))
                {
                    $(".lock").fadeOut();
                } else {
                    $(".lock").fadeIn();
                }				
				$("#loginform").toggle();
            });
             			
			
			$("form#mailform").submit(function() {
				
				//Validate the Name field if it's blank
	  			var username = $("input#name").val();
				if (username == "") {
					$('#message').html("All the fields are required");
      				$("#message").hide().fadeIn(1500);
      				$("input#name").focus();
      				return false;
    			}
    			
    			
    			//Validate the Email field if it's blank
				var password = $("input#email").val();
				if (password == "") {
					$('#message').html("All the fields are required");
      				$("#message").hide().fadeIn(1500);
      				$("input#email").focus();
      				return false;
    			}
    			
    			
    			//Validate the Text field if it's blank
				var password = $("textarea#text").val();
				if (password == "") {
					$('#message').html("All the fields are required");
      				$("#message").hide().fadeIn(1500);
      				$("textarea#text").focus();
      				return false;
    			}


			});
			
			// This is example of other button
			$("input#cancel_submit").click(function(e) {
					$("#loginform").hide();
                    $(".lock").fadeIn();
			});			

});

