/**
 * Array to check, if everything is filled out properly
 */ 
var completeArray = new Array("0","0","0","0");

/**
 * If checkAll was activated
 */
var checkAll_on = 0;

function checkForename(username) {

}

function checkSurname(username) {

}

function checkBirthday(username) {

}

/**
 * checkUser() checks if typed username is valid and unique
 * @param {Object} username typed Username
 */
function checkUser(username) {	
	
	/*username = trim(username);
	
	if(checkAll_on == 1) {
		setHTMLElement("allstatus","","");
		checkAll_on = 0;
	}
	
	if(username.length==0) {
		setCompleteArray("status_username", "0");
		setError("status_username", "Name ungültig");
		return false;
	}
	else{
		if(username.length<3){
			setCompleteArray("status_username", "0");
			setError("status_username", "Minimum 3 Zeichen");
			return false;
		}		
	}*/
}

/**
 * checkPass() checks if typed Password is valid
 * @param {Object} pass typed Password
 */
function checkPass(pass) {
	
	/*pass = trim(pass);
	
	if(checkAll_on == 1) {
		setHTMLElement("allstatus","","");
		checkAll_on = 0;
	}
	
	if(pass.length==0) {
		setCompleteArray("status_pass", "0");
		setError("status_pass", "Passwort ungültig");
		return false;
	}
	else{
		if(pass.length<5){
			setCompleteArray("status_pass", "0");
			setError("status_pass", "Minimum 5 Zeichen");
			return false;
		}
		else {
			setCompleteArray("status_pass", "1");
			setSuccess("status_pass");
			return true;
		}
	}	*/
}

/**
 * checkPass2() checks if typed password is valid and matches the first password 
 * @param {Object} pass typed Password
 */
function checkPass2(pass) {
	
	/*pass = trim(pass);
	
	if(checkAll_on == 1) {
		setHTMLElement("allstatus","","");
		checkAll_on = 0;
	}
	
	//first Password
	var passID = document.getElementById("passID").value;
	checkPass(passID);
	if(pass.length==0) {
		setCompleteArray("status_pass2", "0");
		setError("status_pass2", "Passwort ungültig");
		return false;
	}
	else{
		if(pass.length<5){
			setCompleteArray("status_pass2", "0");
			setError("status_pass2", "Minimum 5 Zeichen");
			return false;
		}
	}
	if(pass == passID){
		setCompleteArray("status_pass", "1");
		setCompleteArray("status_pass2", "1");
		setSuccess("status_pass");
		setSuccess("status_pass2");
		return true;
	}
	else {
		setCompleteArray("status_pass2", "0");
		setError("status_pass2", "Passwörter stimmen nicht überein");
		return false;
	}	*/
}

/**
 * checkEmail() checks if typed E-Mail is a valid one
 * @param {Object} mail E-Mail-Address
 */
function checkEmail(mail) {
	
	//RegularExpression for correct E-Mail-Address
	/*var reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                   '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                   '(\\.)([a-zA-Z]{2,4})$');
				   
	if(checkAll_on == 1) {
		setHTMLElement("allstatus","","");
		checkAll_on = 0;
	}
				   
	if(reg.test(mail)){
		setCompleteArray("status_email", "1");
		setSuccess("status_email");
		return true;
	}
	else {
		setCompleteArray("status_email", "0");
		setError("status_email", "E-Mail-Adresse ist nicht gültig");
		return false;
	}*/
}

/**
 * checkAll checks if everything is filled out correctly
 */
function checkAll() {
	
	//checkAll activated
	/*checkAll_on=1
	
	for(var i = 0; i<completeArray.length; i++) {		
		if(completeArray[i] != "1") {						
			setError("allstatus", "Du hast das Formular nicht richtig ausgefüllt");			
			return false;
		} 
	}
	return true;*/
}

/**
 * setCompleteArray() sets completeArray to indicate if everything is filled out correct
 * @param {Object} idname name of filled form-element
 * @param {Object} error val Value (0 = Error, 1 = Correct)
 */
function setCompleteArray(idname, val) {
	switch(idname) {
		case "status_username": completeArray[0] = val; break;
		case "status_pass": completeArray[1] = val; break;
		case "status_pass2": completeArray[2] = val; break;
		case "status_email": completeArray[3] = val; break;
	}
}	
