		var EVT_TARGET = '__EVENTTARGET';
		var EVT_ARG	= '__EVENTARGUMENT';
		var imgProcessingPreLoad = new Image().src = '';
		function DisableSubmit(objButton)
		{
	
			//alert('Posting');
			var blnValid = false;
			if (typeof(Page_ClientValidate) == 'function') 
				blnValid = Page_ClientValidate(); 
			else
				blnValid = true;
				
			if(blnValid)
			{
				//alert('Valid!');
				
				
				//Find the form 
				var theform;
				if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) 				
					theform = document.Form1;				
				else 				
					theform = document.forms["Form1"];
				
				//Disable Send and Edit Button
				var objEditButton = asyncFindElement(theform,'btnedit_info');
				objEditButton.enabled = false;
				objEditButton.style.display = 'none';
				
				objButton.src = '';
				objButton.disabled = true;
				try
				{
				if(objButton.style.cursor)
					objButton.style.cursor = 'normal';
				}
				catch(e)
				{}
				
				//set eventTarget 
				var eventTarget = 'btnsave_info';
				
				//SEt Postback Args to event Target
				asyncSetPostbackArgs(theform);							
				var objEvtTarget = asyncFindElement(theform,EVT_TARGET);
				
				//alert('Find Element Done: ' + typeof(objEvtTarget));
				objEvtTarget.value = eventTarget;
				
				//alert('Submiting');
				//Submit
				theform.submit();
			}	
		}
		
		function asyncSetPostbackArgs(objFormToCheck)
		{
			var blnEventTargetFound = false;
			var blnEventArgFound	= false;
			
				//Dynamically added events (perhaps on previous async postbacks) are not
				//tracked by the name/value elements collection in IE. . cycle through them 
				//and check the names for a match before adding any new ones 
				
				
				for(var i = 0; i < objFormToCheck.elements.length ; i++)
				{
					var objLook = null;
					var objLook = objFormToCheck.elements[i]; 		
			
					if(objLook != null)
					{						
						var strName = objLook.name + "";			
						var strID = objLook.id + "";
						if(strName == null || strName == "")
							strName = strID;					
						if(strID == null || strID == "")
							strID = strName;
					
						
						if(strName == EVT_TARGET)
							blnEventTargetFound = true;				
						if(strName == EVT_ARG)
							blnEventArgFound = true;			
					}
				}
					
				
				//Set Postback Arguement 
				if(!blnEventTargetFound)
					asyncAddField(objFormToCheck,'hidden',EVT_TARGET,'');

				if(!blnEventArgFound)
					asyncAddField(objFormToCheck,'hidden',EVT_ARG,'');	
		}
		function asyncAddField(form, fieldType, fieldName, fieldValue) 
		{
			if (document.getElementById) 
			{
				var input = document.createElement('INPUT');
				if (document.all) 
				{ 
					// what follows should work 
					// with NN6 but doesn't in M14
					input.type = fieldType;
					input.name = fieldName;
					input.value = fieldValue;
				}
				else if (document.getElementById) 
				{ 
					// so here is the
					// NN6 workaround
					input.setAttribute('type', fieldType);
					input.setAttribute('name', fieldName);
					input.setAttribute('value', fieldValue);
				}
				form.appendChild(input);
			}
		}
		function asyncFindElement(objToSearch,strElementName)
		{
			//alert("\nLooking For: " + strElementName + "\nLooking at ID: " + objToSearch.id + "\nLooking at Name: " + objToSearch.name);
			
			
			if(objToSearch.id == strElementName || objToSearch.name == strElementName)
				return objToSearch;
			else
				for(var i = 0; i < objToSearch.childNodes.length; i++)
				{
					var objRet = asyncFindElement(objToSearch.childNodes[i],strElementName);
					if(objRet != null)
					{					
						return objRet;
					}
					
				}		
			return null;
		}
		
		
		function check_field_length(objfield, min, max) {

			var bolfield_good = false
			var f = document.forms["Form1"]

			var bolfield_good = true

			if (f.elements[objfield].value.length < min || f.elements[objfield].value.length > max) {
				bolfield_good = false
			}

			return bolfield_good
		}

		function clearAmount(source,arguments){
			var f = document.forms["Form1"]
		
			for (var i = 0; i < f.rdopayment_amount.length; i++) {
				if (f.rdopayment_amount[i].checked && f.rdopayment_amount[i].value != 'other') {
					f.txtpayment_amount.value = "";
				}
			}		
		}
			
		function clicard_number_length_check(source, arguments) {

			var f = document.forms["Form1"]
			if (f.drpcard_type[f.drpcard_type.selectedIndex].value == 'AMEX')
				bolfield_good = check_field_length('txtcard_number', 15, 15)
			else
				bolfield_good = check_field_length('txtcard_number', 16, 16)

			if(bolfield_good) {
				arguments.IsValid = true;
			}
			else {
				arguments.IsValid = false;
			}
		}

		function clipayment_amount_check(source, arguments) {

			
		}
	

		function clivalidate_email(source, arguments) {

			var f = document.forms["Form1"];
			var sString = f.txtemail_address.value
			var iPeriod
			var iAt
			var eAt

			iPeriod = sString.indexOf(".")
			ePeriod = sString.lastIndexOf(".")
			iAt = sString.indexOf("@")
			eAt = sString.lastIndexOf("@")

			if (iAt != eAt || iPeriod == 0 || iAt == 0 || iPeriod == -1 || iAt == -1 || iAt == sString.length || iPeriod == sString.length-1 || iPeriod == iAt + 1 || iAt == iPeriod + 1 || ePeriod == sString.length-1 || eAt > ePeriod)
				arguments.IsValid = false;
			else
				arguments.IsValid = true;
		}

		function clivalidate_exp_date(source, arguments) {

			var f = document.forms["Form1"];

			var dtetoday = new Date();

			var intMonth = dtetoday.getMonth();
			var intYear = dtetoday.getFullYear();

			var dtetoday_noday = new Date(intYear , intMonth , 01)
			
			intMonth = f.drpexpiration_month[f.drpexpiration_month.selectedIndex].value - 1;
			intYear = "20" + f.drpexpiration_year[f.drpexpiration_year.selectedIndex].value;
			
			var dteexpiration_noday = new Date(intYear , intMonth , 01)

			if (dtetoday_noday > dteexpiration_noday)
				arguments.IsValid = false;
			else
				arguments.IsValid = true;
		}

		function clivalidate_state(source, arguments) {

			var f = document.forms["Form1"];
			var bolfield_good;
			var txtfield = f.txtstate.value;
			var txtchar;

			bolfield_good = true;

			if (bolfield_good) {
				for (i=0; i < txtfield.length; i++) {
					txtchar = txtfield.charAt(i);
					if (!(txtchar >= 'A' && txtchar <= 'Z') && !(txtchar >= 'a' && txtchar <= 'z'))
						bolfield_good = false;
				}
			}

			arguments.IsValid = bolfield_good;
		}

		function clivalidate_zip_code(source, arguments) {

			var f = document.forms["Form1"];
			var bolfield_good;
			var txtfield = f.txtzip_code.value;
			var txtchar;

			bolfield_good = true;

			if(txtfield.length != 0) {
				if(!(txtfield.length == 5 || txtfield.length == 10)) {
					bolfield_good = false;
				}
				else {
					for (i=0; i < txtfield.length; i++) {
						txtchar = txtfield.charAt(i);
						if (!((txtchar >= '0' && txtchar <= '9') || (txtchar == '-'))) {
							bolfield_good = false;
						}
					}

					if(txtfield.length == 5) {
						if(txtfield.indexOf('-') != -1) {
							bolfield_good = false;
						}
					}

					if(txtfield.length == 10) {
						if(txtfield.indexOf('-') != 5) {
							bolfield_good = false;
						}
					}
				}
			}

			arguments.IsValid = bolfield_good;

		}

		function clivalidate_card_number(source, arguments) {

			var f = document.forms["Form1"];
			var bolfield_good;
			var txtfield = f.txtcard_number.value;
			var txtchar;

			bolfield_good = true;

			if (bolfield_good) {
				for (i=0; i < txtfield.length; i++) {
					txtchar = txtfield.charAt(i);
					if (txtchar < '0' || txtchar > '9')
						bolfield_good = false;
				}
			}

			arguments.IsValid = bolfield_good;
		}

				
		
		function SubmitCalc()
		{
			var f = document.forms["Form1"]

			if (confirm("Need some copy here for submit and charge the credit card"))
			{
				f.submit()
			}
		}

 		function open_window(docName,hSize,wSize)
		{
			var w = window.open(docName,"openScript",'width=' + wSize + ',height=' + hSize + ',resizable=1,scrollbars=1,menubar=1,status=0' );
			if (window.focus)
			{
				w.focus();
			}
		}
<!-- Copyright 2003 Bontrager Connection, LLC
// Code obtained from http://WillMaster.com/
//
// Each required form field can be checked with JavaScript. Here are 
//    the function names for the different kinds of checks:
//
//       1. WithoutContent() -- check if the text, textarea, password, 
//              or file fields has no content.
//       2. NoneWithContent() -- check if none of the set of text, 
//              textarea, password, or file fields have content. 
//              (Set: More than one with the same field name.)
//
//       3. NoneWithCheck() -- check if none of the set of radio buttons 
//              or checkboxes are checked. (Set: More than one with the 
//              same field name.)
//       4. WithoutCheck() -- check if the single radio button or checkbox 
//              is unchecked.
//
//       5. WithoutSelectionValue() -- check if selected drop-down list or 
//              select box entries have no value.
//
//
// The format for using the above functions is
//             if(       WithoutContent([FORMFIELDVALUE])) [ERRORMESSAGE]
//             if(      NoneWithContent([FORMFIELD])     ) [ERRORMESSAGE]
//             if(        NoneWithCheck([FORMFIELD])     ) [ERRORMESSAGE]
//             if(         WithoutCheck([FORMFIELD])     ) [ERRORMESSAGE]
//             if(WithoutSelectionValue([FORMFIELD])     ) [ERRORMESSAGE]
//
// The if(...) part and the error message part may be on separate lines, like
//             if(WithoutContent([FORMFIELDVALUE]))
//                [ERRORMESSAGE]
//             if(NoneWithContent([FORMFIELD]))
//                [ERRORMESSAGE]
//             if(NoneWithCheck([FORMFIELD]))
//                [ERRORMESSAGE]
//             if(WithoutCheck([FORMFIELD]))
//                [ERRORMESSAGE]
//             if(WithoutSelectionValue([FORMFIELD]))
//                [ERRORMESSAGE]
//
//
//      FORMFIELD -- The format for specifying a "form field" is 
//                         document.[FORMNAME].[FIELDNAME]
// FORMFIELDVALUE -- The format for specifying a "form field value" is 
//                         document.[FORMNAME].[FIELDNAME].value
//   ERRORMESSAGE -- The format for specifying an "error message" is
//                         { errormessage += "\n\n[MESSAGE]"; }
//                   If the message itself contains quotation marks, 
//                      they must be preceded with a back slash. 
//                      Example: \"
//
//
//      FORMNAME -- The name assigned to the form in the <FORM... tag. 
//     FIELDNAME -- The field name being checked.
// 
//
// For use with this JavaScript, the only non-alphanumeric character a 
//    fieldname may have is the underscore. Replace any hyphens, colons, 
//    spaces, or other non-alphanumeric characters in your field names 
//    with an underscore character.
//
//
// Put field checks into the function CheckRequiredFields(), in the order 
//    you want the fields checked.
//


function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.

if(WithoutContent(document.Form1.txtfirst_name.value))
	{ errormessage += "\n\nPlease enter your first name."; }
if(WithoutContent(document.Form1.txtlast_name.value))
	{ errormessage += "\n\nPlease enter your last name."; }
if(WithoutContent(document.Form1.txtaddress.value))
	{ errormessage += "\n\nPlease enter your address."; }
if(WithoutContent(document.Form1.txtcity.value))
	{ errormessage += "\n\nPlease enter your city."; }
if(WithoutContent(document.Form1.txtstate.value))
	{ errormessage += "\n\nPlease enter your state."; }
if(WithoutContent(document.Form1.txtzip_code.value))
	{ errormessage += "\n\nPlease enter your zip code."; }
if(WithoutContent(document.Form1.txtemail_address.value))
	{ errormessage += "\n\nPlease enter your email address."; }

// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:' + errormessage);
	return false;
	}
return true;
} // end of function CheckRequiredFields()


function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].value.length > 0) { return false; }
	}
return true;
}

function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].checked) { return false; }
	}
return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value.length) { return false; }
		}
	}
return true;
}
