

function voidCambiarIdioma()
{
	var s;

	if (document.all.sPathInfo == undefined)
	{
		s=document.location.href;
		s=IrURL(document.location.href,'castellano-','ingles-')
		if (document.location.href == s)
		{
			s=IrURL(document.location.href,'ingles-','castellano-')
			if (document.location.href == s)
			{
				s = reemplazarCadena(s, "hdnidIdioma=" + 44, "hdnidIdioma=" + 34);
				if (document.location.href == s)
				{
					s = reemplazarCadena(s, "hdnidIdioma=" + 34, "hdnidIdioma=" + 44);
				}
				if (document.location.href == s)
				{
					if (s.indexOf('?') > 0 )
						s = s + "&hdnidIdioma=44";
					else
						s = s + "?hdnidIdioma=44";
				}
			}			
			document.location.href = s
		}
		else
		{
			document.location.href = s
		}
	}
	else
	{
		document.location.href = document.all.sPathInfo.value + "?hdnidIdioma=" + (document.all.iIdioma.value==34?44:34);
	}
}

function IrURL(sURL, iIdiomaOrigen, iIdiomaDestino)
{
	return reemplazarCadena(sURL, iIdiomaOrigen, iIdiomaDestino);
}
/*
function voidCambiarIdioma()
{
	document.location.href = document.all.sPathInfo.value + "?hdnidIdioma=" + (document.all.iIdioma.value==34?44:34);
}
*/
function voidIrURL(sURL)
{
	document.location.href = reemplazarCadena(sURL, "/idIdioma/", "/" + document.all.iIdioma.value + "/");
}

function reemplazarCadena(sDonde, sBuscar, sSustituir)
{
	var oRE = new RegExp(sBuscar, "g");
	return sDonde.replace(oRE, sSustituir);
}
