// DESABILITAR LOS BOTONES AL ENVIAR
function AsignarUrl()
{
	var form = document.forms['frm_dashboard_url'];
	
	// validaciones para el nombre de la url
	$url_crosite = '';
	$existe_url = 0
	$error_count = 0;
	$error_inner = '';

	if(empty(document.getElementById('comercio_url').value))
	{
		document.getElementById('comercio_url_label').innerHTML = 'Campo Obligatorio';
		$error_count++;
	}
	else
	{
		if($existe_url!=0)
		{
			$error_count++;
			document.getElementById('comercio_url_label').innerHTML = 'Ya Existe una Url ' + document.getElementById('url_crosite').value;
		}
		else
		{

			if(!IsAlphaNum(document.getElementById('comercio_url').value))
			{
				document.getElementById('comercio_url_label').innerHTML = 'Url debe contener solo caracteres validos, sin  espacios, ni (,) ni (_).';
				$error_count++;
			}
			else
			{
				document.getElementById('comercio_url_label').innerHTML = '';
			}
		}
	}	


	if($error_count == 0)
	{
	  form.submit();
	}		
}

function GrabarDatos()
{
var form = document.forms['frm_dashboard_datos'];

	$nombre_contacto = '';
	$apellido_contacto = '';
	$email_contacto = '';
	$usuario = '';
	$usuariorepetido = '';
	$clave = '';
	$clave2 = '';

	$error_count = 0;
	$error_inner = '<strong>Se han producido errores...</strong><br>';

	$error_inner += ''
	

if(form['clave_registro_actual'].value.length > 3 )
{

			if(empty(document.getElementById('clave_registro').value))
			{
				document.getElementById('clave_registro_label').className = 'label-footer-error';
				$clave += ' Ingrese una clave valida <br>';
				$error_count++;
			}
			else
			{
				if ($clave=="")
				{
					document.getElementById('clave_registro_label').className = 'label';
				}
			}

			if(form['clave_registro'].value.length < 4 )
			{
				document.getElementById('clave_registro_label').className = 'label-footer-error';
				if ($clave!=' Ingrese una clave valida <br>'){ $clave += ' Minimo 4 caracteres <br>'; }
				$error_count++;
			}
			else
			{
				if ($clave=="")
				{
					document.getElementById('clave_registro_label').className = 'label';
				}
			}

			if(form['clave_registro'].value != form['clave_registro2'].value)
			{
				document.getElementById('clave_registro_label').className = 'label-footer-error';
				if ($clave!=' Minimo 4 caracteres <br>'){ $clave += 'Las claves no coinciden'; }
				$error_count++;
			}
			else
			{
				if ($clave==""){
					document.getElementById('clave_registro_label').className = 'label';
				}
			}
}

	if($error_count > 0)
	{
		document.getElementById('nombre_contacto_label').innerHTML = $nombre_contacto;
		document.getElementById('clave_registro_label').innerHTML = $clave;
   }
   else
   {
		form.submit();
   }
}

function GrabarAlerta()
{
	var form = document.forms['frm_dashboard_alerta'];
	form.submit();
}

function GrabarPerfil()
{
	var form = document.forms['frm_dashboard_perfil'];
	form.submit();
}

function GrabarNoticia()
{
	var form = document.forms['frm_dashboard_noticia'];
	form.submit();
}

function GrabarPagina()
{
	var form = document.forms['frm_dashboard_pagina'];
	form.submit();
}

function GrabarArchivo()
{
	var form = document.forms['frm_dashboard_archivo'];
	
	form.submit();
}

function GrabarProducto()
{
	var form = document.forms['frm_dashboard_producto'];
	form.submit();
}

function EnviarMensaje()
{
	var form = document.forms['frmAgregarComentario'];
	form.submit();
}

function EnviarComentarioProducto()
{
	var form = document.forms['frmAgregarComentarioProducto'];
	form.submit();
}

function ResponderMensaje()
{
	var form = document.forms['frm_dashboard_responder'];
	form.submit();
}

function GrabarMapa()
{
	var form = document.forms['frm_dashboard_mapa'];
	form.submit();
}

function GrabarPagina()
{
	var form = document.forms['frm_dashboard_pagina'];
	form.submit();
}
function EditarAnalytics()
{
	var form = document.forms['frm_dashboard_analytics'];
	// validaciones para el nombre de la url
	form.submit();
}

function AgregarWanted()
{
	var form = document.forms['frm_wanted'];
	form.submit();
}

function EditarAprendiendo()
{
 var form = document.forms['frmaprendiendo'];
 var divaprendiendo1 = document.getElementById('aprendiendo')
 var divaprendiendo2 = document.getElementById('aprendiendo-editar')
 
 divaprendiendo1.style.display = 'none';
 divaprendiendo2.style.display = 'block';
// divaprendiendo2.style.BackgroundColor = 'block';
 form['aprendiendo'].focus();
}

function GrabarAprendiendo()
{
 var form = document.forms['frmaprendiendo'];
 form['accion'].value = 'grabar-aprendiendo';
 form.submit();
}