// for donations
function gaCheck2(x) {

	// get the currency
	for (i=0; i < 3; i++) {
		if (x.currency[i].checked == true) {
			cur = x.currency[i].value;
		}
	}

	//if (x.amount == null || x.amount.value == " " || x.amount.value == "") {
	if (x.amount.value.length == 0 || x.amount == null || x.amount.value == " " || x.amount.value == "") {
		alert("Please enter a valid amount");
		return false;
	}
	if (x.amount.value.length > 0) {
		if (!IsNumeric(x.amount.value)) {
			alert("Please enter a valid number");
			return false;
		}
	}
	if (x.amount.value < 3 && cur == 'GBP') {
		alert("To keep our costs as low as possible, we can only accept donations of 3 " + cur + " or more.");
		return false;
	}
	if (x.amount.value < 4 && cur == 'EUR') {
		alert("To keep our costs as low as possible, we can only accept donations of 4 " + cur + " or more.");
		return false;
	}
	if (x.amount.value < 6 && cur == 'USD') {
		alert("To keep our costs as low as possible, we can only accept donations of 6 " + cur + " or more.");
		return false;
	}
	
	var d = document.getElementById("day");
	var myday = d.options[d.selectedIndex].value;
	var m = document.getElementById("month");
	var mymonth = m.options[m.selectedIndex].value;
	mymonth = mymonth -1;
	var y = document.getElementById("year");
	var myyear = y.options[y.selectedIndex].value;
	var mydate = new Date(myyear, mymonth, myday);
	
	var currentTime = new Date();
	//alert(mydate);
	
	if (mydate < currentTime) {
		alert("Please choose a date in the future.");
		return false;
	}
	
	return true;

}
	
function gaCheck(x) {

	if (x.donationmin == null || x.donationmin.value == " ") {
		alert("Please enter a valid amount");
		return false;
	} else {
		return true;
	}

}

// pop-ups
function winpop(path,name,x,y) {

	window.open(path,name,'width='+x+',height='+y+',scrollbars=yes,resizable=yes,status=no');

}


// submits the search minus the x and y coordinates of the form submit image
function submitSearch() {
	
	document.searchSite.submit();
	
}

function IsNumeric(sText) {
 var ValidChars = "0123456789.";
 var IsNumber=true;
 var Char;

 for (i = 0; i < sText.length && IsNumber == true; i++) { 
 Char = sText.charAt(i); 
 if (ValidChars.indexOf(Char) == -1) {
 IsNumber = false;
 }
 }
 return IsNumber;
   
}
