// JavaScript Document
var indArray = 0
function Browser(){
	this.dom = document.getElementById?1:0;
	this.ie4 = (document.all && !this.dom)?1:0;
	this.ns4 = (document.layers && !this.dom)?1:0;
	this.ns6 = (this.dom && !document.all)?1:0;
	this.ie5 = (this.dom && document.all)?1:0;
	this.ok = this.dom || this.ie4 || this.ie5;
	this.platform = navigator.platform;
}
var browser = new Browser();

function AbrirVentana(url,ancho,alto){
	var propiedades;
	propiedades="scrollbars=1, status=0, toolbars=0, resizable=no,top=50,left=50,width=" + ancho+",height="+alto;
	window.open(url,"" ,propiedades);
}

function div(nombre, imgRef){
	if (browser.ns4){
		var tmpLayer = new Layer(127);
	}
	if (browser.dom || browser.ie4){
		var tmpLayer = browser.dom?document.getElementById(nombre):document.all(nombre);
	}
	if(isObject(tmpLayer))
		this.existe = true;
	else
		this.existe = false;
	if(imgRef != ""){
		objRef = document.images[imgRef];
		this.xRef = posimgX(objRef);
		this.yRef = posimgY(objRef);
	}else{
		this.xRef = 0;
		this.yRef = 0;
	}
	this.containerLayer = tmpLayer;
	this.desplazaX = desplazaX;
	this.desplazaY = desplazaY;
	this.escribeDiv = escribeDiv;
	this.visible = visible;
	this.display = display;
	this.muestraContenido = contenido;
}

function contenido(){
	if (browser.ie4 || browser.dom)
		return this.containerLayer.innerHTML
}

function visible(valor){
	if (browser.ie4 || browser.dom){
		divmenu = this.containerLayer.style
		switch(valor){
			case 0:
				nuevo_estado = "hidden";
				break;
			case 1:
				nuevo_estado = "visible";
		}
	}else{
		if (browser.ns4){
 			divmenu = this.containerLayer;
 			switch(valor){
		 		case 0:
		 			nuevo_estado = "hide";
		 			break;
		 		case 1:
		 			nuevo_estado = "show";
			}
		}
	}

	divmenu.visibility = nuevo_estado
}

function display(valor){
	if (browser.ie4 || browser.dom){
		divmenu = this.containerLayer.style
		switch(valor){
			case 0:
				nuevo_estado = "none";
				break;
			case 1:
				nuevo_estado = "block";
		}
		divmenu.display = nuevo_estado
	}
}

function escribeDiv(str){
	if (browser.ie4)
		this.containerLayer.innerHTML = str;
	else
		if (browser.dom)
			this.containerLayer.innerHTML = str;
		else
			if(browser.ns4){
				this.containerLayer.document.open();
				this.containerLayer.document.write(str);
				this.containerLayer.document.close();
			}
}

function desplazaX(x){
	if (browser.dom || browser.ie4)
		this.containerLayer.style.left = x + "px";
	if(browser.ns4)
		this.containerLayer.left = x;
}

function desplazaY(y){
	if (browser.dom || browser.ie4)
		this.containerLayer.style.top = y + "px";
	if(browser.ns4)
		this.containerLayer.top = y;
}

function isObject(a){
	return (typeof a == 'object' && !!a) || isFunction(a);
}

function isFunction(a) {
	return typeof a == 'function';
}


var indFavoritos = 0
var indFavoritosSel = 0
function favItem(ind, total){			
	indFavoritos += ind;
	if(indFavoritos<0) indFavoritos = total - 1
	if(indFavoritos>=total) indFavoritos = 0		
	var favorito = new div("favItem" + indFavoritos, "")
	favorito.display(1)
	var favoritoImg = new div("favItemImg" + indFavoritos, "")
	if(favoritoImg.existe)
		favoritoImg.display(1)
	favorito = new div("favItem" + indFavoritosSel, "")
	if(total > 1){
		favorito.display(0)
		favoritoImg = new div("favItemImg" + indFavoritosSel, "")
		if(favoritoImg.existe)
			favoritoImg.display(0)
	}
	indFavoritosSel = indFavoritos
}