function validate_acc(){
	
	var name = document.getElementById('name');
	var surname = document.getElementById('surname');
	var email = document.getElementById('email');
				
	valid = true;
	
	if( isEmail_a(email, "Required") )valid = false;
	if( isSurname(surname, "Required" ) )valid = false;
	if( isName(name, "Required" ) )valid = false;

    return valid;
	
}

function validate_advert(){
		
	var name = document.getElementById('name');
	var surname = document.getElementById('surname');
	var email = document.getElementById('email');
	
	var title = document.getElementById('title');
	var es_email = document.getElementById('es_email');
	
	var country = document.getElementById('country');
	var type = document.getElementById('type');
	var code = document.getElementById('code');
			
	valid = true;
	
	if( isCode(code, "Required" ) )valid = false;
	if( isType(type, "Required") )valid = false;
	if( isCountry(country, "Required") )valid = false;
	
	if( isEsEmail(es_email, "Required") )valid = false;
	if( isTitle(title, "Required") )valid = false;
	if( isEmailc(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 isCode(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('code_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('code_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 isEmailc(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 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 isCountry(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('country_validate').style.backgroundColor="#FF626D";
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('country_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="";
	}
	
}

