function openPopUp(url, name, width, height, resizable, scrollbar)
{
	var screenW = Math.min(width, screen.width);
	var screenH = Math.min(height, screen.height - 80);
	var windowLeft = (screen.width - screenW)/2;
	var windowTop = (screen.height - screenH)/2;
	width     = ('undefined'==typeof width  || !width )?'':',width='+width;
	height    = ('undefined'==typeof height || !height)?'':',height='+height;
	resizable = ('undefined'==typeof resizable  || !resizable ) ? 'no' : resizable ;
	scrollbar = ('undefined'==typeof scrollbar  || !scrollbar ) ? 'no' : scrollbar ;
	var win = window.open(url, name	, 'top='+ windowTop +',left=' + windowLeft + ',toolbar=no, scrollbars='+scrollbar+', resizable='+resizable + ' ' + width + height);
}


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('clave_registro_label').innerHTML = $clave;
   } else {
		form.submit();
   }
	
}
else
{	

	 if($error_count > 0) {
		document.getElementById('clave_registro_label').innerHTML = $clave;
   } else {
   	form['accion'].value='editar-datos-sinclave';
		form.submit();
   }
 }
}


function VolverPagina()
{
	var formPagina = document.forms['frm_dashboard_pagina'];
	var form 		   = document.forms['frm_dashboard_previsualizar'];

	//formPagina['pagina'].value = form['pagina'].value;

	form['accion'].value = '';
	$error_count = 0;	

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

function EliminarFoto(idx)
{
	var form 		   = document.forms['frm_dashboard_mapa'];

	$error_count = 0;	

	if($error_count == 0)
	{
		form['foto_id'].value = idx;
		form['accion'].value = 'eliminar-foto';
		form.submit();
  }
}

function EliminarFotoProducto(idx)
{
	var form = document.forms['frm_dashboard_producto'];

	$error_count = 0;	
  
	if($error_count == 0)
	{
		form['foto_id'].value = idx;
		form['accion'].value = 'eliminar-foto';
		form.submit();
  }
}


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

function MeGusta(idx)
{
	var form = document.forms['frmListaComentario'];
	form['accion'].value = 'me-gusta';
	form['noticia_id'].value = idx;
	form.submit();
}

function Reportar(idx)
{
	var form = document.forms['frmListaComentario'];
	form['accion'].value = 'reportar';
	form['noticia_id'].value = idx;
	form.submit();
}

