<!-- // this comment hides script from script-blind browsers

//****************************************************************************
//	clearform.js
//
//	Description:
//		Provides the functions needed to create a submit button that resets a
//		form after submission.
//
//	Purpose:
//		Clear (reset) one form on a page after submitting data.
//
//	Usage:
//		*	The form must have an ID
//		*	A <script> section should be included that calls
//			function drawButton(strFormID)
//		*	A standard XHTML submit button should be included in a
//			<noscript> section
//
//	Created by Christian Web Programming
//
//	Copyright &copy; 2010 by James E. Pettis
//
//	February 3, 2010
//****************************************************************************


//****************************************************************************
//	function submitFirst(strFormID)
//
//	Description:
//		Submits the calling form.
//
//	Arguments
//		strFormID		ID of the calling XHTML form
//
//	Return
//		none
//
//	Purpose:
//		Submit the form data upon activating a button of type "reset".
//		Form submission occurs before the reset takes effect.
//****************************************************************************
function submitFirst(strFormID)
	{
	var formThis = document.getElementById(strFormID);

	formThis.submit();
	}// end function clearForms()


//****************************************************************************
//	function drawButton(strFormID)
//
//	Description:
//		Draws a button using JavaScript that submits and then resets the
//		calling form.
//
//	Arguments
//		strFormID		ID of the calling XHTML form
//
//	Return
//		none
//****************************************************************************
function drawButton(strFormID)
	{
	var strXHTML = 
'<button type="reset"\n' +
	'\tonclick="submitFirst(' + "'" + strFormID + "'" + ')"' +
		' onkeypress="submitFirst(' + "'" + strFormID + "'" + ')"\n' +
	'\ttitle="This will take you to our ultra-secure' +
		' PayPal shopping cart.">\n' +
	'\t<div>Add to Cart</div>\n' +
'</button>\n';

	document.write(strXHTML);
	}// end function drawButton(strFormID)

// this comment closes the script-hiding comment -->
