$(document).ready(function() {  
  $('.error').hide();
  $(".button").click(function() {
    //alert("button clicked");  
    // validate and process form here 
	$('.error').hide();  
	var username = $("input#username").val();  
	if (username == "") {  
		$("label#username_error").show();  
		$("input#username").focus();  
		return false;  
	}
	var password = $("input#password").val();
	if(password == "") {
		$("label#password_error").show();  
		$("input#password").focus();  
		return false;  
	}
	var dataString = 'action=login&username='+ username + '&password=' + password;  
	//alert(dataString);//return false;  
	$.ajax({  
	  type: "POST",  
	  url: "login.aspx",  
	  data: dataString,  
	  success: function(result) {  
	    var items = result.split("|");
	    //alert('dashboard.aspx?user_id=' + items[0] + '&auth_id=' + items[1]);
	    top.location.href = 'dashboard.aspx?user_id=' + items[0] + '&auth_id=' + items[1];
	  },
	  error: function(xhr, ajaxOptions, thrownError){
	    alert(xhr.statusText);
	  }
	});  
	return false; 
  });  
});  