function validate_app(){
	
	var name = document.getElementById('first_name');
	var surname = document.getElementById('surname');
	var email = document.getElementById('email');
	var id_number = document.getElementById('id_number');
				
	valid = true;
	
	if( isID(id_number, "Required") )valid = false;
	if( isEmail_a(email, "Required") )valid = false;
	if( isSurname(surname, "Required" ) )valid = false;
	if( isName(name, "Required" ) )valid = false;

    return valid;
	
}

function isName(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('name_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('name_validate').style.backgroundColor="";
	}
	
}

function isSurname(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('surname_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('surname_validate').style.backgroundColor="";
	}
	
}


function isID(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('id_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('id_validate').style.backgroundColor="";
	}
	
}

function isEmail_a(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('email_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('email_validate').style.backgroundColor="";
	}
	
}

function isTitle(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('title_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('title_validate').style.backgroundColor="";
	}
	
}

function isEsEmail(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('es_email_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('es_email_validate').style.backgroundColor="";
	}
	
}

//////////////////////////////////////////////////////////////////////////////////////////////////

function isProvince(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('province_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('province_validate').style.backgroundColor="";
	}
	
}

function isCity(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('city_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('city_validate').style.backgroundColor="";
	}
	
}

function isType(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('type_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('type_validate').style.backgroundColor="";
	}
	
}
