//This is the requited field checker, to make sure the needed information in present
// before the informatio is set to google checkout;
function mychecker(){
	var message = "";
	$$('input.required').each(function(fInput){
		var tmp = fInput.getValue().stripScripts().strip();
		if(tmp.blank()){
			message += "\n<p>" + fInput.readAttribute('name') + ": Required</p>";
		}
	});
	if(!message.blank()){
		$('errorMessage').update(message);
		$('errorMessage').addClassName('errorMessage');
		return false;
	}
	else{
		$('errorMessage').hide();
	}

	if($('item_name_2').readAttribute('value').empty()){
		$('BB_BuyButtonForm').setAttribute('action', 'https://checkout.google.com/cws/v2/Merchant/339410281660795/checkoutForm');
		$('item_name_2').remove();
		$('item_quantity_2').remove();
		$('item_description_2').remove();
		$('item_price_2').remove();
		$('item_currency_2').remove();
	}
	//alert($('main_form').serialize());
	new Ajax.Request('/mailform.php',
		{
			method:'post',
			parameters: $('main_form').serialize(),
			onSuccess: function(transport){
				var response = transport.responseText || "no response text";
			},
			onFailure: function(){  }
		}
	);

	return true;
}