function validateForm(){
		pForm = document.getElementById('frmPayment');
		var result;
		if(pForm.CreditCardAmount.value == '' || pForm.CreditCardAmount.value <= 0)
		{
			alert("Please insert a amount.");
			pForm.CreditCardAmount.focus();
			return false;
		}		
		if(pForm.BillingAddress.value == '')
		{
			alert("Please insert the billing address.");
			pForm.BillingAddress.focus();
			return false;
		}				
		else if(pForm.CreditCardNumber.value.length < 13)
		{
			alert("Please insert the credit card number.");
			pForm.CreditCardNumber.focus();
			return false;
		}
		else if(pForm.CreditCardCVV.value == '')
		{
			alert("Please insert the credit card's cvv number.");
			pForm.CreditCardCVV.focus();
			return false;
		}
		else if(pForm.FirstName.value == '')
		{
			alert("Please insert the card holder's name.");
			pForm.FirstName.focus();
			return false;
		}
		else if(pForm.LastName.value == '')
		{
			alert("Please insert the card holder's name.");
			pForm.LastName.focus();
			return false;
		}
		else if(pForm.BillingZip.value == '')
		{
			alert("Please insert the credit card's zip code.");
			pForm.BillingZip.focus();
			return false;
		}
		else if (isErrorOnForm() == true)
		{
			alert(result.ERRORMSG);
			return false;
		}
		function isErrorOnForm(){
			var url = 'validateForm.cfm';
			var params = $('frmPayment').serialize();
			var ajaxRequest = new Ajax.Request( url, { asynchronous:false, evalScript: false, method: 'get', parameters: params });
			result = ajaxRequest.transport.responseText.evalJSON();
			return result.ISERROR;
		} 		
		return true;
	}
	function validateNumeric(e, sValue, acceptPeriods, acceptNegatives)
	{
		var key;
		var keychar;
		
		if (sValue === undefined) var sValue = '';
		if (acceptPeriods === undefined) var acceptPeriods = true;
		if (acceptNegatives === undefined) var acceptNegatives = false;
		
		if (window.event)
			key = window.event.keyCode;
		else if (e)
			key = e.which;
		else
			return true;
			
		keychar = String.fromCharCode(key);

		if((sValue.split(".").length-1 > 0 && keychar == '.') || 
				(sValue.split("-").length-1 > 0 && keychar == '-'))
			return false;
		else if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || 
				((acceptPeriods) && (key==46)) || ((acceptNegatives) && (key==45)))
			return true;
		else if ((("0123456789").indexOf(keychar) > -1))
			return true;
	
		return false;
	}
	function assignAttributes(){
		/* Billing Form */
		document.forms[0].BillingZip.id = 'zip2';
		document.forms[0].BillingZip.onkeyup = function(){
			checkZip(this.id);	
		}		
		document.forms[0].BillingCity.id = 'BillingCity';
		document.forms[0].BillingState.id = 'BillingState';
		
	}
	function checkZip(nameofzip) {
		if($F(nameofzip).length == 5){
		var url = '/checkZip.cfm';
		var params = 'zip=' + $F(nameofzip);
		new Ajax.Request(
		  url,
		  { method: 'get', parameters: params,
		  onComplete: function(request) {
		   ProcessResults(request.responseText);
		  },
		  evalScript: false
		  }
		 );
		 
		function ProcessResults(responseText)	{
			
			try //Internet Explorer
			{
				xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
				xmlDoc.async="false";
				xmlDoc.loadXML(responseText);
			}
			catch(e)
			{
				try //Firefox, Mozilla, Opera, etc.
				{
					parser=new DOMParser();
					xmlDoc=parser.parseFromString(responseText,"text/xml");
				}
				catch(e)
				{
					alert(e.message);
					return;
				}
			}
			document.getElementById('BillingCity').value = xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;
			document.getElementById('BillingState').value = xmlDoc.getElementsByTagName("state")[0].childNodes[0].nodeValue;	
			} 
		}
	}		
	window.onload = assignAttributes;	