<!--

//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02)
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

/*
var head="display:''"
img1=new Image()
img1.src="fold.gif"
img2=new Image()
img2.src="open.gif"

var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

function checkcontained(e){
var iscontained=0
cur=ns6? e.target : event.srcElement
i=0
if (cur.id=="foldheader")
iscontained=1
else
while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){
if (cur.id=="foldheader"||cur.id=="foldinglist"){
iscontained=(cur.id=="foldheader")? 1 : 0
break
}
cur=ns6? cur.parentNode : cur.parentElement
}

if (iscontained){
var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0]
if (foldercontent.style.display=="none"){
foldercontent.style.display=""
cur.style.listStyleImage="url(open.gif)"
}
else{
foldercontent.style.display="none"
cur.style.listStyleImage="url(fold.gif)"
}
}
}

if (ie4||ns6)
document.onclick=checkcontained
*/

function popUp(URL,scroll,width,height,resizable,status,left,top) {
// calculate the left edge (x position) of the popup window; if we can't get the screen width then make it 20 pixels (after the : )
var popupX = (screen.availWidth)? ((screen.availWidth - width) / 2):20;
// calculate the top edge (y position) of the popup window; if we can't get the screen heigth then make it 20 pixels
var popupY = (screen.availHeight)? ((screen.availHeight - height) / 2):20;

day = new Date();
id = day.getTime();

eval("page" + id + " = window.open('"+URL+"', '" + id + "', 'toolbar=0,scrollbars="+scroll+",location=0,status="+(status?status:"0")+",menubar=0,resizable="+(resizable?resizable:"0")+",width="+width+",height="+height+",left="+(left>=0?left:popupX)+",top="+(top>=0?top:popupY)+"');");
}

//-->


//<!-- Funciones para rollovers de las imagenes
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.0
  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 && document.getElementById) x=document.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 abre_flo(sCual,iAncho,iAlto,sScroll,Arriba,Derecha,nameflo)
{
	if(nameflo==null) nameflo="flot_BE";
	eval(nameflo+"=window.open(sCual,nameflo,'toolbar=no,location=no,directories=no,status=no,scrollbars="+sScroll+",resizable=yes,copyhistory=no,width="+iAncho+",height="+iAlto+",top="+Arriba+",left="+Derecha+",dependent=yes')");
}

//-->

<!-- funcion para desplazar el cuerpo de la web -->
function modificarCuerpo(url)
{ 
		if(window.parent.frames['cuerpo']!=null)
			window.parent.frames['cuerpo'].location=url;
}
<!-- funcion para desplazar la cabecera de la web -->
function modificarCabecera(url)
{
	if(window.parent.frames['cabecera']!=null)
		window.parent.frames['cabecera'].location=url;	

}
<!-- funcion para poner el tamaņo adecuado de las homes segun la resolucion -->
function TamannoHome()
{
	if (window.document.getElementById != null)
	{
	   var anchoTabla800 = 779;
	   var anchoTabla1024 = 800;
		var tabla=document.getElementById("tablaPrincipal");
	   var ancho800 = 0;
	   var ancho1024 = 0;
	   var ancho = 0;

		if (tabla != null)
		{
			if (screen.width == 800)
				tabla.width=anchoTabla800;	
			else {
				tabla.width=(window.document.body.clientWidth < anchoTabla1024)? anchoTabla800:anchoTabla1024;
         }
         
			if ((document.location.href.toLowerCase().indexOf('_tienda') < 0) &&
			    (document.location.href.toLowerCase().indexOf('canaljoven') < 0))
			{
			   ancho800 = 144;
			   ancho1024 = 154;
			}
			else {
			   ancho800 = '100%';
			   ancho1024 = '100%';
			}

			ancho = (tabla.width == anchoTabla800)?ancho800:ancho1024;
         if (ancho != 0) {    
            for (var i = 8; i>0; i--){
			      if (document.getElementById("Producto"+i))
			         document.getElementById("Producto"+i).style.width = ancho;
			   }
			}
			if (ie4)
			   if (document.body.clientHeight < document.body.scrollHeight) {
			      ancho = ancho800;
			      tabla.width = anchoTabla800;
               for (var i = 8; i>0; i--){
			         if (document.getElementById("Producto"+i))
			            document.getElementById("Producto"+i).style.width = ancho;
			      }
			   }
		}
      else
		{
			return;
		}
	}
	else {}
	
	if (parent.frames['cabecera'].window.ComprobarResolucion)
	   parent.frames['cabecera'].window.ComprobarResolucion();
}
<!-- funcion para comprobar si existe el frame superior -->
function ColocaCabecera(canal)
{
	if (window.parent.frames['cabecera'] == null)
	{
	   
	   var cookie = document.location.pathname.split('/')[2];
	   
		var nombreCanal=new String(canal);
		if (nombreCanal != '')
		   nombreCanal=nombreCanal.toLowerCase().toString();
		else
		   nombreCanal=document.location.pathname.split('/')[3];
		   
		if (nombreCanal.substr(0,1) == '_' & 
		    nombreCanal.toLowerCase() != '_comercioexterior')
		    nombreCanal = 'CanalParticulares';
		
		var destino=new String('PortalCan/'+ cookie +'/_Otros/FrameSuperior/'+nombreCanal);

		var url=new String(
		   "/index.asp?x="+escape(document.location.pathname+document.location.search));
		url+="&y="+destino
		//redireccionamos  
		window.location.href = url;		
	}	
}
<!-- funcion para comprobar si existe el frame superior -->
function ComprobarFrameSuperior()
{ 
	if (window.parent.frames['cabecera']!= null)
	{
		//no hacemos nada si tiene cabecera
	}
	else
	{
		window.location.href = "/index.asp?x="+escape(document.location.pathname)+escape(document.location.search);		
		
	}	
}
<!-- funcion para comprobar si los dos frames son del mismo canal -->
<!-- sobra envio a la cabecera al canal del cuerpo, cuando el movimiento es de la cabecera -->
function CuerpoCabecera()
{
	if (top.frames['cuerpo']!= null && top.frames['cabecera']!= null)
	{
		var cabecera=new String(top.frames['cabecera'].location);
		var cuerpo=new String(top.frames['cuerpo'].location);
		var canalEnCabecera=cabecera.toLowerCase().indexOf('canal');
		var canalEnCuerpo=cuerpo.toLowerCase().indexOf('canal');
		if(canalEnCabecera!=-1 && canalEnCuerpo!=-1)
		{
			var finCanalEnCabecera=cabecera.toLowerCase().indexOf('/',canalEnCabecera);
			var finCanalEnCuerpo=cuerpo.toLowerCase().indexOf('/',canalEnCuerpo);
			//
			if (finCanalEnCabecera==-1)
				finCanalEnCabecera=cabecera.length;
			if (finCanalEnCuerpo==-1)
				finCanalEnCuerpo=cuerpo.length;
			//
			if(finCanalEnCabecera!=-1 && finCanalEnCuerpo!=-1)
			{
				var urlCabecera=cabecera.toLowerCase().substring(canalEnCabecera,finCanalEnCabecera);
				var urlCuerpo=cuerpo.toLowerCase().substring(canalEnCuerpo,finCanalEnCuerpo);
				//comprobamos si son distintos
				if(urlCabecera!=urlCuerpo)
				{
					cabecera=cabecera.substring(0,canalEnCabecera)+urlCuerpo+'/';
					//redireccionamos la cabecera
					top.frames['cabecera'].location.href = cabecera;
				}
			}
		}
	}
	else
	{
		//no hacemos nada
	}	
}

function abrir(direccion, pantallacompleta, herramientas, direcciones, estado, 
barramenu, barrascroll, cambiatamano, ancho, alto, sustituir)
{ 
	var izquierda = (screen.availWidth - ancho) / 2; 
	var arriba = (screen.availHeight - alto) / 2; 
	var opciones = "fullscreen=" + pantallacompleta +
	               ",toolbar=" + herramientas +
                  ",location=" + direcciones +
                  ",status=" + estado +
                  ",menubar=" + barramenu +
                  ",scrollbars=" + barrascroll +
                  ",resizable=" + cambiatamano +
                  ",width=" + ancho +
                  ",height=" + alto +
                  ",left=" + izquierda +
                  ",top=" + arriba;
	var ventana = window.open(direccion,"ventana",opciones,sustituir);
}

//comprobar todas las paginas
//CuerpoCabecera();
//ComprobarFrameSuperior();

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

<!-- funcion para ver la cabecera si se corresponde con el canal -->
function VerCabecera()
{
	alert('Cuerpo = ' + parent.frames['cuerpo'].location)
	if (parent != null)
	{
		//alert('Cuerpo = ' + parent.frames['cuerpo'].location)
		//var subcanal = parent.frames['cuerpo'].location.pathname.split('/')[4];
		//var subcanalFinal = parent.frames['cuerpo'].location.pathname.split('/')[5];
		//if (subcanal != 'Trabaja' && subcanalFinal !='')
		//{
			//alert('Cabecera = ' + parent.frames['cabecera'].location)
			if (parent.frames['cuerpo'] != null)
			{
				var CanalCuerpo = parent.frames['cuerpo'].location.pathname.split('/')[3];
				var CanalCabecera = parent.frames['cabecera'].location.pathname.split('/')[5];
				if (navigator.userAgent.indexOf('MondoSearch-MS') == -1)
				{
					if (CanalCuerpo == CanalCabecera)
					{
					}
					else
					{
						ColocaCabecera(CanalCuerpo)
					}
				}
			}
			else
			{
				ColocaCabecera('CanalParticulares')
			}
		//}
	}
}

//VerCabecera();