var FAQNavArray = new Array();
// Color de fondo de las preguntas abiertas.
var FOpenColor = "FFFFFF";
// Color de fondo faqs no seleccionadas con el mouse ni abierta.
var FCloseColor = "FFFFFF";
// Color de fondo cuando se mueve el mouse, el seleccionado.
var FSelectColor = "F2F2F2";
var expNav = -1;
var expTimer;

function FAQNav()
{
	this.id = FAQNavArray.length;
	FAQNavArray[ FAQNavArray.length ] = this;
	this.expanded = false;
	this.mouseOver = function()
	{
		if( !this.expanded )
			document.getElementById( "FAQbg"+ this.id ).style.backgroundColor = FSelectColor;
	};
	this.mouseOut = function()
	{
		if( !this.expanded )
			document.getElementById( "FAQbg"+ this.id ).style.backgroundColor = FCloseColor;
	};
	this.expand = function()
	{
		document.getElementById( "FAQbg"+ this.id ).style.backgroundColor = FOpenColor;
		document.getElementById( "FAQtxt"+ this.id ).style.color = "FF9900";
		document.getElementById( "faq"+ this.id ).style.display = "block";
		this.expanded = true;
		expNav = this.id;
	};
	this.collapse = function()
	{
		document.getElementById( "FAQbg"+ this.id ).style.backgroundColor = FCloseColor;
		document.getElementById( "FAQtxt"+ this.id ).style.color = "006633";
		document.getElementById( "faq"+ this.id ).style.display = "none";
		expNav = -1;
		this.expanded = false;
	};
	this.toggleExpand = function()
	{
		clearTimeout(expTimer);
		if( this.expanded )
			this.collapse();
		else
		{
			if( expNav >= 0 )
			{
				FAQNavArray[ expNav ].collapse();
				expTimer = setTimeout( 'FAQNavArray[ '+ this.id +' ].expand();', 400 );
			}
			else
				this.expand();
		}
	};
}

function initFAQNav()
{
	for( var i=0; i<FAQNavArray.length; i++ )
	{
		FAQNavArray[i].collapse();
	}
}

function defineFAQNav( _countNav )
{
	for( i=0; i<_countNav; i++ )
	{
		new FAQNav();
	}
}

//window.onload = bodyOnLoad;
window.onresize = bodyOnResize;

function bodyOnLoad(questionListSize)
{
	defineFAQNav(questionListSize);
	if( document.getElementById ) {
		initFAQNav();
	}
	FAQNavArray[0].toggleExpand();
}

function bodyOnResize()
{
	if( document.layers )
		location.reload();
}
