$().ready(function(){

	//make the form elements purty:
	$('#username,#password').bind('focus',function(){
		if($(this).val()==$(this).attr('id')) {
			$(this).val('');
		}
	});

	$('#username,#password').bind('blur',function(){
		if($(this).val()=='') {
			$(this).val($(this).attr('id'));
		}
	});


	//a-sync call:
	$('#login').bind('submit',function(){
									   
		$('#login_button').val('Validating Login...');
		if($("#username").val()=='mygcc') {document.location='https://mygcc.gilchristconstruction.com';}
		
		$.post("Scripts/ldap.php",
		  { 
			  username: $("#username").val(), 
			  password: $("#password").val()
		  },
		  function(data){
		 
			if(data!="Unable to connect to the server." && data!="Your Username and/or Password were incorrect.") {
				$("#login_form,#content_area").hide(500,function(){
					$("#content_area").html(data).show(500);
				});
				$('#login_button').val('Login Again');
			} else {
				alert(data);
				$('#login_button').val('Re-try Login');
			}
		
		});
	return false;
	});

});