
//	In a text input field replace enter keypress with tab
function NetscapeEventHandler_KeyDown(e) {
  if (e.which == 13 && ((e.target.type == 'textarea') || (e.target.type == 'text') || (e.target.type == 'password')))
  {
   e.which = 9;
  }
  return true;
}

//	In a text input field replace enter keypress with tab
function MicrosoftEventHandler_KeyDown() {
  if (event.keyCode == 13 && ((event.srcElement.type == 'textarea') || (event.srcElement.type == 'text') || (event.srcElement.type == 'password')))
  {
    event.keyCode = 9;
  }
  return true;
}

function checkEnter(e,mode)
{	

// Commented out CW on 12/03
	//e is event object passed from function invocation
	var characterCode; // literal character code will be stored in this variable

	if(e && e.which)
	{ //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which; //character code is contained in NN4's which property
	} else {							
		e = event;						
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}

	if(characterCode == 13)
	{ //if generated character code is equal to ascii 13 (if enter key)
		DisableButtons(mode);
		return false; 
	} else {
		return true;
	}
	
	
}

function DisableButtons(mode) {
	if (document.all||document.getElementById){
		for (i=0;i<document.Home.length;i++){
			var tempobj=document.Home.elements[i]
			if (mode == "addresssearch") {
				if ((tempobj.id.indexOf("LoginButton") > 0) || (tempobj.id.indexOf("ManageAddressesButton") > 0) || (tempobj.id.indexOf("SignOut") > 0) || (tempobj.id.indexOf("SimpleSearchButton") > 0) || (tempobj.id.indexOf("AdvancedSearchButtonSearch") > 0) || (tempobj.id.indexOf("RegisterButton") > 0) || (tempobj.id.indexOf("CancelAddress") > 0) ) 
					{
						tempobj.disabled=true;
					}
			}else if (mode == "search"){
				if ((tempobj.id.indexOf("LoginButton") > 0)) 
					{
						tempobj.disabled=true;
					}
			}
		}
	}
}
