function validate_newadvert(){
	
	var title = document.getElementById('title');
	var es_email = document.getElementById('es_email');
	
	var country = document.getElementById('country');
	var type = document.getElementById('type');
			
	valid = true;
	
	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;

    return valid;
	
}

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="";
	}
	
}

