// JavaScript Document
function saluda()
{
	alert("holaa");
	return true;
}
function admin(f)
{
	/*if(formu.tipo.value==0)
	{
		alert("Debe seleccionar un tipo de acceso valido");
		return false;
	}*/
	if(f.username.value=="" || f.password.value=="")
	{
		alert("Falta campos obligatorios");
		return false;
	}
	else
		return true;
}
function validaNoticia(formu)
{
	if((formu.titular.value=="")||(formu.texto.value==""))
	{
		alert("Todos los campos son obligatorios");
		return false;
	}
	else
	{
		return true;
	}
}

function validaArchivo(form)
{
	file=form.imagen.value;
	extArray = new Array(".jpg");
	allowSubmit = false;
	if (!file)
	{
		return true;
	}
	while (file.indexOf("\\") != -1)
	file = file.slice(file.indexOf("\\") + 1);
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) 
	{
		if (extArray[i] == ext)
		{
			allowSubmit = true; 
			break; 
		}
	}
	if (allowSubmit)
	{
		return true;
	}
	else
	{
		alert("Se permiten únicamente archivos con la extención: "
		+ (extArray.join(" ")) + "\nPor favor, seleccione otro archivo "
		+ "e intente de nuevo.");
		return false;
	}
}

function validaDocumento(form)
{
	if(form.titulo.value=="" || form.descripcion.value=="")
	{
		alert("Todos los campos son Obligatorios");
		return false;
	}
	if(form.modulo.value=="no")
	{
		alert("Seleccione un módulo válido");
		return false;
	}
	return true;
}

function validaModDocumento(formu)
{
	if((formu.titulo.value=="")||(formu.descripcion.value==""))
	{
		alert("Título y Descripcion son campos obligatorios");
		return false;
	}
	else
	{
		return true;
	}
	
}

function wopen(url, name, w, h)
{
	w += 32;
	h += 96;
	wleft = (screen.width - w) / 2;
	wtop = (screen.height - h) / 2;
	var win = window.open(url,
	name,
	'width=' + w + ', height=' + h + ', ' +
	'left=' + wleft + ', top=' + wtop + ', ' +
	'location=no, menubar=no, ' +
	'status=no, toolbar=no, scrollbars=no, resizable=no');
	// Just in case width and height are ignored
	win.resizeTo(w, h);
	// Just in case left and top are ignored
	win.moveTo(wleft, wtop);
	win.focus();
}