// ajax_login.js v1
// copyright 2009
// soulbytes IT Solutions














$(document).ready(function() {
	
	// Authenticate user
	$("#login_form").submit(function() {
		$("#msgbox").removeClass().addClass('ajaxerror').html('<img src="img/loading.gif" width="15" height="15"> Identificeren...').fadeIn(1000);
		$.post("inc/functions/ajax_login.php",{ user_name:$('#username').val(),password:$('#password').val(),rand:Math.random() } ,
			function(data) {
			  if(data=='yes') {
			  	$("#msgbox").fadeTo(200,0.1,
			  	function() { 
			 			$("#armadamenu").fadeTo(900,0.1,
			 			function() {
				 			$("#armadamenu").load("tpl_menu.php").fadeTo(900,1,
				  			function(){ 
				  				if(jQuery.browser.msie) this.style.removeAttribute('filter');
				  			});	
						});
					});
					//if(jQuery.browser.msie) $("#loginbox").style.removeAttribute('filter');
			  } else {
			  	$("#msgbox").fadeTo(200,0.1,
			  		function() { 
				  		$(this).html('Naam of wachtwoord niet correct.').addClass('ajaxerror').fadeTo(900,1,
				  			function(){ 
				  				if(jQuery.browser.msie) this.style.removeAttribute('filter');
				  			});	
						});		
				}
			});
 		return false;
	});
	
});
