/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: wsabstract.com | http://www.wsabstract.com */

function checkrequired(which) {
	var pass=true;
	var text = "";
	
	for (i = 0; i < which.length; i++) {
		var tempobj = which.elements[i];
		
		if (tempobj.getAttribute('required')) {
			if ( 
				( ( tempobj.type == "text" || tempobj.type == "textarea" ) &&
					tempobj.value == '') /* || 
				(	tempobj.type.toString().charAt(0)=="s" &&
					tempobj.selectedIndex == 0 ) */
				) {
				text = text + tempobj.getAttribute('required') + "\n";
			}
		}
	}

	if (text != "") {
		alert("You should fill these required fields: \n\n" + text);
		return false;
	} else {
		return true;
	}
}

function checkusername(which) {
	if (document.edituser.userName.value.indexOf(' ') == -1) {
		return checkrequired(which)
	} else {
		alert('The user name should not have spaces, please try again')
		return false
	}			
}

