//Librería de navegación
// Para cambiar los frames de español a inglés según el idioma de la página que está en el frame central
function SwitchLang()
{
//Con la página de la fecha me apoyo para saber en que lenguaje están todas las páginas externas a este frame

strRuta = parent.fecha.location.href;
strRuta = strRuta.toLowerCase()
strLang = getQueryString ( location.href.toLowerCase(), "lang" ) 
//return "";
//Paso las páginas a Español, estaban en inglés
    if( strLang == "es" && strRuta.indexOf( "date.htm" ) > 0 )
    {
        parent.fecha.location.href = "./fecha.htm"
        parent.fecha2.location.href = "./Fecha.aspx"
        parent.Bottom.location.href = "./Bottom.htm"
        parent.parent.left.location.href = "./LeftFrame.htm"
        parent.parent.parent.top1.location.href = "./TopFrame_Es.htm"
    }
//Paso las página a Inglés, estaban en español
    if( strLang == "en" && strRuta.indexOf( "fecha.htm" ) > 0 )
    {
        parent.fecha.location.href = "./Date.htm"
        parent.fecha2.location.href = "./Date.aspx"
        parent.Bottom.location.href = "./Bottom_E.htm"
        parent.parent.left.location.href = "./LeftFrame_E.htm"
        parent.parent.parent.top1.location.href = "./TopFrame_E.htm"
    }
 
}
//================================================================
function SwitchLangCont()
{
//Con la página de la fecha me apoyo para saber en que lenguaje están todas las páginas externas a este frame
//Esta función en lugar de usar el query string, usa un campo para buscar el lenguaje.
// Se hace esto porque no se tiene el lenguaje en el query string

strRuta = parent.fecha.location.href;
strRuta = strRuta.toLowerCase();
//strLang =  document.all.Lang.value; //getQueryString ( location.href.toLowerCase(), "lang" ) 
strLang = document.getElementById("Lang").value;
//alert( strLang )
//return "";
//Paso las páginas a Español, estaban en inglés
    if( strLang == "es" && strRuta.indexOf( "date.htm" ) > 0 )
    {
        parent.fecha.location.href = "./fecha.htm"
        parent.fecha2.location.href = "./Fecha.aspx"
        parent.Bottom.location.href = "./Bottom.htm"
        parent.parent.left.location.href = "./LeftFrame.htm"
        parent.parent.parent.top1.location.href = "./TopFrame_Es.htm"
    }
//Paso las página a Inglés, estaban en español
    if( strLang == "en" && strRuta.indexOf( "fecha.htm" ) > 0 )
    {
        parent.fecha.location.href = "./Date.htm"
        parent.fecha2.location.href = "./Date.aspx"
        parent.Bottom.location.href = "./Bottom_E.htm"
        parent.parent.left.location.href = "./LeftFrame_E.htm"
        parent.parent.parent.top1.location.href = "./TopFrame_E.htm"
    }
 
}

//================================================================
function getQueryString ( queryString, parameterName ) 
{
	var parameterName = parameterName + "=";
	if ( queryString.length > 0 ) 
	{
	begin = queryString.indexOf ( parameterName );
		if ( begin != -1 ) 
		{
		begin += parameterName.length;
		end = queryString.indexOf ( "&" , begin );
		if ( end == -1 ) 
		{
		end = queryString.length
		}
		return unescape ( queryString.substring ( begin, end ) );
		}
	return "";
	}
	else
	{
	return "";
	}
}
//====================================================================
function busca()
    {
	    if( buscar.value == '' )
	    {
		    alert( "Por favor llene el criterio de búsqueda" );
	    }
	    else
	    {
		    parent.body.location.href = './busqueda.aspx?lan=es&Search=' + buscar.value
	    }
    }