function validContact(){
	var o = {
	'nume' : 'null',
	'email' : 'email',
	'telefon' : 'null',
	'mesaj' : 'null'
}
		var mess ="Va rugam sa completati toate campurile obligatorii.";

		if(!array_map(o, function(key, val){})){
			alert(mess)
			return false;
		}

		return true
}

function validConsultant(){
	var o = {
	'nume' : 'null',
	'prenume' : 'null',
	'email' : 'email',
	'telefon' : 'null',
	'compania' : 'null',
	'mesaj' : 'null'
}
		var mess ="Va rugam sa completati toate campurile obligatorii.";

		if(!array_map(o, function(key, val){})){
			alert(mess)
			return false;
		}

		return true
}

function validEmail(){
	var o = {
	'oememail' : 'email'
}
		var mess ="Adresa de email nu este corecta.";

		if(!array_map(o, function(key, val){})){
			alert(mess)
			return false;
		}

		return true
}

function notnull(element){
		if($(element).value.length == 0 ){
			$(element).style.border = "2px solid #cc0000"
			return false
		}
		return true
}
		
function isEmail(element){
		var validationRule = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/
		if(!(validationRule.test($(element).value))){
				$(element).style.border = "2px solid #cc0000"
				return false;
			}
		return true
}

function oneString(element, text){
	if($(element).value == text ){
		$(element).style.border = "2px solid #cc0000"
		return false
	}
	return true
}

function array_map(hash, iter) {
		var ok = 0;
			for (var i in hash) {
				if (typeof(hash[i]) != "function") iter(i, hash[i]);

				switch (hash[i]){
					case "null":
						if(!notnull(i)){ok ++}
					break;

					case "email":
						if(!isEmail(i)){ok ++}
					break;
					
					case "text":
						if(!oneString(i, '0')){ok ++}
					break;
				}
				
			}
			if(ok >= 1){return false }else {return true}
		}
                
function $(element){
                return document.getElementById(element)
}