function NoDisponible () {
	alert("La función solicitada no está aun disponible!");
}

function AbrirVentana(URL,SB,ANCHO,ALTO,IZDA,ARRIBA) 
{ // <--- Designed By Miguel M.( webmiguel(a)gmail.com ) - www.ski-cams.com
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=" + SB + ",location=0,statusbar=0,menubar=0,resizable=0,width=" + ANCHO + ",height=" + ALTO + ",left = " + IZDA + ",top = " + ARRIBA + "');");
}

function ActivarFormulario(inputFather,inputSoon) {		
	var FatherSelected=inputFather[inputFather.selectedIndex].value;

	if (FatherSelected > 0) {
		inputSoon.disabled = false;
	} else {
		inputSoon.disabled = true;			
	}
}
function ActivarFormularioCheck(inputFather,inputSoon) {		
	var FatherSelected=inputFather.checked;

	if (FatherSelected > 0) {
		inputSoon.disabled = false;
	} else {
		inputSoon.disabled = true;			
	}
}
function DesactivarFormularioCheck(inputFather,inputSoon) {		
	var FatherSelected=inputFather.checked;
	
	if (FatherSelected) {
		inputSoon.disabled = true;
	} else {
		inputSoon.disabled = false;			
	}
}

function LimpiarContenido(input) {
	for (i = 0;i < input.length;i++)
		input[i]=null;
	input.length=0;
}

//función para cambiar el valor de la página e ir a la página del paginador
function Pagina(valor) {
	document.paginador.page.value = valor;
	document.paginador.submit();
}
//función para cambiar el valor de la página e ir a la página del paginador
function Pagina2(valor) {
	document.paginador2.page.value = valor;
	document.paginador2.submit();
}

function ValidarEmail(valor)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)) {
		return true; }
	else {
		return false; }
}


function FichaActividad(valor)
{
	AbrirVentana('actividades.ficha.php?id=' + valor,1,750,550,40,40);
}
function FichaInstitucion(valor)
{
	AbrirVentana('instituciones.ficha.php?id=' + valor,1,700,500,50,50);
}
function FichaParticipante(valor)
{
	AbrirVentana('participantes.ficha.php?id=' + valor,1,700,500,70,70);
}
function FichaDocumento(valor)
{
	AbrirVentana('documentos.ficha.php?id=' + valor,1,600,400,80,80);
}

function Clausula()
{
	AbrirVentana('clausula-responsabilidad.php',0,500,170,150,250);
}

function EnviarEmail(valor)
{
	AbrirVentana('email.participantes.php?origen=' + valor,1,750,650,50,50);
}


// funciones para la capa overlay de realizando busqueda
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


function Overlay()
{
	var division = document.getElementById("overlay");
	var division2 = document.getElementById("overlaycontainer");
	var arrayPageSize = getPageSize();
	
	division.style.height = arrayPageSize[1] + 'px';
	division.style.display = 'block';
	division2.style.display = 'block';
}

function ResultadosImprimir()
{
	AbrirVentana('busqueda.imprimir.php',1,700,500,50,50);
}


function VerInforme(ide)
{
	var divisiontitulo=document.getElementById("informe_" + ide);
	var divisioncontenido=document.getElementById("informe_contenido_" + ide);
	divisiontitulo.style.display = 'none';
	divisioncontenido.style.display = 'block';
	
}
function OcultarInforme(ide)
{
	var divisiontitulo=document.getElementById("informe_" + ide);
	var divisioncontenido=document.getElementById("informe_contenido_" + ide);
	divisiontitulo.style.display = 'block';
	divisioncontenido.style.display = 'none';
	
}

function Completar_Valor(campo,valor,valortexto) 
{
	window.opener.Completar(campo,valor,valortexto);
	window.opener.focus();
	window.close();
	if(campo == 'document.formulario.documento')
		window.opener.DocumentoAutovincular();
	if(campo == 'document.formulario.actividad_relacionada')
		window.opener.ActividadRelacionadaAutovincular();
}

function ActualizarCheck(division,nombre,tabla,campo,marcado,campoid,valorid,divloading)
{
	var marcador = (marcado ? 1 : 0);
	var llamada = 'checkbox.php?division=' + division + '&nombre=' + nombre + '&tabla=' + tabla + '&campo=' + campo + '&valor=' + marcador + '&campoid=' + campoid + '&valorid=' + valorid + (divloading ? '&divloading=' + divloading : '') + '';
	
	myajax = new isiAJAX('cambiar_' + nombre,divloading);
	myajax.Link(llamada, division);
}

function AbrirListado(ide,camp) {
	AbrirVentana('listados.php?id=' + ide + '&campo=' + camp,0,600,500,50,50);	
}
function CompletarListado(campo,texto) {
	eval("document.buscador.texto_" + campo + ".value = '" + texto + "'");
}

