/*************************************************************************/
//** 
//* Scroll Menu Manager Plugin (c)2005,  Grupo Anaya 
//* Este software queda suscrito a las condiciones de la licencia que se 
//* le presenta para la aceptación de dicho software. En caso contrario, 
//* únicamente le concedemos el derecho a utilizar el software sólo para 
//* el uso autorizado del Servicio. Dicho software y contenido están  
//* protegidos por derechos de autor y otras leyes y tratados sobre  
//* propiedad intelectual, no pudiendo ser copiado, ni manipulado,  
//* sin autorización del titular.
//* Nos reservamos los demás derechos sobre el software. Grupo Anaya, S.A. 
//* posee la titularidad, los derechos de autor y otros derechos 
//* de propiedad intelectual sobre dicho software.
//* 
/**************************************************************************/

curMenuID = null;


function SCRM_openMenuItem(id)
{
	if (curMenuID == id)
	{
		SCRM_closeMenuItem(curMenuID);
		return;
	}

	if (curMenuID!=null )
		SCRM_closeMenuItem(curMenuID);
	
	
	displaymode = navigator.userAgent.indexOf('Firefox')!=-1 ? 'table-cell' : 'block';
	document.getElementById(id).style.display = displaymode;
	//MF_toHeight(id,200)
	curMenuID = id;
	
//enviarflash(2);
	
}

function SCRM_closeMenuItem(id)
{
	
	//MF_toHeight(id,10)
	document.getElementById(id).style.display = 'none';
	
	curMenuID = null;
	
}


/********************************************************************/
//** 
//* 
/********************************************************************/

fENDHEIGHT = new Object();

function MF_toHeight(objid,endheight)
{
	obj = top.document.getElementById(objid);
	
	if (typeof endheight=='undefined')
		endheight = fENDHEIGHT[objid];
	else
		fENDHEIGHT[objid] = endheight;
		
		
	endheight= 1*endheight;
	curheight = 1*obj.style.height.replace(/px/g, '');

	if ( endheight==curheight )
		return;
	
	inc = Math.round(Math.abs(endheight-curheight)*0.1);
	
	x= Math.abs(endheight-curheight)
	
	inc = 70 / (1+0.2*Math.pow(Math.E,5-0.03*x) )  
	
	
	step = inc * (endheight-curheight)/Math.abs(endheight-curheight);
		//logWin.document.write('->   x:' + x + '   inc:' + step + '<br>')

	
	resheight = curheight+step;
	if ( (step>0 && resheight>=endheight) || (step<=0 && resheight<=endheight)  )
	{
		resheight = endheight;
		//window.status = window.status.slice(0,4) + '->end   step:' + step + '   res:' + resheight + '  end:' + endheight + '';
		//logWin.document.write('->end   step:' + step + '   res:' + resheight + '  end:' + endheight + '<br>')
	
	}
	
	obj.style.height = resheight ;

//window.status = "" + objid + "->" + (resheight) + ", " + endheight + "  inc=" + inc + ""	
	
	if (resheight-endheight!=0)
		setTimeout("MF_toHeight('" + objid + "')",5)
		//setTimeout("toWidth('" + objid + "'," + endheight + ")",50)
	
}



