function cargando(){}
function onbeforeload(){
	xmpinit();
	navieinit();
}
var overultimo = null;
function estuchesover(){
	var iframe = window.frames['estuche' + this.getAttribute("idestuche")];
	if(iframe){
		var doc = iframe.document
		if(doc.getElementsByTagName("div").length == 4){
			var body = doc.body.innerHTML;
			
			var over  = document.createElement("div")
			over.className="estucheover posicion"+this.getAttribute("posicion")
			document.body.appendChild(over);
			over.innerHTML = body
			
			overultimo = over ;
		}
	}
}
function estuchesout(){
	if(overultimo){
		overultimo.parentNode.removeChild(overultimo);
		overultimo = null
	}
}

function navieinit(){
	var menu = document.getElementById('Menusup');
	var oo = menu.getElementsByTagName('li')
	for(var i = 0; i < oo.length; i++){
		var o = oo[i];
		o.onmouseover=function(){this.className="over";}
		o.onmouseout=function(){this.className="";}
	}
}

function navieforzarover(id, Qseguro, funcionover, funcionout){
	var seguro = Qseguro || false
	if (seguro || BrowserDetect.browser=="Explorer"&&BrowserDetect.version==6) {
		if(typeof id == 'string'){
			var navRoot = document.getElementById(id);
		}else{
			var navRoot = id
		}
		if(navRoot){
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
						this.funcionover()
					}
					node.funcionover = function(){};
					if (typeof funcionover == 'function'){
						node.funcionover = funcionover
					}
					
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
						this.funcionout()
					}
					node.funcionout = function(){};
					if (typeof funcionout == 'function'){
						node.funcionout = funcionout
					}
				}
			}
			return navRoot
		}
	}
	return false
}
function navieforzaroverany(id, Qseguro, funcionover, funcionout){
	var seguro = Qseguro || false
	if (seguro || BrowserDetect.browser=="Explorer"&&BrowserDetect.version==6) {
		if(typeof id == 'string'){
			var navRoot = document.getElementById(id);
		}else{
			var navRoot = id
		}
		if(navRoot){
			node = navRoot
			node.onmouseover=function() {
				this.className+=" over";
				this.funcionover()
			}
			node.funcionover = function(){};
			if (typeof funcionover == 'function'){
				node.funcionover = funcionover
			}
			
			node.onmouseout=function() {
				this.className=this.className.replace(" over", "");
				this.funcionout()
			}
			node.funcionout = function(){};
			if (typeof funcionout == 'function'){
				node.funcionout = funcionout
			}
		}
	}
}

function xmpinit(){
	var oo= document.getElementsByTagName('xmp');
	for (var i=0; i<oo.length; i++) {
		node = oo[i];
		node.ondblclick=xmpclick
	}
}
function xmpclick(e, obj){
	if(!obj) obj = this;
	
	obj.className = obj.className || ''
	
	if(obj.className.indexOf('hover')>=0){
		obj.className = obj.className.replace(/(?:^| )hover/i, '')
	}else{
		obj.className+= ' hover'
	}
	
	if(obj.className.indexOf('docked')>=0){
		obj.className = obj.className.replace(/(?:^| )docked/i, '')
	}else{
		obj.className+= ' docked'
	}
}
var ultimoobj = null;
function abrirproducto(obj){
	var oda;
	if(oda = cerrarproducto() && oda.parentNode == obj){return false}
	
	var Qimg = obj.getAttribute('oimagen');
	var Qtexto = obj.getAttribute('otitulo');
	
	var Hcontenedor = document.createElement('div');
	Hcontenedor.className="popup"
	
	var Htitulo = document.createElement('div');Hcontenedor.appendChild(Htitulo);
	Htitulo.innerHTML = Qtexto;
	Htitulo.className = "textopopup"
	
	var Himg = document.createElement('img');Hcontenedor.appendChild(Himg);
	Himg.src = Qimg;
	Himg.width = 290;
	
	Hcontenedor.onclick = cerrarproducto;
	
	obj.insertBefore(Hcontenedor,obj.childNodes[0]);
	ultimoobj = Hcontenedor
}
function cerrarproducto(){
	var uo = null
	if (ultimoobj){
		ultimoobj.parentNode.removeChild(ultimoobj);
		uo = ultimoobj
		ultimoobj = null;
	}
	return ultimoobj;
}
function cerrarse(){ 
window.close() 
}
