var imgAjaxLoading = "<div class='loading' style='width:200px'><img border='0' width='16' height='16' src='images/ajax.gif' align='absmiddle'> Loading ...</div>";

function loginCheck(){
	$("#checking").html(imgAjaxLoading);
	
	$.post('login.html', {
		logout: "false",
		username: $("#username").val(),
		password: $("#password").val()
	}, function(data){
		 var str= data+"";		
		 if (str.indexOf("true")>=0){
			 window.location.href = "emission/index.html";
		 }else{
		 	$("#checking").html("<font color='red'>Username or Password is not correct!</font>");
		 }
	});
		    		
}

function enterLogin(evt){
	if (isEnter(evt)) {
		loginCheck();
	}
}

function isEnter(evt){
	evt = (evt) ? evt : event;
	var charCode = (evt.which) ? evt.which : evt.keyCode;
	if (charCode == 13) {
		return true;
	}else{
		return false;
	}
}

function _isdefined(_obj) {
	if (null == _obj) {
		return false;
	}
	if ("undefined" == typeof(_obj) ) {
		return false;
	}
	return true;
}