function navegar(pagina)
{
	document.location.href=pagina;
}

function CambiaMenu(yo,img)
{
	yo.src='img/top/menu/'+img;
}
function validarform()
{
	var retorno=false;

	if (validavacio(document.getElementById('Nombre'),"Debe ingresar un nombre válido.","input135px")==true)
	{
		if (validavacio(document.getElementById('Apellido'),"Debe ingresar un apellido válido.","input135px") == true)
		{
			if (ValidarEmail(document.getElementById('Email'),"Debe ingresar un mail válido.","input135px") == true)
			{
				if (validavacio(document.getElementById('Observaciones'),"Debe ingresar un comentario válido.","textarea350px") == true)
				{
					retorno=true;
				}
			}
		}
	}

	return retorno;
}

function validarformContacto()
{
	var retorno=false;

	if (validavacio(document.getElementById('Nombre'),"Debe ingresar un nombre válido.","input135px")==true)
	{
		if (validavacio(document.getElementById('Apellido'),"Debe ingresar un apellido válido.","input135px") == true)
		{
			if (ValidarEmail(document.getElementById('Email'),"Debe ingresar un mail válido.","input135px") == true)
			{
				if (validavacio(document.getElementById('Institucion'),"Debe ingresar una institución válida.","input135px") == true)
				{
					if (validavacio(document.getElementById('Observaciones'),"Debe ingresar un comentario válido.","textarea350px") == true)
					{
						retorno=true;					
					}
				}
			}
		}
	}

	return retorno;
}


function validavacio(obj,txterror,clase)
{
	var retorno=true;

	obj.className=clase;//Inicializa la clase

	if (obj.value.length < 4)
	{
		MuestraError(txterror,obj,clase);
		retorno=false;
	}
	return retorno;
}

function ValidarEmail(strMail,txterror,clase)
{
	var retorno=false;

	strMail.className=clase;//Inicializa la clase

	var PosArroba=strMail.value.indexOf("@");
	var PosPunto=strMail.value.indexOf(".",PosArroba);
	var LongEmail=strMail.value.length;

	if (LongEmail>0){
		if (PosArroba>0){
			if ((PosPunto > 0) && (PosPunto > (PosArroba+1))){
				retorno=true;
			} 
		}
	}

	if (!retorno)
	{
		MuestraError(txterror,strMail,clase);
	}

	return retorno;
}

function MuestraError(txterror,obj,clase)
{
	objError=document.getElementById('Error');
	if (objError)
	{
		objError.innerHTML=txterror;	
		obj.className=clase + 'Error';
		obj.focus();
	}
}

function MostrarNoticias(id,tiempo,num)
	{
		if (num>=VectorNoticias.length-1){num=0;}
		num++;
		EfectoFade(id,10,-1,num);
		setTimeout("MostrarNoticias('" + id + "'," + tiempo + "," + (num) + ")", tiempo);
	}

function EfectoFade(id,cantidad,expr,num)
	{
		var TotalIE=-1*expr;
		var TotalFF=-1*expr;

		if (document.all)// para el IE
		{
			CantIE=document.getElementById(id).filters.alpha.opacity;
			TotalIE=CantIE+(cantidad*expr);		
			document.getElementById(id).filters.alpha.opacity= TotalIE;
		}else{ //para FF y MOZ
			CantFF=document.getElementById(id).style.opacity*1;
			TotalFF=(CantFF)+(cantidad/100*expr);
			document.getElementById(id).style.opacity= TotalFF;
			document.getElementById(id).style.MozOpacity= TotalFF;
		}

		if ((TotalFF<1 && TotalIE<100 && expr==1) || (TotalFF>0 && TotalIE>0 && expr==-1))
		{
			setTimeout("EfectoFade('" + id + "'," + cantidad + "," + expr + "," + num + ")", 100);		
		}else{
			document.getElementById(id).innerHTML = VectorNoticias[num];		
			if (expr==-1){EfectoFade(id,10,1,num);}
		}
	}
