/********************************
FUNCION VALIDAR ENVIAR USUARIO
*********************************/
function sendform(selectedtype)
{
  document.supportform.supporttype.value = selectedtype ;
  document.supportform.submit() ;
}
function submitform(_form)
{
    alert("entra");
    document._form.submit();
    
}

function validar_register_user(){

var validacion =1;
$("span#error_nombre").css({display:"none"});
$("span#error_pass_1").css({display:"none"});
$("span#error_pass_2").css({display:"none"});
$("span#error_pass_3").css({display:"none"});	
$("span#error_mail_1").css({display:"none"});
$("span#error_mail_2").css({display:"none"});		

//validar nombre no esta vacio
if (document.getElementById("nombre").value.length==0){
	document.getElementById("nombre").focus();
	$("span#error_nombre").css({display:"block"});
	validacion=0;
	}
if (document.getElementById("password").value.length==0){
	document.getElementById("password").focus();
	$("span#error_pass_1").css({display:"block"});
	validacion=0;
	}	
//verificar clave es mayor a 5 caracteres
else if(document.getElementById("password").value.length<6){
	document.getElementById("password").focus();//enfocar el campo
	validacion=0;
	$("span#error_pass_2").css({display:"block"});	
	}
else
	{
	//validar clave correcta
	if(document.getElementById("password").value != document.getElementById("password_con").value){
		document.getElementById("password").focus();//enfocar el campo
		$("span#error_pass_3").css({display:"block"});	
		validacion=0;
		}
	}
//validar mail no esta vacio
if (document.getElementById("email").value==""){
	document.getElementById("email").focus();
	$("span#error_mail_1").css({display:"block"});	   
	validacion=0;
	}
if(validacion!=0){
	//validar mail contiene @
	if(document.getElementById("email").value.indexOf('@')==-1){//si lo escrito no tiene arroba
		document.getElementById("email").focus();//enfocar el campo
		$("span#error_mail_2").css({display:"block"});	
		validacion =0;
		}
	//validar mail contiene .
	if(document.getElementById("email").value.indexOf('.')==-1){//si lo escrito no tiene punto
		$("span#error_mail_2").css({display:"block"});	
		document.getElementById("email").focus();//enfocar el campo
		validacion=0;
		}
	}
//VERIFICAR QUE TODO ESTA CORRECTO
if (validacion==0){
	//alert("mal");
	return false;
	}
else{
	//alert("bien");
	//return true;
	}
} 
function validar_register_group(){

var validacion =1;
$("span#error_nombre").css({display:"none"});	
$("span#error_url").css({display:"none"});	
$("span#error_etiquetas").css({display:"none"});		

//validar nombre no esta vacio
if (document.getElementById("nombre").value.length==0){
	document.getElementById("nombre").focus();
	$("span#error_nombre").css({display:"block"});
	validacion=0;
	}
//validar nombre no esta vacio
if (document.getElementById("etiqueta1").value.length==0 && document.getElementById("etiqueta2").value.length==0){
	document.getElementById("etiqueta1").focus();
	$("span#error_etiquetas").css({display:"block"});
	validacion=0;
	}
if (document.getElementById("url").value.length==0){
	document.getElementById("url").focus();
	$("span#error_url").css({display:"block"});
	validacion=0;
	}	
//VERIFICAR QUE TODO ESTA CORRECTO
if (validacion==0){
	//alert("mal");
	return false;
	}
else{
	//alert("bien");
	return true;
	}
}
function validar_register_event(){
//alert("entra");
var validacion =1;
$("span#error_titulo").css({display:"none"});	
$("span#error_ciudad").css({display:"none"});	
$("span#error_lugar").css({display:"none"});		


if (document.getElementById("titulo").value.length==0){
	document.getElementById("titulo").focus();
	$("span#error_titulo").css({display:"block"});
	validacion=0;
	}
	
if (document.getElementById("ciudad").value.length==0){
	document.getElementById("ciudad").focus();
	$("span#error_ciudad").css({display:"block"});
	validacion=0;
	}
	
if (document.getElementById("lugar").value.length==0){
	document.getElementById("lugar").focus();
	$("span#error_lugar").css({display:"block"});
	validacion=0;
	}		
//VERIFICAR QUE TODO ESTA CORRECTO
if (validacion==0){
	//alert("mal");
	return false;
	}
else{
	//alert("bien");
	return true;
	}
}

function check_campo(campo,boton_envio){
	var a = document.getElementById(campo).value;
	var ok;
	if(a == ""){
		//document.getElementById(boton_envio).style.display="none";		
		//document.getElementById('error_'+campo+'_req').style.display="block";
		document.getElementById('error_'+campo).style.display="block";
		ok=false;

	}
	else{
		//document.getElementById('error_'+campo+'_req').style.display="none";
		document.getElementById('error_'+campo).style.display="none";	
		document.getElementById(boton_envio).style.display="block";			
		ok=true;
	}
	return ok;
}

function deshabilita(form){
	//alert("mundo libertario");
	//document.getElementById("email").disabled = false;
	form.email.disabled = true;
}
function habilita(form){
	//alert("mundo libertario");
	//document.getElementById("email").disabled = true;
	form.email.disabled = false;
}

