$(document).ready(function() {
	jQuery(document).on('blur', '#a_email, #a_password', function () {
		$(this).removeClass('red');
		$('#login_MSg').html('');
	});
	
	
	/* $("#student_login").submit(function() {
		var data = $("#student_login").serialize();
		
		$.ajax({
			url: HTTP_PATH+"Home/signIn",
			data: data,
			type: "POST",
			dataType : "JSON",
			success: function(msg) {
				var data = msg;
				$('#login_MSg').html(data['text']);
				if(data['success']==true){
					setTimeout(function(){
						window.location.href = HTTP_PATH +'students';
					},1000);
				}else{
					if(data['field_name']=="both"){
						$('#a_email').addClass('red');
						$('#a_password').addClass('red');
					}else{
						var dd=data['field_name'];
						$('#'+dd).addClass('red');
					}
				}				
			}
		});
		return false;
	}); */
});

$(document).on('click','.CustomBtnPink',function(){
	if($('#a_email').val()=="" || $('#a_password').val()=="" ){
		alert('All fields are required!');
	}else{
		var data = $("#student_login").serialize();
			
		$.ajax({
			url: HTTP_PATH+"Home/signIn",
			data: data,
			type: "POST",
			dataType : "JSON",
			success: function(msg) {
				var data = msg;
				$('#login_MSg').html(data['text']);
				if(data['success']==true){
					setTimeout(function(){
						window.location.href = HTTP_PATH +'students';
					},1000);
				}else{
					if(data['field_name']=="both"){
						$('#a_email').addClass('red');
						$('#a_password').addClass('red');
					}else{
						var dd=data['field_name'];
						$('#'+dd).addClass('red');
					}
				}				
			}
		});
	}
});