		var toggleVal = function (v) {
			if ($(v).getValue() == "Email Address")
			{
				$(v).clear();
			}
		}, 
		toggleValBack = function (v) {
			if ($(v).getValue() == "")
			{
				$(v).value = "Email Address";
			}
		};
		
		function mnnSignup()
		{
			$("mnn").hide();
			var url = '/newsletter.cfm';
			// notice the use of a proxy to circumvent the Same Origin Policy.
			new Ajax.Request(url, {
			  method: 'post',
			  parameters: { email: $F("email") },
			  onSuccess: function(transport) {
			    var notice = $('msg_mnn');
			    if (transport.responseText.match(/Thank/))
			      notice.update('<strong>Thank you for subscribing to the Military Network Newsletter!</strong>');
			    else
			      notice.update('Sorry we were unable to register you at this time. Please try again later.');
				notice.show();
			  }
			});
		}
		
		function validate()
		{
			$("msg_mnn").hide();
			if(validateFields())
			{
				$("msg").hide();
				mnnSignup();
			}
			else
			{
				$("msg").show();
			}
		}

		function validateFields()
		{
			var retVal = false,
			    badVals = [],
			    emailRegex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
				requiredFields = [
					"email"
				];
		
			// Loop through required fields
			requiredFields.each(function (item) {
				if($(item).getValue() == "" || $(item).getValue() == "XX")
				{
					badVals.push(item);
					$(item + "_req").show();
				}
				else
				{
					$(item + "_req").hide();
				}
			});
			// All required fields are filled
			if(badVals.length == 0)
			{
				retVal = true;
			}
					
			// Check e-mail is valid format using rege
			// alert($("email").getValue().match(emailRegex));
			if($("email").getValue().match(emailRegex) == null)
			{
				$("emailformat").show();
				retVal = false;
			}
			else
			{
				$("emailformat").hide();
			}
			return retVal;
		}
