/*
Estas funciones se han descrito para ejemplificar determinadas funcionalidades en determinadas partes de la aplicacion.
Autor: GBP Banca Multicanal 
Fecha: Septiembre 2005.
*/


//----------- POP UP -------------//

function abrir_popup(nombre)
{
        window.open(nombre,'','width=600,height=500,top=20,left=20,scrollbars=yes,resizable=yes');
        return false;
}


function despSec(capa) { 

	var objDvS = document.getElementById(capa);	
	
	var estado = objDvS.style.visibility;
				
	if (estado == "hidden") {     
		objDvS.style.visibility="visible";
    		objDvS.style.display="block";    		
    	}
    	else {    		
		objDvS.style.visibility="hidden"; 
    		objDvS.style.display="none"
  	} 
  	
  	var aDivs = document.body.getElementsByTagName("DIV");		
  	
	for(var i = 0; i < aDivs.length ; i++){ 
    		argDv = 'dv_gbp_' + i;    
    		     			
    		argDv1 = document.getElementById(argDv);    
   
   		
    		if ((capa != argDv) && (argDv1 != null)){
	    		argDv1.style.visibility="hidden";
    			argDv1.style.display="none";
    		}
	}
}
	

function preCarga(){
	 
	var aDivs = document.body.getElementsByTagName("DIV");		
  	 
	for(var i = 1; i < aDivs.length ; i++){ 	 
    		argDv = 'dv_gbp_' + i;             			
    		argDv1 = document.getElementById(argDv);
    		if (argDv1 != null)
    		{
    			argDv1.style.visibility="hidden";    
    			argDv1.style.display="none";    		    				     		
    		}
	}	 		
}











//----------- MENU -------------//

window.onload = function() {inicializaMenu("menu");}

var cont;

function submenu(dv)
{
	objDvS = document.getElementById(dv)
	estado = document.getElementById(dv).style.display  
	document.getElementById("submenu").style.display="none"
 
	if(estado == 'block'){
	objDvS.style.display="none"
	}
	else{
	objDvS.style.display="block"	
	}
}


function inicializaMenu(idNodo) {
	//Cerramos todos los niveles
	var menu = document.getElementById(idNodo);
	
	var elementsUL = menu.getElementsByTagName('UL');
	for (var i=0;i<=elementsUL.length-1;i++){
		if (elementsUL[i].className.indexOf('visible')!=-1) {
			elementsUL[i].className = elementsUL[i].className.replace('visible','oculto');
			//elementsUL[i].nextSibling.className = elementsUL[i].nextSibling.className.replace('visible','oculto');
		}
	}
}

function despliega(idSubmenu, nivelSubmenu) {
	if(nivelSubmenu > 0){
		var idPadre = document.getElementById(idSubmenu).parentNode.parentNode.id;
		inicializaMenu(idPadre);
	}
	else{
		inicializaMenu("menu");
	}
	var nodo = document.getElementById(idSubmenu);
	nodo.className = (nodo.className.indexOf('visible')!=-1) ? nodo.className.replace('visible','oculto') : nodo.className.replace('oculto','visible');
}		


//----------- COLUMNAS -------------//
	
var capas = document.getElementsByTagName('DIV');
var patron = 'columna';
var arrColumnas = new Array();

function detectaColumnas(){
	var cont = 0;
	for(var i=0; i<capas.length; i++){
		var id_capa = capas[i].id.substring(0,patron.length);
		if(id_capa == patron){
			var arrTemp = new Array();
			arrTemp[i] = new Array();
			arrTemp[i][0] = capas[i].id;
			arrTemp[i][1] = document.getElementById(arrTemp[i][0]).hasChildNodes();
			if(arrTemp[i][1] == true){		// solo pasamos al array definitivo aquellos id de las capas q tienen contenido
				arrColumnas[cont] = arrTemp[i][0];
				cont++;
			}
		}
	}
}

function disponerColumnas(){
	detectaColumnas();
	if(arrColumnas.length > 1){
		for(var i=0; i<arrColumnas.length; i++){
			if(arrColumnas.length > 2){
					document.getElementById(arrColumnas[i]).className = 'w33';
			}
			else{
				document.getElementById(arrColumnas[i]).className = 'w50';
			}
		}
	}
	else{
		document.getElementById(arrColumnas[0]).className = 'w100'; 
	}
}



//----------- MENU DESPLEGABLE PARA CONTENIDO -------------//

<!--
// Declaración de variables
var a, b, d, v, aL, aR, aC, vT, vB, h8, w8, s8, wC, h12, s2, hC, px, bg, img, tb, tg, brd
var i, j, texto, iM, bM, iP, bP, iT, bT, css, tipo, fondo, cCss, lnk, cab, aLnk, aNom, bgc
a=' align="', d=document, v=' v'+a, aL=a+'left"', aR=a+'right"', aC=a+'center"'
vT=v+'top"', vB=v+'bottom"', h8=' height="8"', w8=' width="8"', s8=w8 + h8, wC=' width="100%"'
h12=' height="12"', s2=' width="24"'+ h12, b=' background="/img/', hC=' height="100%"'
px='<img src="/img/px.gif" width="1" height="1">', bg=' bgcolor="#FFFFFF"', sC=wC + hC
img='<img src="/img/', tb='<table border="0" cellspacing="0" cellpadding="0"'+ sC +'>'

function rB(texto){	return(bR(texto,'#818181','zonas/bla/',''))}
function rBGP(texto){	return(bR(texto,'#BCBCBC','zonas/regBOL/','#E6E6E6'))}
function rB2(texto,css,tipo,fondo){	return(bRW(texto,css,tipo,fondo))} 
function rBW(texto,css){ return(bRW(texto,css,'prod/','#FFFFFF'))} 
function rBG(texto,css){ return(bRW(texto,css,'zonas/Gris/','#eeeeee'))} 
function rBox2(texto,css){ return(bxRd3(texto,css,'prod/'))}
function rBox2GC(texto,css){ return(bxRd3(texto,'fdGris','zonas/regBOL/'))}
function rBP(tipo,cab,lnk,cCss,texto,css){return(bRP(tipo,cab,lnk,cCss,texto,css))} 
function rBox(texto,css){bxRd(texto,css,'prod/')}
function rBoxGC(texto,css){bxRd(texto,'fdGris','zonas/regBOL/')}

//*****************************************

function bR(texto,brd,tipo,fondo){
iT=img + tipo, bT=b + tipo;
if (brd == "") bgc = '';
else bgc = ' bgcolor="'+ brd +'"';
j ='<table border="0" cellspacing="0" cellpadding="0"'+ wC +'>'
j = j +'<tr><td'+ vT + s8 + bT +'left.gif">'+ iT +'topleft.gif"'+ s8 +'></td>'
j = j +'<td'+ vT + aC + wC +' rowspan="2"' +'><table border="0" cellspacing="0" cellpadding="0"'+ wC + hC +'>'
j = j +'<tr><td height="1"'+ bgc +'><img src="/img/px.gif"></td></tr>'
if (fondo == "") j = j +'<tr><td'+ aC + ' height="14">'+ texto +'</td></tr>';
else j = j +'<tr><td'+ aC +' height="14" bgcolor="'+ fondo +'">'+ texto +'</td></tr>';
j = j +'<tr><td height="1"'+ bgc +'><img src="/img/px.gif"></td></tr></table></td>'
j = j +'<td'+ aR + vT + s8 + bT +'right.gif">'+ iT +'topright.gif"'+ s8 +'></td></tr>'
j = j +'<tr><td'+ vB + h8 + bT +'left.gif">'+ iT +'dwnleft.gif"'+ s8 +'></td><td'+ aR + vB + h8 + bT +'right.gif">'+ iT +'dwnright.gif"'+ s8 +'></td></tr></table>'
return (j);
}

function bRW(texto,css,tipo,fondo){
iT=img + tipo, bT=b + tipo;
if (css=="") css = 'textoMora'
j =tb + '<tr><td'+ aL + vT + s8 +'>'+ iT +'topleft.gif"'+ s8 +'></td>'
j = j +'<td'+ bT +'top.gif"'+ h8 + wC +'>'+ px +'</td>'
j = j +'<td'+ aR + vT + s8 +'>'+ iT +'topright.gif"'+ s8 +'></td></tr>'
j = j +'<tr><td'+ bT +'left.gif">'+ px +'</td>'
j = j +'<td'+ aC +' class='+ css +' bgcolor='+ fondo +'>'+ texto +'</td>'
j = j +'<td'+ bT +'right.gif">'+ px +'</td></tr>'
j = j +'<tr><td'+ aL + vB + h8 +'>'+ iT +'dwnleft.gif"'+ s8 +'></td>'
j = j +'<td'+ bT +'dwn.gif"'+ h8 +'>'+ px +'</td>'
j = j +'<td'+ aR + vB + h8 +'>'+ iT +'dwnright.gif"'+ s8 +'></td></tr></table>'
return(j);
}

function bxRd3(texto,css,tipo){
iT=img + tipo, bT=b + tipo;
if (css=="") css = 'textoMora'
j=tb + '<tr><td'+ aL + vT + s8 +'>'+ iT +'topleft.gif"'+ s8 +'></td>';
j = j +'<td'+ bT +'top.gif"'+ h8 + wC +'>'+ px +'</td>';
j = j +'<td'+ aR + vT + s8 +'>'+ iT +'topright.gif"'+ s8 +'></td></tr>';
j = j +'<tr><td'+ bT +'left.gif">'+ px +'</td>';
j = j +'<td'+ aC +' class='+ css + bg +'>'+ texto +'</td>';	
j = j +'<td'+ bT +'right.gif">'+ px +'</td></tr>';
j = j +'<tr><td'+ aL + vB + h8 +'>'+ iT +'dwnleft.gif"'+ s8 +'></td>';
j = j +'<td'+ bT +'dwn.gif"'+ h8 +'>'+ px +'</td>';
j = j +'<td'+ aR + vB + h8 +'>'+ iT +'dwnright.gif"'+ s8 +'></td></tr></table>';
return (j);
}

function bxRd(texto,css,tipo){
iT=img + tipo, bT=b + tipo;
if (css=="") css = 'textoMora'
d.write(tb + '<tr><td'+ aL + vT + s8 +'>'+ iT +'topleft.gif"'+ s8 +'></td>');
d.write('<td'+ bT +'top.gif"'+ h8 + wC +'>'+ px +'</td>');
d.write('<td'+ aR + vT + s8 +'>'+ iT +'topright.gif"'+ s8 +'></td></tr>');
d.write('<tr><td'+ bT +'left.gif">'+ px +'</td>');
d.write('<td'+ aC +' class='+ css + bg +'>'+ texto +'</td>');
d.write('<td'+ bT +'right.gif">'+ px +'</td></tr>');
d.write('<tr><td'+ aL + vB + h8 +'>'+ iT +'dwnleft.gif"'+ s8 +'></td>');
d.write('<td'+ bT +'dwn.gif"'+ h8 +'>'+ px +'</td>');
d.write('<td'+ aR + vB + h8 +'>'+ iT +'dwnright.gif"'+ s8 +'></td></tr></table>');
}

function bxRd2(tipo,tit,texto,css){
iM=img +'menu/', bM=b +'menu/', bP=b +'prod/', iP=img +'prod/';
d.write(tb + '<tr><td'+ aL + vT +'>'+ iM + tipo +'/topleft.gif"'+ s2 +'></td>');
d.write('<td'+ aC + bM + tipo +'/top.gif"'+ wC + h12 +'>'+ tit +'</td>');
d.write('<td'+ aR + vT +'>' + iM + tipo +'/topright.gif"'+ s2 +'></td>');
d.write('</tr><tr><td colspan="3">');
d.write(tb +'<tr><td'+ w8 + bP +'left.gif">'+ px +'</td>');
d.write('<td'+ vT + bg + wC +' class="'+ css +'">'+ texto +'</td>');
d.write('<td'+ w8 + bP +'right.gif">'+ px +'</td></tr>');
d.write('<tr><td'+ vB + aL + s8 +'>'+ iP +'dwnleft.gif"'+ s8 +'></td>');
d.write('<td'+ bP +'dwn.gif"'+ h8 + wC +'>'+ px +'</td>');
d.write('<td'+ aR + vB + s8 +'>'+ iP +'dwnright.gif"'+ s8 +'></td>');
d.write('</tr></table>');
d.write('</td></tr></table>');
}

function bRP(tipo,cab,lnk,cCss,texto,css){
iM=img +'menu/', bM=b +'menu/', bP=b +'prod/', iP=img +'prod/';
if (tipo == "bw") {tg='target="_blank"'} else {tg=''}
j ='<table border="0" cellspacing="0" cellpadding="0"' + hC +'><tr>'
j = j +'<td'+ aL + vT +' width="24" >'+ iM + tipo +'/topleft.gif"'+ s2 +'></td>'
j = j +'<td'+ aC + bM + tipo +'/top.gif"'+ wC + h12 +'class="'+ cCss +'">'
if (lnk != '') {j = j +'<a class="'+ cCss +'" href="'+ lnk +'"'+ tg +'>'+ cab +'</a>'} else {j = j +cab}
j = j +'</td>'
j = j +'<td'+ aR + vT + ' width="24" >' + iM + tipo +'/topright.gif"'+ s2 +'></td>'
j = j +'</tr><tr><td colspan="3">'
j = j +'<table border="0" cellspacing="0" cellpadding="0"'+ wC + hC +'>'
j = j +'<tr><td'+ w8 + bP +'left.gif">'+ px +'</td>'
j = j +'<td valign="top"'+ bg + wC + hC +' class="'+ css +'">'+ texto +'</td>'
j = j +'<td'+ w8 + bP +'right.gif">'+ px +'</td></tr>'
j = j +'<tr><td'+ vB + aL + s8 +'>'+ iP +'dwnleft.gif"'+ s8 +'></td>'
j = j +'<td'+ bP +'dwn.gif"'+ h8 + wC +'>'+ px +'</td>'
j = j +'<td'+ aR + vB + s8 +'>'+ iP +'dwnright.gif"'+ s8 +'></td>'
j = j +'</tr></table>'
j = j +'</td></tr></table>'
return(j);
}

//*****************************************

function prod(aLnk,aNom){
j ='<table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td width="20"></td><td>'
for (i=0;i<=aLnk.length-2;i++) {j +='<a href="'+ aLnk[i] +'" class="lnkMora">- '+ aNom[i] +'</a><br>'}
j = j +'</td></tr></table>'
return(j);
}
//-->


//----------- ROLLOVER -------------//


// JavaScript Document
function cambia(id)
{
	document.getElementById(id).style.display = "block";
}
function mostrarMenu(id)
{
	document.getElementById(id).style.visibility = "visible";
	document.getElementById(id).style.display = "block";
}
function ocultarMenu(id)
{
	document.getElementById(id).style.visibility = "hidden";
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function cambia(id){
var ruta = document.getElementById(id); 
	if (ruta.style.display == 'none')
	{
	ruta.style.display = "block";	
	}
	else
	{
	ruta.style.display = "none";	
	}
}

function cambiaCapa(id)
{
 var i;
 var cade = "";
 var vv;
	
 for (i=1;i<50;i++)
 {
	cade = "div" + i;
	vv = document.getElementById(cade);
		
	if (vv==null)
	{
	break;
		
	}
	else
	{
		if(vv.name==id)
		{
			vv.style.display="block";
		}
		else
		{
			if(vv.style.display == "block") vv.style.display="none";
		}
	}
 }
}