/* Donate. If you intend to use a ' , then proceed it with a \ , like \' to tell JavaScript that
   you intend to show it. Or else the script will crash. */

function level(level)
{

document.write('<form action="https://www.codoh.com/donate/ahowyoucanhelp.php" method="post" name="donate" onsubmit="return check();">\n' +
			'<p>\n' +
			'Amount : <input type="text" name="AMT" maxlength="6" size="6" />\n' +
			' Donation Period : <select name="billingPeriod">\n' +
			'<option selected="selected" value="Once">Once</option>\n' +
			'<option value="Day">Daily</option>\n' +
			'<option value="Week">Weekly</option>\n' +
			'<option value="Month">Monthly</option>\n' +
			'<option value="Year">Yearly</option>\n' +
			'</select><br /><br />\n' +
			'Recurring for: <select name="Recurring">\n' +
			'<option value=""></option>\n' +
			'<option value="One">One year</option>\n' +
			'<option value="Two">Two years</option>\n' +
			'<option value="Three">Three years</option>\n' +
			'<option value="Four">Four years</option>\n' +
			'<option value="Five">Five years</option>\n' +
			'</select>\n' +
			'<input type="image" src="' + level + 'images/xpp_buttn.png" name="submit" alt="Thank you for making this donation, every little helps!" />\n' +
			'</p>\n' +
		'</form>\n' +
		'<script type="text/JavaScript">\n' +
		'function check()\n' +
		'{' +
			'// Variables for only allow numbers to be entered\n' +
			'var numericExpression = /^[0-9]+$/;\n' +

			'// Check empty fields.\n' +
			'//-------------------------------------------------------------------\n' +
			'// Amount\n' +
			'if (document.donate.AMT.value == "")\n' +
			'{\n' +
				'alert ("Please fill in an amount, it can\'t be empty!")\n' +
				'document.donate.AMT.select();\n' +
				'document.donate.AMT.focus();\n' +
				'return false;\n' +
			'}\n' +

			'// Check so not zero.\n' +
			'//-------------------------------------------------------------------\n' +
			'// Amount\n' +
			'if (document.donate.AMT.value == 0)\n' +
			'{\n' +
				'alert ("Please fill in an amount, it can\'t be 0!")\n' +
				'document.donate.AMT.select();\n' +
				'document.donate.AMT.focus();\n' +
				'return false;\n' +
			'}\n' +

			'// Check so only numbers.\n' +
			'//-------------------------------------------------------------------\n' +
			'// Amount\n' +
			'if(!(document.donate.AMT.value.match(numericExpression)))\n' +
			'{\n' +
				'alert ("Please fill in an amount, it can only be digits!")\n' +
				'document.donate.AMT.select();\n' +
				'document.donate.AMT.focus();\n' +
				'return false;\n' +
			'}\n' +
			'// Check so Recurring time is selected when billing period != "Once".\n' +
			'//-------------------------------------------------------------------\n' +
			'// Recurring\n' +
			'if(!(document.donate.billingPeriod.value == "Once") &&\n' +
      				'(document.donate.Recurring.value == "" ) )\n' +
			'{\n' +
			'alert ("Please select a recurring time!")\n' +
			'return false;\n' +
			'}\n' +
			'return true;\n' +
		'}\n' +
		'</script>\n');

}



