var openingfrigo=0;
var FADE_INTERVAL=1;//Temps que esta una foto en escena (com més baix, més ràpid)

var ALT_INC=5; //pixels que incrementa/decrementa
var ALT_DEC=5;

var LIM_ALT=95 + ALT_INC - 2  -0; //límit d'altura
var LIM_MIN=1;	//altura mínima



function openPaso1(id)
{
	clearTimeout(window['temporClose' + id]); //si estem "onmouseover", eliminem el timeout de "onmouseout"
	window['tempor' + id] = setTimeout(function(){openPaso2(id)},FADE_INTERVAL); //creem el timeout per a la opertura de la persiana
	
	//alert(id);
}

//Per a fer que el panorama s'obri de baix a dalt
function openPaso2(id)
{	
	//Calcul de la altura següent
	altura = $(id+"Descr").style.height;
	altura = altura.replace("px","");
	altura = parseInt(altura)+ALT_INC;
	//alert(altura)

	//verificar si hem acabat
	if(altura>=LIM_ALT) //si ja hem acabat una transició, acabem
	{
		$(id+"Descr").style.height=LIM_ALT+"px";
		clearTimeout(window['tempor' + id]);
	} 
	else
	{
		$(id+"Descr").style.height=altura+"px";
		clearTimeout(window['tempor' + id]);
		window['tempor' + id]=setTimeout(function(){openPaso2(id)},FADE_INTERVAL);
	}
}

function closePaso1(id)
{
	clearTimeout(window['tempor' + id]); //si estem a "onmouseout", eliminem el timeout de "onmouseover"
	window['temporClose' + id]=setTimeout(function(){closePaso2(id)},FADE_INTERVAL); //creem el timeout per al tancament de la persiana
}

//Per a fer que el panorama s'obri de baix a dalt
function closePaso2(id)
{	
	//Calcul de la altura següent
	altura = $(id+"Descr").style.height;
	altura = altura.replace("px","");
	altura = parseInt(altura)-ALT_DEC;
	
	
	//verificar si hem acabat
	if(altura<=LIM_MIN)
	{
		$(id+"Descr").style.height=LIM_MIN+"px";
		clearTimeout(window['temporClose' + id]);
	} 
	else
	{
		$(id+"Descr").style.height=altura+"px";
		clearTimeout(window['temporClose' + id]);
		window['temporClose' + id]=setTimeout(function(){closePaso2(id)},FADE_INTERVAL);
	}
}


/*function load()
{
	$("frigoDescr").style.height="5px";
	$("floraDescr").style.height="5px";
	$("knorrDescr").style.height="5px";
	$("laysDescr").style.height = "5px";

	$("calveDescr").style.height = "5px";
	$("doveDescr").style.height = "5px";
	$("bimboDescr").style.height = "5px";
	$("sanmiguelDescr").style.height = "5px";
	
	//frigo tindra una transparencia... per provar
	$("frigoDescr").style.opacity = 0.9;
	$("frigoDescr").style.MozOpacity = 0.9;
	$("frigoDescr").style.filter = "alpha(opacity="+(0.9*100)+")";

    //alert("H");
}

function onloadDescripcio() {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = load();
    }
    else {
        window.onload = function () {
            oldonload();
            load();
        }
    }
}*/
