$(document).ajaxSend(function() {
   checkLogin();
});

function checkLogin(){
	if(!session_login){
		$("<div></div>").dialog( {
			buttons: {
			  	"Ok": function () {
			  		$(this).dialog("close"); 
					window.location.replace(base_url);
				}
			},
			close: function (event, ui) {
				$(this).remove();
				window.location.replace(base_url); 
			},
			resizable: false,
			title: "Easylib",
			modal: true
		}).text("Please login...");
	}
}