function __NamehtSubmitButtonOnClick( btnControl, causesValidation )
{
	if ( btnControl == null ) return false;
	
	var func = btnControl.getAttribute( "customValidationFunction" );
	if ( typeof( func ) == "string" && func.length != 0 )
	{
		goodReturn = false;
		try
		{
			eval( "goodReturn = " + func );
		}
		catch(e)
		{
			alert( "could not find validation function: " + func );
			return false;
		}
		if ( goodReturn == false )
			return false;
	}
	
	if ( btnControl.getAttribute( "confirmSubmit" ) == "true" )
	{
		var confirmed;
		var s = btnControl.getAttribute( "confirmStatement" );
		if ( typeof( s ) == "string" && s.length != 0 )
			confirmed = confirm( s );
		else
			confirmed = confirm( "Are you sure you want to submit?" );
			
		if ( confirmed == false )
			return false;
	}
	
	if (typeof(Page_ClientValidate) == 'function' && causesValidation )
	{
		var vg = btnControl.getAttribute( "validationGroup" );
		if ( vg == null ) vg = "";
		
		validationResult = Page_ClientValidate(vg);
		if ( validationResult == false ) return false;
	}

	
	btnControl.value = "Please Wait..."
	btnControl.disabled = true;
	
	return true;
}

function __NamehtSubmitByEnterKey( e )
{
	var inputControl = ( document.all ) ? event.srcElement : e.target;
	if ( inputControl == null ) return;
	
	var btnControl;
	
	if ( document.all ) e = event;
	
	if ( e.keyCode != 13 ) return true;
	
	//check to see if the control has its own enter handler
	if ( inputControl.getAttribute( "EnterButton" ) && inputControl.getAttribute( "EnterButton" ) != "" )
	{
		btnControl = document.all[inputControl.EnterButton];
		if ( btnControl )
		{
			btnControl.click();
			if ( document.all == null )
			{
				e.returnValue = false; 
				e.cancel = true; 
				e.stopPropagation(); 
				e.preventDefault();
			}
			return false;
		}
	}
	
	//never process
	switch( inputControl.tagName.toLowerCase() )
	{
		case "textarea":
		case "button":
			return;
		case "input":
			switch( inputControl.getAttribute( "type" ).toLowerCase() )
			{
				case "button":
				case "submit":
					return;
			}			
	}
	
	var list = document.getElementsByTagName( "input" );
	for( var i = 0 ; i < list.length ; i++ )
	{
		if ( list[i].getAttribute( "defaultButton" ) == "true" )
		{
			list[i].click();
			
		}
	}

	if ( document.all == null )
	{
		e.returnValue = false; 
		e.cancel = true; 
		e.stopPropagation(); 
		e.preventDefault();
	}

	return false;
}
