//obrir i tancar una layer
function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

//obrir una layer i tancar totes les demés
function toggleLayerMultiple( whichLayer )
{
  for(i=1;i<=9;i++){
	var elem, vis, boto, llista;
	if( document.getElementById ) // this is the way the standards work
	  elem = document.getElementById( 'DivPrdInfo'+i ),
	  boto = document.getElementById( 'BtPrdInfo'+i ),
	  llista = document.getElementById( 'LiPrdInfo'+i );
	else if( document.all ) // this is the way old msie versions work
	    elem = document.all['DivPrdInfo'+i],
		boto = document.all['BtPrdInfo'+i],
		llista = document.all['LiPrdInfo'+i];
	else if( document.layers ) // this is the way nn4 works
	  elem = document.layers['DivPrdInfo'+i],
	  boto = document.layers['BtPrdInfo'+i],
	  llista = document.layers['LiPrdInfo'+i];
	if(elem){
	vis = elem.style;
	boto.className = "ninguno";
	llista.className = "ninguno";	
	vis.display = 'none';
	}
	if(boto){
	boto.className = "ninguno";
	llista.className = "ninguno";
	}	
  }
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( 'DivPrdInfo'+whichLayer ),
	boto = document.getElementById( 'BtPrdInfo'+whichLayer ),
	llista = document.getElementById( 'LiPrdInfo'+whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all['DivPrdInfo'+whichLayer],
	  boto = document.all['BtPrdInfo'+whichLayer],
	  llista = document.all['LiPrdInfo'+whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers['DivPrdInfo'+whichLayer],
	boto = document.layers['BtPrdInfo'+whichLayer],
	llista = document.layers['LiPrdInfo'+whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
  llista.className = "Actiu";
  boto.className = "LinkActiu";
}
