/*
  ===============================================================

  inGenio X
  http://ingenio.area421.com

  Created by 
  Julian Moreno Hidalgo (Software developer)
  Jesus Moreno Hidalgo (Communication's tree)

  inGenio X is a free software licensed under CC-GNU GPL

  ===============================================================
*/

function edit (url,ancho)
	{
		var alto = 650;
		var left = (screen.availWidth)?(screen.availWidth-ancho)/2:50;
		var top = (screen.availHeight)?(screen.availHeight-(alto+50))/2:50;
		var ven = "width="+ancho+",height="+alto+",left="+left+",top="+top+",toolbar=0,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
		control = window.open(url,'admsv',ven);
		control.focus();
	}

function getfile (url)
	{
		var ancho = 600;
		var alto = 400;
		var left = 0;
		var top = 0;
		var ven = "width="+ancho+",height="+alto+",left="+left+",top="+top+",toolbar=0,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
		getv = window.open(url,'getf',ven);
		getv.focus();
	}

/*
  limit_textarea
  Original:  Ronnie T. Moore
  Web Site:  The JavaScript Source -> http://javascript.internet.com
  Dynamic 'fix' by: Nannette Thacker
  Web Site: http://www.shiningstar.net
*/
function input_textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit)
	{
		field.value = field.value.substring(0, maxlimit);
	} else {
		countfield.value = maxlimit - field.value.length;
	}
}

/* 
  funciones de chequeo
*/
function relleno(campo) {
	var cadena = / /g;
	campo = campo.replace(cadena, "");
	return (campo == "") ? true : false;
}
function mailcorrecto(campo) {
	var cadena = /^.+@.+\..{2,4}$/;
	var ini = 0;
	for (var i = 0; i <= campo.length; i++)
		if ( campo.charAt(i) == "@" )
			ini++;
	if ( ini > 1 )
		return false;
	else
		return ( cadena.test(campo) ) ? true : false;
}
function validarFecha(campo) {
	var cadena = /^([1-9]|0[1-9]|[12][0-9]|3[01])\/([1-9]|0[1-9]|1[012])\/(19[0-9][0-9]|20[0-9][0-9])$/;
	return ( cadena.test(campo) ) ? true : false;
}

/* 
  funcion de layer
*/
function layerhideshow(divID) {
	if (document.getElementById) {
		if (document.getElementById(divID).style.display == 'none') {
			document.getElementById(divID).style.display = 'block';
		} else if (document.getElementById(divID).style.display == 'block') {
			document.getElementById(divID).style.display = 'none';
		}
	}
}
