<!--

function AbrirPopUp(url, ancho, alto) {
    hWnd = window.open(url, "AbrirPopup", "left=10,top=10,width="+ancho+",height="+alto+",resizable=yes,scrollbars=yes,status=no,help=no");
    if ((document.window != null) && (!hWnd.opener))
        hWnd.opener = window.open(url,'myWIndow','resizable=yes');
        hWnd.focus();
}


function fBuscar() { 
  var f = document.frmBusqueda;
  if ((f.q.value == "" )||(f.q.value == "undefined" )) {
   alert('Debe cargar un texto de búsqueda')
   return false;  
  }  
  if (f.tipo(0).checked) {
    f.target = "_new";
    f.action = "http://www.google.com/search"
    f.submit;
	}
   else  {
    f.target = "_self";   
    f.action = "resultado.asp"
    f.submit;
	}   	
}





var enterWin=false;
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_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_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 MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function flevDivPositionValue(sDiv, sProperty) { // v2.1, Marja Ribbers-de Vroed, FlevOOware
	this.opera = (window.opera); // Opera 5+
	this.ns4 = (document.layers); // Netscape 4.x
	this.ns6 = (document.getElementById && !document.all && !this.opera); // Netscape 6+
	this.ie = (document.all);  // Internet Explorer 4+
    var sValue = ""; docObj = eval("MM_findObj('" + sDiv + "')"); if (docObj == null) {return 0;}
	if ((sProperty == "left") || (sProperty == "top")) {
		if (!this.ns4) {docObj = docObj.style;} 
		sValue = eval("docObj." + sProperty);
		if ((this.ie) && (sValue == "")) { // IE (on PC) bug with nested layers
			if (sProperty == "top") { sValue = eval(sDiv + ".offsetTop"); } 
			else { sValue = eval(sDiv + ".offsetLeft"); } 
		};
	}
	else {
		if (this.opera) {
			docObj = docObj.style;
			if (sProperty == "height") { sValue = docObj.pixelHeight; } 
			else if (sProperty == "width") { sValue = docObj.pixelWidth; } 
		}
		else if (this.ns4) {sValue = eval("docObj.clip." + sProperty);} 
		else if (this.ns6) {sValue = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(sProperty); } 
	    else if (this.ie) { 
			if (sProperty == "width") { sValue = eval(sDiv + ".offsetWidth"); } 
			else if (sProperty == "height") { sValue = eval(sDiv + ".offsetHeight"); } 
		}
   	}
	sValue = (sValue == "") ? 0 : sValue; 
	if (isNaN(sValue)) { if (sValue.indexOf('px') > 0) { sValue = sValue.substring(0,sValue.indexOf('px')); } } 
	return parseInt(sValue); 
}

function flevPersistentLayer() { // v3.3, Marja Ribbers-de Vroed, FlevOOware
	var sD = arguments[0], oD = eval("MM_findObj('" + sD + "')"), iWW, iWH, iSX, iSY, iT = 10, sS = "";
	if (!document.layers) {oD = oD.style;}
//	if (oD.tmpTimeout != null) {clearTimeout(oD.tmpTimeout);}
	var sXL = arguments[1], sXC = arguments[2], sXR = arguments[3], sYT = arguments[4], sYC = arguments[5], sYB = arguments[6];
	var iS = (arguments.length > 7) ? parseInt(arguments[7]) : 0, iPx = (arguments.length > 8) ? parseInt(arguments[8]) : 0;
	if (window.innerWidth) { // NS4, NS6 and Opera
		var oW = window; iWW = oW.innerWidth; iWH = oW.innerHeight; iSX = oW.pageXOffset; iSY = oW.pageYOffset; }
	else if (document.documentElement && document.documentElement.clientWidth) { // IE6 in standards compliant mode
		var oDE = document.documentElement; iWW = oDE.clientWidth; iWH = oDE.clientHeight; iSX = oDE.scrollLeft; iSY = oDE.scrollTop; }
	else if (document.body) { // IE4+
		var oDB = document.body; iWW = oDB.clientWidth; iWH = oDB.clientHeight; iSX = oDB.scrollLeft; iSY = oDB.scrollTop; }
	else {return;}
	var iCX = iNX = flevDivPositionValue(sD, 'left'), iCY = iNY = flevDivPositionValue(sD, 'top');
	if (sXL != "") {iNX = iSX + parseInt(sXL);} 
	else if (sXC != "") {iNX = Math.round(iSX + (iWW/2) - (flevDivPositionValue(sD, 'width')/2));}
	else if (sXR != "") {iNX = iSX + iWW - (flevDivPositionValue(sD, 'width') + parseInt(sXR));}
	if (sYT != "") {iNY = iSY + parseInt(sYT);}
	else if (sYC != "") {iNY = Math.round(iSY + (iWH/2) - (flevDivPositionValue(sD, 'height')/2));}
	else if (sYB != "") {iNY = iSY + (iWH - flevDivPositionValue(sD, 'height') - parseInt(sYB));}
	if ((iCX != iNX) || (iCY != iNY)) {
		if ((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1) && (!window.opera)) {sS="px";}
		eval("oD.left = '" + iNX + sS + "'");
		eval("oD.top = '" + iNY + sS + "'");
	}	
	var sF = "flevPersistentLayer('" + sD + "','" + sXL + "','" + sXC + "','" + sXR + "','" + sYT + "','" + sYC + "','" + sYB + "'," + iS + "," + iPx + ")";
	//oD.tmpTimeout = setTimeout(sF,10);
}

function flevInitPersistentLayer() { // v3.3, Marja Ribbers-de Vroed, FlevOOware
	if (arguments.length < 8) {return;}
	var sD = arguments[0]; if (sD == "") {return;}
	var	oD = eval("MM_findObj('" + sD + "')"); if (!oD) {return;}
	var iCSS = parseInt(arguments[1]);
	var sXL = arguments[2], sXC = arguments[3], sXR = arguments[4], sYT = arguments[5], sYC = arguments[6], sYB = arguments[7];
	var iS = (arguments.length > 8) ? parseInt(arguments[8]) : 0, iPx = (arguments.length > 9) ? parseInt(arguments[9]) : 0;
	if (iCSS != 0) { if (!document.layers) {oD = oD.style;} sXL = parseInt(oD.left), sYT = parseInt(oD.top);}
	var sF = "flevPersistentLayer('" + sD + "','" + sXL + "','" + sXC + "','" + sXR + "','" + sYT + "','" + sYC + "','" + sYB + "'," + iS + "," + iPx + ")";
	eval(sF);
}

function hideAll (  ) {
	MM_showHideLayers('layerAux','','hide');
	MM_showHideLayers('secciones','','hide');
	MM_showHideLayers('herramientas','','hide');
	MM_showHideLayers('miu24','','hide');
}

function getXYcoord ( nvn ) {
   var elm = document.images[nvn]; 
   if ( document.layers ) return elm;
           // NS4 images contain x and y values
   var rd = { x:0 ,y:0 };
   do { rd.x += parseInt( elm.offsetLeft );
        rd.y += parseInt( elm.offsetTop );
        elm = elm.offsetParent;
   } while ( elm );
   rd.x-=document.body.scrollLeft;
   rd.y-=document.body.scrollTop;
   return rd
} //end getXYcoord ( string ) -> object{x,y}

function ver(pagina, ancho, alto) {
	window.open (pagina, '','width=' + ancho + ',height=' + alto + ',resizable=yes,scrollbars=yes');
}

function validarCajaLogin() {
	if (document.FLOGIN.ctUSUARIO.value.length == 0) {
		alert("Por favor, ingrese su nombre de usuario.");
		document.FLOGIN.ctUSUARIO.focus();
		return false;
	} else if (document.FLOGIN.ctPASS.value.length == 0) {
		alert("Por favor, ingrese su contraseña.");
		document.FLOGIN.ctPASS.focus();
		return false;
	} else {
		return true;
	}
}

function validarFormLogin() {
	if (document.login.ctUSUARIO.value.length == 0) {
		alert("Por favor, ingrese su nombre de usuario.");
		document.login.ctUSUARIO.focus();
		return false;
	} else if (document.login.ctPASS.value.length == 0) {
		alert("Por favor, ingrese su contraseña.");
		document.login.ctPASS.focus();
		return false;
	} else {
		return true;
	}
}

function validarFormEmail() {
	if (document.login.ctEMAIL.value.length == 0) {
		alert("Por favor, ingrese su email.");
		document.login.ctEMAIL.focus();
		return false;
	} else {
		return true;
	}
}

function validarFormRegistracion() {
	if (document.fBUSCAR.ctNOMBRE.value.length == 0) {
		alert("Por favor, ingrese su nombre.");
		document.fBUSCAR.ctNOMBRE.focus();
		return false;
	} else if (document.fBUSCAR.ctUSUARIO.value.length == 0 || document.fBUSCAR.ctUSUARIO.value.length > 8) {
		alert("Por favor, ingrese un nombre de usuario de no más de 8 caracteres.");
		document.fBUSCAR.ctUSUARIO.focus();
		return false;
	} else if (document.fBUSCAR.ctAPELLIDO.value.length == 0) {
		alert("Por favor, ingrese su apellido.");
		document.fBUSCAR.ctAPELLIDO.focus();
		return false;
	} else if (document.fBUSCAR.ctPASS.value.length == 0) {
		alert("Por favor, ingrese una contraseña.");
		document.fBUSCAR.ctPASS.focus();
		return false;
	} else if (document.fBUSCAR.ctPROFESION.value.length == 0) {
		alert("Por favor, ingrese su profesión.");
		document.fBUSCAR.ctPROFESION.focus();
		return false;
	} else if (document.fBUSCAR.ctEMAIL.value.length == 0) {
		alert("Por favor, ingrese su correo electrónico.");
		document.fBUSCAR.ctEMAIL.focus();
		return false;
	} else {
		return true;
	}
}

function validarFormEnviarPorMail() {
	if (document.fENVIARMAIL.ctORIGEN.value.length == 0) {
		alert("Por favor, ingrese su nombre.");
		document.fENVIARMAIL.ctORIGEN.focus();
		return false;
	} else if (document.fENVIARMAIL.ctEMAILORIGEN.value.length == 0) {
		alert("Por favor, ingrese su email.");
		document.fENVIARMAIL.ctEMAILORIGEN.focus();
		return false;
	} else if (document.fENVIARMAIL.ctDESTINO.value.length == 0) {
		alert("Por favor, ingrese el nombre de la persona destino.");
		document.fENVIARMAIL.ctDESTINO.focus();
		return false;
	} else if (document.fENVIARMAIL.ctEMAILDESTINO.value.length == 0) {
		alert("Por favor, ingrese el email destino.");
		document.fENVIARMAIL.ctEMAILDESTINO.focus();
		return false;
	} else {
		return true;
	}
}

function validarFormRecuperarContrasena() {
	if (document.fBUSCAR.ctUSUARIO.value.length == 0 && document.fBUSCAR.ctEMAIL.value.length == 0) {
		alert("Por favor, ingrese su nombre de usuario o el email donde recibe los newsletters.");
		document.fBUSCAR.ctUSUARIO.focus();
		return false;
	} else
		return true;
}

function validarFormRegistracionExtendida() {
	if (document.fREGEXT.ctNOM.value.length == 0) {
		alert("Por favor, ingrese su nombre.");
		document.fREGEXT.ctNOM.focus();
		return false;
	} else if (document.fREGEXT.ctUSU.value.length == 0 || document.fREGEXT.ctUSU.value.length > 8) {
		alert("Por favor, ingrese un nombre de usuario de no más de 8 caracteres.");
		document.fREGEXT.ctUSU.focus();
		return false;
	} else if (document.fREGEXT.ctAPE.value.length == 0) {
		alert("Por favor, ingrese su apellido.");
		document.fREGEXT.ctAPE.focus();
		return false;
	} else if (document.fREGEXT.ctPASS.value.length == 0) {
		alert("Por favor, ingrese una contraseña.");
		document.fREGEXT.ctPASS.focus();
		return false;
	} else if (document.fREGEXT.ctPROFESION.value.length == 0) {
		alert("Por favor, ingrese su profesión.");
		document.fREGEXT.ctPROFESION.focus();
		return false;
	} else if (document.fREGEXT.ctEMAIL.value.length == 0) {
		alert("Por favor, ingrese su correo electrónico.");
		document.fREGEXT.ctEMAIL.focus();
		return false;
	} else {
		return true;
	}
}

function validarFormRegistracionAFS() {
	if (document.fREPORTE.ctNOMBRE.value.length == 0) {
		alert("Please, enter your name.");
		document.fREPORTE.ctNOMBRE.focus();
		return false;
	} else if (document.fREPORTE.ctAPELLIDO.value.length == 0) {
		alert("Please, enter your surname.");
		document.fREPORTE.ctAPELLIDO.focus();
		return false;
	} else if (document.fREPORTE.ctEMAIL.value.length == 0) {
		alert("Please, enter your e-mail.");
		document.fREPORTE.ctEMAIL.focus();
		return false;
	} else if (document.fREPORTE.ctPROFESION.selectedIndex == 0) {
		alert("Please, select your type of business.");
		document.fREPORTE.ctUSUARIO.focus();
		return false;		
	} else if (document.fREPORTE.ctUSUARIO.value.length == 0 || document.fREPORTE.ctUSUARIO.value.length > 8) {
		alert("Please, the username should be 4 - 8 characters.");
		document.fREPORTE.ctUSUARIO.focus();
		return false;
	} else if (document.fREPORTE.ctPASS.value.length == 0) {
		alert("Please, enter your password.");
		document.fREPORTE.ctPASS.focus();
		return false;
	} else if (document.fREPORTE.ctPASS.value.length != document.fREPORTE.ctCPASS.value.length) {
		alert("Please, your password and its confirmation should be equal.");
		document.fREPORTE.ctPASS.focus();
		return false;
	} else {
		return true;
	}
}

function validarFormRegistracionPapelRevista() {
	if (document.fREGEXT.ctLOCALIDAD.value.length == 0) {
		alert("Por favor, ingrese la localidad.");
		document.fREGEXT.ctLOCALIDAD.focus();
		return false;
	} else if (document.fREGEXT.ctCALLE.value.length == 0) {
		alert("Por favor, ingrese la calle de entrega.");
		document.fREGEXT.ctCALLE.focus();
		return false;
	} else if (document.fREGEXT.ctNUMERO.value.length == 0) {
		alert("Por favor, ingrese el núumero.");
		document.fREGEXT.ctNUMERO.focus();
		return false;
	} else if (document.fREGEXT.ctCODPOS.value.length == 0) {
		alert("Por favor, ingrese el código postal.");
		document.fREGEXT.ctCODPOS.focus();
		return false;
	} else {
		return true;
	}
}


// Funcionaes para el menu
function DropDownMenu1(id) {

    /* Type of the menu: "horizontal" or "vertical" */
    this.type = "horizontal";

    /* Delay (in miliseconds >= 0): show-hide menu */
    this.delay = {
        "show": 0,
        "hide": 0
    }
    /* Change the default position of sub-menu by Y pixels from top and X pixels from left
     * Negative values are allowed */
    this.position = {
        "top": 0,
        "left": 0
    }
    /* Z-index property for .section */
    this.zIndex = {
        "visible": 1,
        "hidden": -1
    };

    // Browser detection
    this.browser = {
        "ie": Boolean(document.body.currentStyle),
        "ie5": (navigator.appVersion.indexOf("MSIE 5.5") != -1 || navigator.appVersion.indexOf("MSIE 5.0") != -1)
    };
    if (!this.browser.ie) { this.browser.ie5 = false; }

    /* Initialize the menu */
    this.init = function() {
        if (!document.getElementById(this.id)) { return alert("DropDownMenu1.init() failed. Element '"+ this.id +"' does not exist."); }
        if (this.type != "horizontal" && this.type != "vertical") { return alert("DropDownMenu1.init() failed. Unknown menu type: '"+this.type+"'"); }
        if (this.browser.ie && this.browser.ie5) { fixWrap(); }
        fixSections();
        parse(document.getElementById(this.id).childNodes, this.tree, this.id);
    }

    /* Search for .section elements and set width for them */
    function fixSections() {
        var arr = document.getElementById(self.id).getElementsByTagName("div");
        var sections = new Array();
        var widths = new Array();
        
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].className == "section") {
                sections.push(arr[i]);
            }
        }
        for (var i = 0; i < sections.length; i++) {
            widths.push(getMaxWidth(sections[i].childNodes));
        }
        for (var i = 0; i < sections.length; i++) {
            sections[i].style.width = (widths[i]) + "px";
        }
        if (self.browser.ie) {
            for (var i = 0; i < sections.length; i++) {
                setMaxWidth(sections[i].childNodes, widths[i]);
            }
        }
    }

    function fixWrap() {
        var elements = document.getElementById(self.id).getElementsByTagName("a");
        for (var i = 0; i < elements.length; i++) {
            if (/item2/.test(elements[i].className)) {
                elements[i].innerHTML = '<div nowrap="nowrap">'+elements[i].innerHTML+'</div>';
            }
        }
    }

    /* Search for an element with highest width among given nodes, return that width */
    function getMaxWidth(nodes) {
        var maxWidth = 0;
        for (var i = 0; i < nodes.length; i++) {
            if (nodes[i].nodeType != 1) { continue; }
            if (nodes[i].offsetWidth > maxWidth) { maxWidth = nodes[i].offsetWidth; }
        }
        return maxWidth;
    }

    /* Set width for item2 elements */
    function setMaxWidth(nodes, maxWidth) {
        for (var i = 0; i < nodes.length; i++) {
            if (nodes[i].nodeType == 1 && /item2/.test(nodes[i].className) && nodes[i].currentStyle) {
                if (self.browser.ie5) {
                    nodes[i].style.width = (maxWidth) + "px";
                } else {
                    nodes[i].style.width = (maxWidth - parseInt(nodes[i].currentStyle.paddingLeft) - parseInt(nodes[i].currentStyle.paddingRight)) + "px";
                }
            }
        }
    }

    /* Parse nodes, create events, position elements */
    function parse(nodes, tree, id) {
        for (var i = 0; i < nodes.length; i++) {
            if (1 != nodes[i].nodeType) {
                continue;
            }
            switch (true) {
                // .item1
                case /\bitem1\b/.test(nodes[i].className):
                    nodes[i].id = id + "-" + tree.length;
                    tree.push(new Array());
                    nodes[i].onmouseover = item1over;
                    nodes[i].onmouseout = item1out;
                    break;
                // .item2
                case /\bitem2\b/.test(nodes[i].className):
                    nodes[i].id = id + "-" + tree.length;
                    tree.push(new Array());
                    break;
                // .section
                case /\bsection\b/.test(nodes[i].className):
                    // id, events
                    nodes[i].id = id + "-" + (tree.length - 1) + "-section";
                    nodes[i].onmouseover = sectionOver;
                    nodes[i].onmouseout = sectionOut;
                    // position
                    var box1 = document.getElementById(id + "-" + (tree.length - 1));
                    var box2 = document.getElementById(nodes[i].id);
                    if ("horizontal" == self.type) {
                        box2.style.top = box1.offsetTop + box1.offsetHeight + self.position.top + "px";
                        if (self.browser.ie5) {
                            box2.style.left = self.position.left + "px";
                        } else {
                            box2.style.left = box1.offsetLeft + self.position.left + "px";
                        }
                    } else if ("vertical" == self.type) {
                        box2.style.top = box1.offsetTop + self.position.top + "px";
                        if (self.browser.ie5) {
                            box2.style.left = box1.offsetWidth + self.position.left + "px";
                        } else {
                            box2.style.left = box1.offsetLeft + box1.offsetWidth + self.position.left + "px";
                        }
                    }
                    // sections, sectionsShowCnt, sectionsHideCnt
                    self.sections.push(nodes[i].id);
                    self.sectionsShowCnt.push(0);
                    self.sectionsHideCnt.push(0);
                    break;
            }
            if (nodes[i].childNodes) {
                if (/\bsection\b/.test(nodes[i].className)) {

                    parse(nodes[i].childNodes, tree[tree.length - 1], id + "-" + (tree.length - 1));
                } else {
                    parse(nodes[i].childNodes, tree, id);
                }
            }
        }
    }

    /* event, item1:onmouseover */
    function item1over() {
        var id_section = this.id + "-section";
        if (self.visible) {
            var el = new Element(self.visible);
            el = document.getElementById(el.getParent().id);
            if (/item1-active/.test(el.className)) {
                el.className = el.className.replace(/item1-active/, "item1");
            }
        }
        if (self.sections.contains(id_section)) {
            self.sectionsHideCnt[self.sections.indexOf(id_section)]++;
            var cnt = self.sectionsShowCnt[self.sections.indexOf(id_section)];
            setTimeout(function(a, b) { return function() { self.showSection(a, b); } } (id_section, cnt), self.delay.show);
        } else {
            if (self.visible) {
                var cnt = self.sectionsHideCnt[self.sections.indexOf(self.visible)];
                setTimeout(function(a, b) { return function() { self.hideSection(a, b); } } (self.visible, cnt), self.delay.show);
            }
        }
    }

    /* event, item1:onmouseout */
    function item1out() {
        var id_section = this.id + "-section";
        if (self.sections.contains(id_section)) {
            self.sectionsShowCnt[self.sections.indexOf(id_section)]++;
            if (id_section == self.visible) {
                var cnt = self.sectionsHideCnt[self.sections.indexOf(id_section)];
                setTimeout(function(a, b) { return function() { self.hideSection(a, b); } }(id_section, cnt), self.delay.hide);
            }
        }
    }

    /* event, section:onmouseover */
    function sectionOver() {
        self.sectionsHideCnt[self.sections.indexOf(this.id)]++;
        var el = new Element(this.id);
        el = document.getElementById(el.getParent().id);
        if (!/item1-active/.test(el.className)) {
            el.className = el.className.replace(/item1/, "item1-active");
        }
    }

    /* event, section:onmouseout */
    function sectionOut() {
        self.sectionsShowCnt[self.sections.indexOf(this.id)]++;
        var cnt = self.sectionsHideCnt[self.sections.indexOf(this.id)];
        setTimeout(function(a, b) { return function() { self.hideSection(a, b); } }(this.id, cnt), self.delay.hide);
    }

    /* Show section (1 argument passed)
     * Try to show section (2 arguments passed) - check cnt with sectionShowCnt */
    this.showSection = function(id, cnt) {
        if (typeof cnt != "undefined") {
            if (cnt != this.sectionsShowCnt[this.sections.indexOf(id)]) { return; }
        }
        this.sectionsShowCnt[this.sections.indexOf(id)]++;
        var el = new Element(id);
        var parent = document.getElementById(el.getParent().id);
        if (!/item1-active/.test(parent.className)) {
            parent.className = parent.className.replace(/item1/, "item1-active");
        }
        if (this.visible) {
            if (id == this.visible) { return; }
            this.hideSection(this.visible);
        }
        //document.getElementById(id).style.display = "block";
        document.getElementById(id).style.visibility = "visible";
        document.getElementById(id).style.zIndex = this.zIndex.visible;
        this.visible = id;
    }

    /* Hide section (1 argument passed)
     * Try to hide section (2 arguments passed) - check cnt with sectionHideCnt */
    this.hideSection = function(id, cnt) {
        if (typeof cnt != "undefined") {
            if (cnt != this.sectionsHideCnt[this.sections.indexOf(id)]) { return; }
        }
        var el = new Element(id);
        var parent = document.getElementById(el.getParent().id);
        parent.className = parent.className.replace(/item1-active/, "item1");
        document.getElementById(id).style.zIndex = this.zIndex.hidden;
        document.getElementById(id).style.visibility = "hidden";
        //document.getElementById(id).style.display = "none";
        if (id == this.visible) { this.visible = ""; }
        else {
            //throw "DropDownMenu1.hideSection('"+id+"', "+cnt+") failed, cannot hide element that is not visible";
            return;
        }
        this.sectionsHideCnt[this.sections.indexOf(id)]++;
    }

    /* Necessary when showing section that doesn't exist - hide currently visible section. See: item1over() */
    this.hideSelf = function(cnt) {
        if (this.visible && cnt == this.sectionsHideCnt[this.sections.indexOf(this.visible)]) {
            this.hideSection(this.visible);
        }
    }

    /* Element (.section, .item2 etc) */
    function Element(id) {
        /* Get parent element */
        this.getParent = function() {
            var s = this.id.substr(this.menu.id.length);
            var a = s.split("-");
            a.pop();
            return new Element(this.menu.id + a.join("-"));
        }
        this.menu = self;
        this.id = id;
    }

    var self = this;
    this.id = id; /* menu id */
    this.tree = []; /* tree structure of menu */
    this.sections = []; /* all sections, required for timeout */
    this.sectionsShowCnt = [];
    this.sectionsHideCnt = [];
    this.visible = ""; /* visible section, ex. menu-0-section */
}

/* Finds the index of the first occurence of item in the array, or -1 if not found */
if (typeof Array.prototype.indexOf == "undefined") {
    Array.prototype.indexOf = function(item) {
        for (var i = 0; i < this.length; i++) {
            if ((typeof this[i] == typeof item) && (this[i] == item)) {
                return i;
            }
        }
        return -1;
    }
}

/* Check whether array contains given string */
if (typeof Array.prototype.contains == "undefined") {
    Array.prototype.contains = function(s) {
        for (var i = 0; i < this.length; i++) {
            if (this[i] === s) {
                return true;
            }
        }
        return false;
    }
}
//-->
