// JavaScript Document
function initit(it) {
	if (it.id=="howmuch") {
		it.value = "";
		it.style.color="#000";
		it.id="thismuch";
	}
}
function test_format(r, s) {
	if (s != null) {
		re = new RegExp(r); 
		var matching = re.test(s);
		return matching;
	} else { 
		return false
	}
}
var goodstuff = new Object(); 
goodstuff['whoisit'] = "^[^\"]{3,}$";
goodstuff['thismuch'] = "^[0-9]{1,8}\.?[0-9]{0,2}$";

function isitdone() {
	for (key in goodstuff) {
		if ($(key) != null) { 
			if (!(test_format(goodstuff[key],$(key).value))) {
					//document.getElementById('changethis').innerHTML = goodstuff[key] + ": " + test_format(goodstuff[key],$(key).value);       //for testing 
					$('changethis').style.zIndex="5";
					$('fillitout').innerHTML = '<p>Please fill out both fields in order to use this Paypal button.  Thanks!</p>';
					return false					 
			}
		} else {
			return false
		}
	}
	$('return').value="http://www.transfairusa.org/artisan/thankyou.php?w="+escape($('whoisit').value)+"&h="+$('thismuch').value;
	$('item_number').value=escape($('whoisit').value);
	$('amount').value=$('thismuch').value;
	$('fillitout').innerHTML = '';
	$('changethis').style.zIndex="-10";
}
function fillitout() {
	var effect = new Effect.Highlight('fillitout', {duration: 2, startcolor: '#ffff11'}); 
	//$('fillitout').innerHTML = "Please fill out both fields in order to use this Paypal button.  Thanks!<br />";
	//alert('Please fill out both fields in order to use the Paypal button.  Thanks!');
}
