//***** custom Functions *****//

function dialogEnterSubmit(handler) {
	$(handler).keypress(function(e){
		if(e.keyCode == 13){
			e.preventDefault();
			$(".ui-dialog:visible").find('.ui-dialog-buttonpane').find('button:first').click();
		}
	}).focus();
}

function checkLength( o, n, min, max ) {
	
	$("p.alert").css("display","none");
	
	if (o.val().length > max || o.val().length < min) {
		o.addClass("ui-state-error");
		$("p.alert").css("display","inline");
		//updateTips("Length of " + n + " must be between " + min + " and " + max + ".");
		return false;
	} else {
		return true;
	}
}
	
function checkRegexp( o, regexp, n ) {
	if (!( regexp.test(o.val()))) {
		o.addClass( "ui-state-error" );
		updateTips( n );
		return false;
	} else {
		return true;
	}
}
