function ordenar(link)
	{
	window.location = link;
	}

function busqueda()
{
	var buscar = document.getElementById('buscar').value;
	
	if (buscar == '' || buscar == 'Buscar..' || buscar == '%20' || buscar == ' ' || buscar == '%' )
	{
		alert("Debe Ingresar Un Parametro De Busqueda");
		
	}
	else
	{
		window.location='search.php?busqueda=' + buscar;
	}
}

function buscar_temp()
{
	alert("Buscador Desactivado Por El Momento");
}
function validar(){
	var nombre = /^[a-zA-Z \'\-]+/;
	var apellido = /^[a-zA-Z \'\-]+/;
	var fono = /^[0-9]*$/;
	var mensaje = /^[a-zA-Z \'\-]+/;
	var vacio = /^[ ]*$/;
	var motivo = /^[a-zA-Z \'\-]+/;
	var email = /^[A-Za-z0-9_.]+[A-Za-z]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	
	n = document.frm.nombre.value;
	a = document.frm.apellido.value;
	f = document.frm.fono.value;
	e = document.frm.email.value;
	m = document.frm.motivo.value;
	k = document.frm.mensaje.value;

	if(!nombre.test(n)){
		alert("Nombre: "+ n +" no es nombre valido");
		return false;
		}
	if(vacio.test(n)){
		alert("Nombre: Debe escribir un nombre");
		return false;
		}
	if(!apellido.test(a)){
		alert("Apellido: "+ a +" no es Un Apellido Valido");
		return false;
		}
	if(vacio.test(a)){
		alert("Apellido: Debe escribir un Apellido");
		return false;
		}
	if(vacio.test(e)){
		alert("Email: Debe escribir un Email");
		return false;
		}
	if(!email.test(e)){
		alert("Email: "+ e +" no es Un Email Valido");
		return false;
		}
	if(vacio.test(f)){
		alert("Telefono: Debe escribir un Telefono");
		return false;
		}
	if(!fono.test(f)){
		alert("Telefono: "+ f +" El telefono Ingresado No Es Correcto");
		return false;
		}
	if(!motivo.test(m)){
		alert("El Motivo Del Mensaje: "+ m +" No Es Valido");
		return false;
		}
	if(vacio.test(m)){
		alert("El Motivo Del Mensaje: "+ m +" No Es Valido");
		return false;
		}
	if(!mensaje.test(k)){
		alert("Mensaje: "+ k +" Debe Escribir Un Mensaje Valido");
		return false;
		}
	if(vacio.test(k)){
		alert("Mensaje: "+ k +" Debe Escribir Un Mensaje");
		return false;
		}
		document.frm.submit ();
}

function validar_comentario()
{
	var nombre		= /^[a-zA-Z \'\-]+/;
	var email		= /^[A-Za-z0-9_.]+[A-Za-z]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	var comentario	= /^[a-zA-Z \'\-]+/;
	var vacio		= /^[ ]*$/;

	n = document.frm.nombre.value;
	e = document.frm.email.value;
	c = document.frm.coment.value;

	if(vacio.test(n)){
		alert("Debe Escribir Un Nombre");
		return false;
		}
	if(!nombre.test(n)){
		alert("Nombre: "+ n +" El Nombre Ingresado No Es Correcto");
		return false;
		}
	if(!email.test(e)){
		alert("Email: "+ e +" No Es Valido");
		return false;
		}
	if(vacio.test(e)){
		alert("Debe Escribir Un Email");
		return false;
		}
	if(!comentario.test(c)){
		alert("El Mensaje: "+ c +" No Es Valido");
		return false;
		}
	if(vacio.test(c)){
		alert("Debe Escribir Un Comentario");
		return false;
		}
		document.frm.submit ();

}

function validar_add_archivo()
{
	var nombre		= /^[a-zA-Z \'\-]+/;
	var vacio		= /^[ ]*$/;

	n = document.frm.nombre.value;

	if(vacio.test(n)){
		alert("Debe Escribir Un Nombre");
		return false;
		}
	if(!nombre.test(n)){
		alert("Nombre: "+ n +" El Nombre Ingresado No Es Correcto");
		return false;
		}
		document.frm.submit ();

}

function confirmar_delete_coment(noticia, comentario) 
{

	if(confirm(" Realmente Quiere Borrar El Registro ?")) 
		{
		document.location.href= 'scripts/delete_post.php?id='+ comentario + '&id_n='+ noticia;
		} 

}

function confirmar_delete_noticia(noticia) 
{

	if(confirm(" Realmente Quiere Borrar El Registro ?")) 
		{
		document.location.href= 'scripts/delete_noticia.php?id='+ noticia;
		} 

}

function confirmar_edit_biografia() 
{

	if(confirm(" Realmente Quiere Editar El Contenido ?")) 
		{
		document.frm.submit ();
		} 

}

function tipo_archivo() 
{	
		if(document.getElementById('menu').value == 5)
		{
			document.getElementById('tipo').options["5"].selected=true;
			document.getElementById('ocultar').style.display = 'none';
		}
		else
		{
			document.getElementById('ocultar').style.display = 'block';

		}
}
