function CheckTermsCheckbox()
{
	form = document.summerentrepreneurshipapplicationform;

	//	Team 1 email required
	control_1	= form["fields[Team 1 Name]"];
	control_2	= form["fields[Team 1 Email]"];
	upload		= form["resume1"];

	if( str_trim( control_1.value ) && !str_trim( control_2.value ) )
	{
		alert("Please enter an email address for the first team member.");
		control_2.focus();
		return false;
	}

	//	PDF upload?
	if( str_trim( control_1.value ) && !str_trim( upload.value ) )
	{
		alert("Pleaes attach a resumé for the first team member.");
		upload.focus();
		return false;
	}
	
	//	Team 2 email required
	control_1	= form["fields[Team 2 Name]"];
	control_2	= form["fields[Team 2 Email]"];
	upload		= form["resume2"];

	if( str_trim( control_1.value ) && !str_trim( control_2.value ) )
	{
		alert("Please enter an email address for the second team member.");
		control_2.focus();
		return false;
	}

	//	PDF upload?
	if( str_trim( control_1.value ) && !str_trim( upload.value ) )
	{
		alert("Pleaes attach a resumé for the second team member.");
		upload.focus();
		return false;
	}
	
	//	Team 3 email required
	control_1	= form["fields[Team 3 Name]"];
	control_2	= form["fields[Team 3 Email]"];
	upload		= form["resume3"];
	
	if( str_trim( control_1.value ) && !str_trim( control_2.value ) )
	{
		alert("Please enter an email address for the third team member.");
		control_2.focus();
		return false;
	}
	
	//	PDF upload?
	if( str_trim( control_1.value ) && !str_trim( upload.value ) )
	{
		alert("Pleaes attach a resumé for the third team member.");
		upload.focus();
		return false;
	}

	//	Team 4 email required
	control_1	= form["fields[Team 4 Name]"];
	control_2	= form["fields[Team 4 Email]"];
	upload		= form["resume4"];
	
	if( str_trim( control_1.value ) && !str_trim( control_2.value ) )
	{
		alert("Please enter an email address for the fourth team member.");
		control_2.focus();
		return false;
	}

	//	PDF upload?
	if( str_trim( control_1.value ) && !str_trim( upload.value ) )
	{
		alert("Pleaes attach a resumé for the fourth team member.");
		upload.focus();
		return false;
	}

	ureq1		= getCheckedValue( form["fields[UR 1]"] );
	ureq2		= getCheckedValue( form["fields[UR 2]"] );
	ureq3		= getCheckedValue( form["fields[UR 3]"] );
	ureq4		= getCheckedValue( form["fields[UR 4]"] );

	if( ureq1 != 1 && ureq2 != 1 && ureq3 != 1  && ureq4 != 1  )
	{
		alert("At least one team member must meet the university requirement.");
		return false;
	}

	control = form["fields[Terms & Conditions]"];
	if ( !control.checked )
	{
		alert("Agreement to the Terms & Conditions is required.");
		control.focus();
		return false;
	}

	return true;

}

//	Textarea maxlength
function DS( field,maxLength )
{
	clipped		= false;

	if (field.value.length > maxLength)
	{
		field.value = field.value.substring(0,maxLength);
		charleft = 0;
		clipped = true;
	}
	else
	{
		charleft = maxLength - field.value.length;
	}
//	document.myForm.msgCL.value = charleft;

/*
	counter_id	= field.getAttribute( "id" ) + "-c";

	document.getElementById( counter_id ).innerHTML	= charleft;

	if( charleft )
	{
		document.getElementById( counter_id ).className	= "";
	}
	else
	{
		document.getElementById( counter_id ).className	= "zero";
	}
*/
	return clipped;
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
