/* author: info@starbits.com */
/* Creation date: 3/27/2006 */
function formCheck() {

var webaddr="https://www.paypal.com/cgi-bin/webscr?",
parms="cmd=_xclick&business=javsicas@pentrans.org&item_name=PenTrans&no_shipping=1&no_note=1&currency_code=USD&return=http://www.pentrans.org/thanks.shtml&amount=";
var total = 0;

// Check for blank name or email 
if (mform.Name.value.length < 2 || mform.email.value.length < 6) {
	alert ("You must enter both your name and a valid email address.");
return false;
}

// Calculate payment due
total = (parseInt(mform.Member.value,10) * 50) + (parseInt(mform.Individual.value,10) * 75);
// also for student include:  + (parseInt(mform.Student.value,10) * 0)

for (i=0; i<2; i++){
	if(mform.sponsorlevel[i].checked) total += parseInt(mform.sponsorlevel[i].value, 10);
}

if (isNaN (total) || typeof total == "string" || typeof total == "undefined" || total == 0) {
	alert('Error: please either select a level of sponsorship (Gold, Silver or Bronze) or make sure all the General Admission quantities entered are numeric. You must select at least one registration type. If you wish to contact PenTrans without registering for this event, please use the form on the Contact Us page instead.');
	return false;
}

// Create proper URL for Paypal 
mform.redirect.value = webaddr + parms + total;
return true;
}