function echeck(formname,fieldname,fieldtitle) {

	var fullfield = document.forms[formname].elements[fieldname];
	var str = fullfield.value;
	
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	
	if (str.indexOf(at)==-1){
		alert('Please enter a valid ' + fieldtitle);
		fullfield.focus();
		return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		alert('Please enter a valid ' + fieldtitle);
		fullfield.focus();
		return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert('Please enter a valid ' + fieldtitle);
		fullfield.focus();
		return false;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		alert('Please enter a valid ' + fieldtitle);
		fullfield.focus();
		return false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert('Please enter a valid ' + fieldtitle);
		fullfield.focus();
		return false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		alert('Please enter a valid ' + fieldtitle);
		fullfield.focus();
		return false;
	 }
	
	 if (str.indexOf(" ")!=-1){
		alert('Please enter a valid ' + fieldtitle);
		fullfield.focus();
		return false;
	 }

	 return true;					
}





function fieldcheck(formname,fieldname,fieldtitle) {
	var fullfield = document.forms[formname].elements[fieldname];

	if ((fullfield.value==null)||(fullfield.value=="")){
		alert('Please enter a valid ' + fieldtitle);
		fullfield.focus();
		return false;
	}
	return true;
}





function radiocheck(formname,fieldname,fieldtitle) {
	var fullfield = document.forms[formname].elements[fieldname];

	var checkbox_choices = 0;

	// Loop from zero to the one minus the number of checkbox button selections
	for (i = 0; i < fullfield.length; i++) {

		// If a checkbox has been selected it will return true
		// (If not it will return false)
		if (fullfield[i].checked) { 
			checkbox_choices = checkbox_choices + 1; 
		}

	}

	if (checkbox_choices == 0){
		alert('Please choose a valid ' + fieldtitle);
		return false;
	}
	return true;
}






function PassCheck(formname,passfield,confirmfield) {

	var fullpassfield = document.forms[formname].elements[passfield];
	var fullconfirmfield = document.forms[formname].elements[confirmfield];
	
	if (fullpassfield.value!=fullconfirmfield.value) {
		alert('Please re-type your Password and Password Confirmation.');
		fullpassfield.focus();
		return false;
	}
	return true;
}

