function validate_required(name, id) {
	
	var value = $('#'+id).val();
	if ($.trim(value) == '' || $.trim(value) == '+') {
		var new_div = $('<div>').css('color','red').css('display','none');
		new_div.html('Please input '+name+'.');
		$('#error-message').html(new_div);
		new_div.fadeIn('fast').delay(600).fadeOut('slow');
		
		$('#'+id).css('background-color','#f99');
		return false;
	}
	else {
		$('#'+id).css('background-color','#fff');
		return true;
	}
}

function ml_validate_required(name, id) {
	var value = $('#'+id).val();
	if ($.trim(value) == '') {
		var new_div = $('<div>').css('color','red').css('display','none');
		new_div.html('Please input '+name+'.');
		$('#ml_error-message').html(new_div);
		new_div.fadeIn('fast').delay(600).fadeOut('slow');
		$('#'+id).css('background-color','#f99');
		return false;
	}
	else {
		$('#'+id).css('background-color','#fff');
		return true;
	}
}

function validate_email(name, id) {

	var value = $('#'+id).val();
	if (/^[\w\.]+@\w+(\.\w+)+$/.test(value)) {
		
		$('#'+id).css('background-color','#fff');
		return true;
	}
	else {
		var new_div = $('<div>').css('color','red').css('display','none');
		new_div.html('Please input '+name+'.');
		$('#error-message').html(new_div);
		new_div.fadeIn('fast').delay(600).fadeOut('slow');
		$('#'+id).css('background-color','#f99');
		return false;
	}
}


function ml_validate_email(name, id) {
	var value = $('#'+id).val();
	if (/^[\w\.]+@\w+(\.\w+)+$/.test(value)) {
		
		$('#'+id).css('background-color','#fff');
		return true;
	}
	else {
		var new_div = $('<div>').css('color','red').css('display','none');
		new_div.html('Please input '+name+'.');
		$('#ml_error-message').html(new_div);
		new_div.fadeIn('fast').delay(600).fadeOut('slow');
		$('#'+id).css('background-color','#f99');
		return false;
	}
}
