// JavaScript Document

jQuery.fn.enter2tab = function()
{
	
	this.keypress(function(e){
			
			var key = e.charCode ? e.charCode : (e.keyCode ? e.keyCode : 0);
			if ((key == 13) && /^(input|select)$/i.test(this.nodeName)) {
				var list, next = this.tabIndex + 1;
				list = $("select[@tabIndex='" + next + "'],input[@tabIndex='" + next + "']");
				if (list.size() > 0) {
					list.get(0).focus();
					return false;
				} else if (this.form) {
					
					var current = this, focusNext = false, gotFocus = false;
					$.each(this.form,function(i, elem) {
						
						if (current == elem) {
							focusNext = true;
						} else if (focusNext && /^(input|select)$/i.test(elem.nodeName) && elem.type != 'hidden' && elem.style.display != 'none') {
							
							elem.focus();
							gotFocus = true;
							return false;
						}
					});
					if (gotFocus) {
						return false;
					}
				}
			}
		});
	
	return this;
}

function verifyEnter(e){

	var key = e.charCode ? e.charCode : (e.keyCode ? e.keyCode : 0);
	if ((key == 13)) {
		return true;
	}
	else
	{
		return false;		
	}
}

