var up = new Array();
up[0]=true;
up[1]=true;
up[2]=true;
var containerHeight;
var noticiasHeight;
var containerWidth;
var req;
var paginaActual=1;
var updated=true;
var containerHeight = new Array();

function switchLayer()
{
	var thumbToChange;
	thumbToChange="slider"+containerWidth.actual;
	document.getElementById(thumbToChange).innerHTML = "<img src=\"images/loading.gif\" />";
	document.getElementById(thumbToChange).style.backgroundImage = "url(images/blank.gif)";
	advAJAX.get({
	    url: "includes/next_thumbnail.php",
	    onSuccess : function(obj) {
	    	slideTal = document.getElementById(thumbToChange);
	    	slideTal.style.backgroundImage = "url(includes/thumbnails.php?img=../"+escape(obj.responseText)+"&w=148&h=96)";
	    	slideTal.innerHTML = "<a href=\""+obj.responseText+"\" rel=\"lightbox\"><img src=\"images/blank.gif\" height=\"96\" width=\"148\" border=\"0\"></a>"
    		initLightbox();
	    }
	});
	if(containerWidth.actual==1)
		containerWidth = new fx.SlideOut(2, {duration: 400, onComplete: switchLayer});
	else
		containerWidth = new fx.SlideOut(1, {duration: 400, onComplete: switchLayer});
}

function hideNShow(idContainer)
{
	containerHeight[idContainer].toggle('height');
	up[idContainer]=!up[idContainer];
	showArrow(idContainer);
}

function showArrow(idArrow)
{
	var flecha=document.getElementById("hide-n-show-"+idArrow);
	if(up[idArrow])
		flecha.src="images/hideMod.gif";
	else
		flecha.src="images/showMod.gif";
}

function hideArrow(idArrow)
{
	var flecha=document.getElementById("hide-n-show-"+idArrow);
	flecha.src="images/blank.gif";
}

fx.SlideOut = Class.create();
fx.SlideOut.prototype = Object.extend(new fx.Base(), {
	initialize: function(el, options) {
		this.actual=el;
		
		this.el1 = $('slider'+el);
	    
		if(document.all)
			this.el1.style.styleFloat='left';
		else
			this.el1.style.cssFloat='left';
			
		if(this.actual==1)
	    	otro=2;
	    else
	    	otro=1;
	    
	    this.el2 = $('slider'+otro);	    
	    
	    this.el1.style.overflow = "hidden";
		this.el2.style.overflow = "hidden";
	    this.el2.style.backgroundPosition = "left";
	    if(document.all)
			this.el2.style.styleFloat='right';
		else
			this.el2.style.cssFloat='right';
	    
	    this.setOptions(options);
	},
	
	increase: function() {
	    this.el1.style.width = this.now + "px";
	    this.el2.style.width = 148 - this.now + "px";
	    this.el1.style.backgroundPosition = "-"+(148-this.now)+"px 0px";
	},
	
	toggle: function(){
	    this.custom(this.el1.offsetWidth, 0);
	}
});
