var bGoogleAnalytics = false;
var cAJAXNoValido = "Su navegador no soporta AJAX.";
var cPathGeneral = "";

var oDiv;
var cValorAlpha = 100;
var cConteo = 5;

var iNav = navigator.appName;

if ( iNav == "Netscape" )
{
	var iContNav = 0;
	var cUserAgent = navigator.userAgent;
	
	iNav = "NS";
	
	while ( iContNav < cUserAgent.length )
	{
		if ( cUserAgent.substring(iContNav, iContNav + 7) == "Firefox" )
			iNav = "FX";
		
		iContNav ++;
	}
}
else
	if ( iNav == "Microsoft Internet Explorer" )
		iNav = "IE";

function f_filterResults(n_win, n_docel, n_body)
{
    var n_result = n_win ? n_win : 0;
	
	if (n_docel && (!n_result || (n_docel > n_result)))
		n_result = n_docel;
	
	if (n_body && (!n_result || (n_body > n_result)))
		n_result = n_body;
	
	return n_result;
}

function f_clientWidth()
{
    return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}

function f_clientHeight()
{
    return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}

function f_scrollLeft()
{
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}

function f_scrollTop()
{
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_scrollWidth()
{
	return f_filterResults (
		window.pageXOffsetOOO ? window.pageXOffsetOOO : 0,
		document.documentElement ? document.documentElement.scrollWidth : 0,
		document.body ? document.body.scrollWidth : 0
	);
}

function f_scrollHeight()
{
	return f_filterResults (
		window.pageYOffsetOOO ? window.pageYOffsetOOO : 0,
		document.documentElement ? document.documentElement.scrollHeight : 0,
		document.body ? document.body.scrollHeight : 0
	);
}

function fncQuitaPixel(cNumber)
{
	var cX = 0;
	var cReturn = "";
	
	while (cX < cNumber.length)
	{
		if ( cNumber.substring(cX, cX + 1) != "p" && cNumber.substring(cX, cX + 1) != "x" && cNumber.substring(cX, cX + 1) != "%" )
			cReturn = cReturn + cNumber.substring(cX, cX + 1);
	
		cX = cX + 1;
	}
	
	return cReturn;
}

function GetXmlHttpObject()
{
	var xmlHttp = null;
		
	try
	{
		//Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	
	return xmlHttp;
}

function fncStrLen( cValor, cLen, cCaracter )
{
    while ( ("" + cValor).length < cLen )
    {
        cValor = "" + cCaracter + cValor
    }
    
    return cValor;
}

function trim(strTexto)
{
	var cont = 0, strNuevo = "", strVerifica;
	strVerifica = strTexto;
	
	while ( cont < strVerifica.length )
	{
		if ( strVerifica.substring ( cont, cont + 1 ) != " " )
		{
			strNuevo += strVerifica.substring ( cont, cont + 1 );
		}
		
		cont++;
	}
	
	return strNuevo;
}

function fncEsEmail( cEMail )
{
	var cLongitud, cNum;
	
	cLongitud = cEMail.length;
	
	var bArroba = false;
	var bPunto = false;
	var bEspacio = false;
	
	for ( var cConteo = 0; cConteo < cLongitud; cConteo++ )
	{
		cNum = cEMail.substring ( cConteo, cConteo + 1 );
		
		if ( ( cNum == "@" ) && ( bArroba == false ) )
			bArroba = true;
		else if ( ( cNum == "@" ) && ( bArroba == true ) )
			bArroba = false;
		else if ( cNum == "." )
			bPunto = true;
		else if ( cNum == " " )
			bEspacio = true;
	}
	
	if ( bArroba && bPunto && ( cLongitud >= 6 ) && ( ! ( bEspacio ) ) )
		return true;
	else
		return false;
}

function fncLoadPage()
{
	if ( document.getElementById("iFondoPagina") )
	{
		document.getElementById("iFondoPagina").style.width = f_clientWidth() + "px";
		document.getElementById("iFondoPagina").style.height = f_clientHeight() + "px";
	}
	
	if ( document.getElementById("divContainer") )
	{
		document.getElementById("divContainer").style.position = "absolute";
		document.getElementById("divContainer").style.top = "0px";
		document.getElementById("divContainer").style.left = "0px";
		document.getElementById("divContainer").style.width = "100%";
		document.getElementById("divContainer").style.height = "100%";
		document.getElementById("divContainer").style.zIndex = "1";
		document.getElementById("divContainer").style.display = "block";
	}
	
	if ( document.getElementById("divFondoPagina") )
	{
		document.getElementById("divFondoPagina").style.position = "absolute";
		document.getElementById("divFondoPagina").style.top = "0px";
		document.getElementById("divFondoPagina").style.left = "0px";
		document.getElementById("divFondoPagina").style.width = "100%";
		document.getElementById("divFondoPagina").style.height = "100%";
		document.getElementById("divFondoPagina").style.zIndex = "-1";
		document.getElementById("divFondoPagina").style.overflow = "hidden";
		document.getElementById("divFondoPagina").style.display = "block";
	}
	
	if ( document.getElementById("cValor") )
		document.getElementById("cValor").select();
}

function fncResizePagina()
{
	if ( document.getElementById("iFondoPagina") )
	{
		document.getElementById("iFondoPagina").style.width = f_clientWidth() + "px";
		document.getElementById("iFondoPagina").style.height = f_clientHeight() + "px";
	}
}

function fncScrollPagina()
{
	if ( document.getElementById("divFondoPagina") )
	{
		document.getElementById("divFondoPagina").style.top = f_scrollTop() + "px";
	}
}

window.onload = fncLoadPage;
window.onresize = fncResizePagina;
window.onscroll = fncScrollPagina;
