var layerSelectedArray = new Array();
function layerSelected(objetoRef, isSelected, name)
{
	this.objetoRef = objetoRef;
	this.isSelected = isSelected;
	this.name = name;
	return this;
}

function InicioCapa(nombre,top,left,width,height,visibilidad,indice,EventoMouseOver,EventoMouseOut)
{
	if(document.layers)
	{
		if (visibilidad) visibilidad="show"
		else visibilidad="hide"
		document.write('<layer id="' + nombre + '" left="'+ left +'" top="'+ top +'" z-index="'+ indice +'" visibility="'+ visibilidad +'" width='+ width +' height='+ height +' onMouseOver="'+EventoMouseOver+'" OnmouseOut="'+EventoMouseOut+'" CLIP="0,0,'+width+','+height+'">');
	}
	else
	{
		if (visibilidad) visibilidad="visible"
		else visibilidad="hidden"
		document.write('<div id="' + nombre + '" style="position:absolute; height:'+ height +'; z-index:'+ indice +'; left: '+ left +'px; top: '+ top +'px;'+' width:'+ width +'px; visibility: '+ visibilidad +' ;" onMouseOver="'+EventoMouseOver+'" OnmouseOut="'+EventoMouseOut+'" >');
	}
}

function FinCapa()
{
	if(document.layers)	document.write('</layer>');
	else document.write('</div>');
}

function BuscarObjeto(Objeto, Documento)
{
var p,i,x;  
	if(!Documento) Documento=document;
	if((p=Objeto.indexOf("?"))>0&&parent.frames.length) {
		Documento=parent.frames[Objeto.substring(p+1)].document; Objeto=Objeto.substring(0,p);}
	if(!(x=Documento[Objeto])&&Documento.all) x=Documento.all[Objeto];
	else if (!document.layers)  if (!document.all) x=Documento.getElementById(Objeto);
	for (i=0;!x&&i<Documento.forms.length;i++) x=Documento.forms[i][Objeto];
	for(i=0;!x&&Documento.layers&&i<Documento.layers.length;i++) x=BuscarObjeto(Objeto,Documento.layers[i].document); return x;
}

function nada() {}

function rollOver(nombreCapaVisible)
{
	rollOutNonSelected();
	varObjetoVisible=BuscarObjeto(nombreCapaVisible);
	if (varObjetoVisible.style) varObjetoVisible=varObjetoVisible.style;
	varObjetoVisible.visibility="visible";
}

function rollOut(nombreCapaInvisible)
{
	varObjetoInvisible=BuscarObjeto(nombreCapaInvisible);
	if (varObjetoInvisible.style) varObjetoInvisible=varObjetoInvisible.style;
	rollOutNonSelected();
}

function rollOutNonSelected()
{
	for(var i=0; i<layerSelectedArray.length;i++)
	{
		if(!layerSelectedArray[i].isSelected){
			if(document.layers) layerSelectedArray[i].objetoRef.visibility="hidden";
			else layerSelectedArray[i].objetoRef.style.visibility="hidden";
		}
	}
}

function keepSelected(arrayPosition)
{
	for (var i = 0; i< layerSelectedArray.length; i++)
	{
		if (i == arrayPosition)
		{
			layerSelectedArray[i].isSelected = true;
			if(document.layers) layerSelectedArray[i].objetoRef.visibility="show";
			else layerSelectedArray[i].objetoRef.style.visibility="visible";
		}
		else
		{
			if(MustDeselect(i,arrayPosition,4))
			{
				layerSelectedArray[i].isSelected = false;
			}
		}
	}
	rollOutNonSelected();
}

function KeepSelectedByName(numberText)
{
	keepSelected(parseInt(numberText)-1);
}

function MustDeselect(checked,clicked, inflection)
{
	var returnValue = false;
	if(checked>inflection && clicked>inflection && layerSelectedArray[checked].isSelected) returnValue = true;
	if(checked<=inflection && clicked<=inflection && layerSelectedArray[checked].isSelected) returnValue = true;
	return returnValue;
}
//************************
//Definicion de las capas
//************************
function pintarCapas()
{
//------------------------------------------
//  *****************************
//	 Boton de Opcion 1 OFF
//  *****************************
	var Enlace;
	//(nombre,top,left,width,height,visibilidad,indice,EventoMouseOver,EventoMouseOut)
	Enlace="<a href=\"javascript:keepSelected(0);\" class=\"textoOn\">Conservador</a>";
	var menu = '';
	InicioCapa("capaOpcion1Off",nDespV1,nDespH1,nwidth,20,true,20,"rollOver('capaOpcion1On');","nada()");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOff" nowrap align="center" valign="middle">Conservador</td>';
	menu += '</tr></table>';
	document.write(menu);
	FinCapa();
//  *****************************
//	 Boton de Opcion 1 ON
//  *****************************
	var menu = '';
	InicioCapa("capaOpcion1On",nDespV1,nDespH1,nwidth,20,false,25,"nada()","rollOut('capaOpcion1On');");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="darkBg">';
	menu += '<table cellpadding="0" cellspacing="1" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOn" nowrap align="center" valign="middle">'+Enlace+'</td>';
	menu += '</tr></table></td></tr></table>';
	document.write(menu);
	FinCapa();
	layerSelectedArray[0] = new layerSelected(BuscarObjeto('capaOpcion1On'),false, "conservador");
//  *****************************
//	 Boton de Opcion 2 OFF
//  *****************************
	var Enlace;
	
	Enlace="<a href=\"javascript:keepSelected(1);\" class=\"textoOn\">Prudente</a>";
	var menu = '';
	InicioCapa("capaOpcion2Off",nDespV1,nDespH1 +(1*nSepH),nwidth,20,true,20,"rollOver('capaOpcion2On');","nada()");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOff" nowrap align="center" valign="middle">Prudente</td>';
	menu += '</tr></table>';
	document.write(menu);
	FinCapa();
//  *****************************
//	 Boton de Opcion 2 ON
//  *****************************
	var menu = '';
	InicioCapa("capaOpcion2On",nDespV1,nDespH1 +(1*nSepH),nwidth,20,false,25,"nada()","rollOut('capaOpcion2On');");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="darkBg">';
	menu += '<table cellpadding="0" cellspacing="1" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOn" nowrap align="center" valign="middle">'+Enlace+'</td>';
	menu += '</tr></table></td></tr></table>';
	document.write(menu);
	FinCapa();
	layerSelectedArray[1] = new layerSelected(BuscarObjeto('capaOpcion2On'),false,"prudente");
//  *****************************
//	 Boton de Opcion 3 OFF
//  *****************************
	var Enlace;
	
	Enlace="<a href=\"javascript:keepSelected(2);\" class=\"textoOn\">Equilibrado</a>";
	var menu = '';
	InicioCapa("capaOpcion3Off",nDespV1,nDespH1 +(2*nSepH),nwidth,20,true,20,"rollOver('capaOpcion3On');","nada()");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOff" nowrap align="center" valign="middle">Equilibrado</td>';
	menu += '</tr></table>';
	document.write(menu);
	FinCapa();
//  *****************************
//	 Boton de Opcion 3 ON
//  *****************************
	var menu = '';
	InicioCapa("capaOpcion3On",nDespV1,nDespH1 +(2*nSepH),nwidth,20,false,25,"nada()","rollOut('capaOpcion3On');");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="darkBg">';
	menu += '<table cellpadding="0" cellspacing="1" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOn" nowrap align="center" valign="middle">'+Enlace+'</td>';
	menu += '</tr></table></td></tr></table>';
	document.write(menu);
	FinCapa();
	layerSelectedArray[2] = new layerSelected(BuscarObjeto('capaOpcion3On'),false,"equilibrado");
//  *****************************
//	 Boton de Opcion 4 OFF
//  *****************************
	var Enlace;

	Enlace="<a href=\"javascript:keepSelected(3);\" class=\"textoOn\">Dinâmico</a>";
	var menu = '';
	InicioCapa("capaOpcion4Off",nDespV1,nDespH1 +(3*nSepH),nwidth,20,true,20,"rollOver('capaOpcion4On');","nada()");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOff" nowrap align="center" valign="middle">Dinâmico</td>';
	menu += '</tr></table>';
	document.write(menu);
	FinCapa();
//  *****************************
//	 Boton de Opcion 4 ON
//  *****************************
	var menu = '';
	InicioCapa("capaOpcion4On",nDespV1,nDespH1 +(3*nSepH),nwidth,20,false,25,"nada()","rollOut('capaOpcion4On');");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="darkBg">';
	menu += '<table cellpadding="0" cellspacing="1" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOn" nowrap align="center" valign="middle">'+Enlace+'</td>';
	menu += '</tr></table></td></tr></table>';
	document.write(menu);
	FinCapa();
	layerSelectedArray[3] = new layerSelected(BuscarObjeto('capaOpcion4On'),false, "dinámico");
//  *****************************
//	 Boton de Opcion 5 OFF
//  *****************************
	var Enlace;

	Enlace="<a href=\"javascript:keepSelected(4);\" class=\"textoOn\">Agressivo</a>";
	var menu = '';
	InicioCapa("capaOpcion5Off",nDespV1,nDespH1 +(4*nSepH),nwidth,20,true,20,"rollOver('capaOpcion5On');","nada()");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOff" nowrap align="center" valign="middle">Agressivo</td>';
	menu += '</tr></table>';
	document.write(menu);
	FinCapa();
//  *****************************
//	 Boton de Opcion 5 ON
//  *****************************
	var menu = '';
	InicioCapa("capaOpcion5On",nDespV1,nDespH1 +(4*nSepH),nwidth,20,false,25,"nada()","rollOut('capaOpcion5On');");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="darkBg">';
	menu += '<table cellpadding="0" cellspacing="1" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOn" nowrap align="center" valign="middle">'+Enlace+'</td>';
	menu += '</tr></table></td></tr></table>';
	document.write(menu);
	FinCapa();
	layerSelectedArray[4] = new layerSelected(BuscarObjeto('capaOpcion5On'),false,"Agressivo");
//  *****************************
//	 Boton de Opcion 6 OFF
//  *****************************
	var Enlace;

	Enlace="<a href=\"javascript:keepSelected(5);\" class=\"textoOn\">Até 2 anos</a>";
	var menu = '';
	InicioCapa("capaOpcion6Off",nDespV2,nDespH1,nwidth2,20,true,20,"rollOver('capaOpcion6On');","nada()");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOff" nowrap align="center" valign="middle">Até 2 anos</td>';
	menu += '</tr></table>';
	document.write(menu);
	FinCapa();
//  *****************************
//	 Boton de Opcion 6 ON
//  *****************************
	var menu = '';
	InicioCapa("capaOpcion6On",nDespV2,nDespH1,nwidth2,20,false,25,"nada()","rollOut('capaOpcion6On');");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="darkBg">';
	menu += '<table cellpadding="0" cellspacing="1" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOn" nowrap align="center" valign="middle">'+Enlace+'</td>';
	menu += '</tr></table></td></tr></table>';
	document.write(menu);
	FinCapa();
	layerSelectedArray[5] = new layerSelected(BuscarObjeto('capaOpcion6On'),false, "Hasta2anios");
//  *****************************
//	 Boton de Opcion 7 OFF
//  *****************************
	var Enlace;

	Enlace="<a href=\"javascript:keepSelected(6);\" class=\"textoOn\">De 2 a 5 anos</a>";
	var menu = '';
	InicioCapa("capaOpcion7Off",nDespV2,nDespH1 +(1*nSepH2),nwidth2,20,true,20,"rollOver('capaOpcion7On');","nada()");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOff" nowrap align="center" valign="middle">De 2 a 5 anos</td>';
	menu += '</tr></table>';
	document.write(menu);
	FinCapa();
//  *****************************
//	 Boton de Opcion 7 ON
//  *****************************
	var menu = '';
	InicioCapa("capaOpcion7On",nDespV2,nDespH1 +(1*nSepH2),nwidth2,20,false,25,"nada()","rollOut('capaOpcion7On');");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="darkBg">';
	menu += '<table cellpadding="0" cellspacing="1" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOn" nowrap align="center" valign="middle">'+Enlace+'</td>';
	menu += '</tr></table></td></tr></table>';
	document.write(menu);
	FinCapa();
	layerSelectedArray[6] = new layerSelected(BuscarObjeto('capaOpcion7On'),false, "De2a5anios");
//  *****************************
//	 Boton de Opcion 8 OFF
//  *****************************
	var Enlace;

	Enlace="<a href=\"javascript:keepSelected(7);\" class=\"textoOn\">Mais de 5 anos</a>";
	var menu = '';
	InicioCapa("capaOpcion8Off",nDespV2,nDespH1 +(2*nSepH2),nwidth2,20,true,20,"rollOver('capaOpcion8On');","nada()");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOff" nowrap align="center" valign="middle">Mais de 5 anos</td>';
	menu += '</tr></table>';
	document.write(menu);
	FinCapa();
//  *****************************
//	 Boton de Opcion 8 ON
//  *****************************
	var menu = '';
	InicioCapa("capaOpcion8On",nDespV2,nDespH1 +(2*nSepH2),nwidth2,20,false,25,"nada()","rollOut('capaOpcion8On');");
	menu += '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="darkBg">';
	menu += '<table cellpadding="0" cellspacing="1" border="0" width="100%" height="20"><tr>';
	menu += '<td class="textoOn" nowrap align="center" valign="middle">'+Enlace+'</td>';
	menu += '</tr></table></td></tr></table>';
	document.write(menu);
	FinCapa();
	layerSelectedArray[7] = new layerSelected(BuscarObjeto('capaOpcion8On'),false,"mas5anios");
// Capas de contenidos
//---------------------------------------
}
