<!--
var ruta = location.pathname.split("/");
var rutaBase = "";
var pagePos;
var page;
if (ruta.length > 2)
{
	for (var i=1; i < ruta.length-1; i++)
	{
		rutaBase += "/" + ruta[i];
	}
	rutaBase += "/";
	pagePos	= location.pathname.lastIndexOf(rutaBase) + rutaBase.length;
	page = location.pathname.slice(pagePos);
}
else
	page = location.pathname.slice(1);


/* <Debug> */
//alert(location.pathname + "\n" + pagePos + "\nPágina: " + page);

/*
var s = "";
s += "location.pathname: " + location.pathname + "\n";
s += "\nruta: (" + ruta.length + ") " + ruta;
s += "\nrutaBase: " + rutaBase;
s += "\npagePos: " + pagePos;
s += "\npage: " + page
alert(s);
*/

/* </Debug> */

var s = "";
for(var p in history) s += "history." + p + ": " + history[p] + "\n";
//history.clear();

if (top.location == self.location) {
	document.location = rutaBase + "index.asp?page=" + page;
}

function setBrujula(elem)
{
	var parent = document.all.grupo.innerText;
	var parentURL = document.URL;
	var link = elem.parentElement.parentElement.children(1).children(0).innerText;
	
	var queryString = "brujula.asp?link=" + link + "&linkURL=" + elem.href + "&link=" + parent + "&linkURL=" + parentURL;
	top.document.frames("frameBrujula").location = queryString;
}

function setBrujula2()
{
	var link = document.all.grupo.innerText;
	var linkURL = document.URL;
	
	var queryString = "brujula.asp?link=" + link + "&linkURL=" + linkURL;
	top.document.frames("frameBrujula").location = queryString;
}

function descargaFolleto(file)
{
	var nombre = file.slice(0, file.lastIndexOf("."));
	var filePath = "descargas\\publico\\" + file;
	var newLocation = "../FileDownload.asp?File=" + escape(filePath) + "&Name=" + escape(file) + "&Size=&ruta=si";
	document.location = newLocation;
}

function URLEncode(str)
{
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";
	
	var plaintext = str;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
};

function over(elem)
{
	elem.className = "linkOver2";
}

function out(elem)
{
	elem.className = "link2";
}

// Función utilizada para debug
function ShowObjectProperties(obj, objName)
{
	var s = "";
	
	s += objName + "\n========\n";
	for (var prop in obj)
		s += objName + "." + prop + " = " + obj[prop] + "\n";
		
	return s;
}
//-->

