function ValidarUsuario(){
	var todook = true;
	document.getElementById("labelu").style.color= "#CCC";
	document.getElementById("labelp").style.color= "#CCC";
	
	if(document.getElementById("usuario").value == "" ){
		document.getElementById("labelu").style.color = "#C00";
		todook = false;
	}
	
	if(document.getElementById("pass").value == "" ){
		document.getElementById("labelp").style.color = "#C00";
		todook = false;
	}
		
	return todook;
}

function ValidarBanner(){
	var todook = true;
	document.getElementById("labelbanner").style.color= "#000";
	document.getElementById("labelmini").style.color= "#000";
	
	if(document.getElementById("archivo").value == "" ){
		document.getElementById("labelbanner").style.color = "#C00";
		todook = false;
	}
	
	if(document.getElementById("divminiatura").style.display == "block" ){
		if(document.getElementById("miniatura").value == ""){
			document.getElementById("labelmini").style.color = "#C00";
			todook = false;
		}
	}
	
	return todook;
}

function ValidarEmpresa(){
	var todook = true;
	document.getElementById("nombre").style.color= "#036";
	document.getElementById("minima").style.color= "#036";
	document.getElementById("detalle").style.color= "#036";
	document.getElementById("labellogo").style.color= "#000";
	
	if(document.getElementById("nombre").value == "" || document.getElementById("nombre").value.length < 3 || document.getElementById("nombre").value == "Por favor complete este campo"){
		document.getElementById("nombre").style.color= "#C00";
		document.getElementById("nombre").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("minima").value == "" || document.getElementById("minima").value.length < 3 || document.getElementById("minima").value == "Por favor complete este campo"){
		document.getElementById("minima").style.color= "#C00";
		document.getElementById("minima").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("detalle").value == "" || document.getElementById("detalle").value.length < 3 || document.getElementById("detalle").value == "Por favor complete este campo"){
		document.getElementById("detalle").style.color= "#C00";
		document.getElementById("detalle").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("logo").value == "" ){
		document.getElementById("labellogo").style.color = "#C00";
		todook = false;
	}
		
	return todook;
}

function ValidarEmpresa2(){
	var todook = true;
	document.getElementById("nombre").style.color= "#036";
	document.getElementById("minima").style.color= "#036";
	document.getElementById("detalle").style.color= "#036";
	
	if(document.getElementById("nombre").value == "" || document.getElementById("nombre").value.length < 3 || document.getElementById("nombre").value == "Por favor complete este campo"){
		document.getElementById("nombre").style.color= "#C00";
		document.getElementById("nombre").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("minima").value == "" || document.getElementById("minima").value.length < 3 || document.getElementById("minima").value == "Por favor complete este campo"){
		document.getElementById("minima").style.color= "#C00";
		document.getElementById("minima").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("detalle").value == "" || document.getElementById("detalle").value.length < 3 || document.getElementById("detalle").value == "Por favor complete este campo"){
		document.getElementById("detalle").style.color= "#C00";
		document.getElementById("detalle").value = "Por favor complete este campo";
		todook = false;
	}
		
	return todook;
}

function ValidarPrensa(){
	var todook = true;
	document.getElementById("dateArrival").style.color= "#036";
	document.getElementById("titulo").style.color= "#036";
	document.getElementById("minima").style.color= "#036";
	document.getElementById("detalle").style.color= "#036";
	
	if(document.getElementById("dateArrival").value == "" || document.getElementById("dateArrival").value.length < 3 || document.getElementById("dateArrival").value == "Por favor complete este campo"){
		document.getElementById("dateArrival").style.color= "#C00";
		document.getElementById("dateArrival").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("titulo").value == "" || document.getElementById("titulo").value.length < 3 || document.getElementById("titulo").value == "Por favor complete este campo"){
		document.getElementById("titulo").style.color= "#C00";
		document.getElementById("titulo").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("minima").value == "" || document.getElementById("minima").value.length < 3 || document.getElementById("minima").value == "Por favor complete este campo"){
		document.getElementById("minima").style.color= "#C00";
		document.getElementById("minima").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("detalle").value == "" || document.getElementById("detalle").value.length < 3 || document.getElementById("detalle").value == "Por favor complete este campo"){
		document.getElementById("detalle").style.color= "#C00";
		document.getElementById("detalle").value = "Por favor complete este campo";
		todook = false;
	}
		
	return todook;
}

function ValidarPrensa2(){
	var todook = true;
	document.getElementById("labelp").style.color= "#CCC";
		
	if(document.getElementById("imagen").value == "" ){
		document.getElementById("labelp").style.color = "#C00";
		todook = false;
	}
		
	return todook;
}

function ValidarInstalacion(){
	var todook = true;
	document.getElementById("host").style.color= "#036";
	document.getElementById("base").style.color= "#036";
	document.getElementById("usuariobase").style.color= "#036";
	document.getElementById("passbase").style.color= "#036";
	document.getElementById("email").style.color= "#036";
	
	if(document.getElementById("host").value == "" || document.getElementById("host").value.length < 3 || document.getElementById("host").value == "Por favor complete este campo"){
		document.getElementById("host").style.color= "#C00";
		document.getElementById("host").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("base").value == "" || document.getElementById("base").value.length < 3 || document.getElementById("base").value == "Por favor complete este campo"){
		document.getElementById("base").style.color= "#C00";
		document.getElementById("base").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("usuariobase").value == "" || document.getElementById("usuariobase").value.length < 3 || document.getElementById("usuariobase").value == "Por favor complete este campo"){
		document.getElementById("usuariobase").style.color= "#C00";
		document.getElementById("usuariobase").value = "Por favor complete este campo";
		todook = false;
	}
	
	if(document.getElementById("passbase").value == "" || document.getElementById("passbase").value.length < 3 || document.getElementById("passbase").value == "Por favor complete este campo"){
		document.getElementById("passbase").style.color= "#C00";
		document.getElementById("passbase").value = "Por favor complete este campo";
		todook = false;
	}
	
	str = document.getElementById("email").value;
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	
	if (str.indexOf(at)==-1){
		ErrorEmail();
		todook = false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		ErrorEmail();
		todook = false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		ErrorEmail();
		todook = false;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		ErrorEmail();
		todook = false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		ErrorEmail();
		todook = false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		ErrorEmail();
		todook = false;
	 }
	
	 if (str.indexOf(" ")!=-1){
		ErrorEmail();
		todook = false;
	 }
		
	return todook;
}

function ValidarConsulta(){
	var todook = true;
	document.getElementById("nombre").style.color= "#036";
	document.getElementById("consulta").style.color= "#036";
	document.getElementById("email").style.color= "#036";
	
	if(document.getElementById("nombre").value == "" || document.getElementById("nombre").value.length < 3 || document.getElementById("nombre").value == "Por favor complete este campo con su nombre"){
		document.getElementById("nombre").style.color= "#C00";
		document.getElementById("nombre").value = "Por favor complete este campo con su nombre";
		todook = false;
	}
	
	if(document.getElementById("consulta").value == "" || document.getElementById("consulta").value.length < 3 || document.getElementById("consulta").value == "Por favor complete este campo con su consulta"){
		document.getElementById("consulta").style.color= "#C00";
		document.getElementById("consulta").value = "Por favor complete este campo con su consulta";
		todook = false;
	}
	
	str = document.getElementById("email").value;
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	
	if (str.indexOf(at)==-1){
		ErrorEmail();
		todook = false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		ErrorEmail();
		todook = false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		ErrorEmail();
		todook = false;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		ErrorEmail();
		todook = false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		ErrorEmail();
		todook = false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		ErrorEmail();
		todook = false;
	 }
	
	 if (str.indexOf(" ")!=-1){
		ErrorEmail();
		todook = false;
	 }
	
	return todook;
}

function ErrorEmail(){
	document.getElementById("email").style.color= "#C00";
	document.getElementById("email").value = "E-mail no válido";
}

function ValidarConsulta_ingles(){
	var todook = true;
	document.getElementById("nombre").style.color= "#036";
	document.getElementById("consulta").style.color= "#036";
	document.getElementById("email").style.color= "#036";
	
	if(document.getElementById("nombre").value == "" || document.getElementById("nombre").value.length < 3 || document.getElementById("nombre").value == "Required field"){
		document.getElementById("nombre").style.color= "#C00";
		document.getElementById("nombre").value = "Required field";
		todook = false;
	}
	
	if(document.getElementById("consulta").value == "" || document.getElementById("consulta").value.length < 3 || document.getElementById("consulta").value == "Required field"){
		document.getElementById("consulta").style.color= "#C00";
		document.getElementById("consulta").value = "Required field";
		todook = false;
	}
	
	str = document.getElementById("email").value;
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	
	if (str.indexOf(at)==-1){
		ErrorEmail2();
		todook = false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		ErrorEmail2();
		todook = false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		ErrorEmail2();
		todook = false;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		ErrorEmail2();
		todook = false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		ErrorEmail2();
		todook = false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		ErrorEmail2();
		todook = false;
	 }
	
	 if (str.indexOf(" ")!=-1){
		ErrorEmail2();
		todook = false;
	 }
	
	return todook;
}

function ErrorEmail2(){
	document.getElementById("email").style.color= "#C00";
	document.getElementById("email").value = "Invalid E-mail";
}

function ValidarConsulta_portugues(){
	var todook = true;
	document.getElementById("nombre").style.color= "#036";
	document.getElementById("consulta").style.color= "#036";
	document.getElementById("email").style.color= "#036";
	
	if(document.getElementById("nombre").value == "" || document.getElementById("nombre").value.length < 3 || document.getElementById("nombre").value == "Campo de preenchimento obrigatório"){
		document.getElementById("nombre").style.color= "#C00";
		document.getElementById("nombre").value = "Campo de preenchimento obrigatório";
		todook = false;
	}
	
	if(document.getElementById("consulta").value == "" || document.getElementById("consulta").value.length < 3 || document.getElementById("consulta").value == "Campo de preenchimento obrigatório"){
		document.getElementById("consulta").style.color= "#C00";
		document.getElementById("consulta").value = "Campo de preenchimento obrigatório";
		todook = false;
	}
	
	str = document.getElementById("email").value;
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	
	if (str.indexOf(at)==-1){
		ErrorEmail3();
		todook = false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		ErrorEmail3();
		todook = false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		ErrorEmail3();
		todook = false;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		ErrorEmail3();
		todook = false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		ErrorEmail3();
		todook = false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		ErrorEmail3();
		todook = false;
	 }
	
	 if (str.indexOf(" ")!=-1){
		ErrorEmail3();
		todook = false;
	 }
	
	return todook;
}

function ErrorEmail3(){
	document.getElementById("email").style.color= "#C00";
	document.getElementById("email").value = "E-mail inválido";
}
