function displayMenus(idMenu) {
	var e = document.getElementById("tabsH");
	if (e)
	{
		var elements = e.getElementsByTagName("A");
		for (var i = 0; i<elements.length; i++)	{
			if (elements[i].id=="menu_"+idMenu)
			{
				elements[i].className="active";
			}
			else
			{
				elements[i].className="";
			}
		}

		
		var o=document.getElementById('submenu');
		if (o)
		{
			var elements = o.getElementsByTagName("UL");
			for (var i = 0; i<elements.length; i++)	{
				elements[i].style.display="none";
			}
			if (idMenu)
			{
				if (document.getElementById("submenu_"+idMenu))
				{
					document.getElementById("submenu_"+idMenu).style.display="block";
				}
			}
			else document.getElementById("submenu_0").style.display = "block";
		}
	}
}

function abreCierra(miDiv)
{
	try
	{
		if (document.getElementById(miDiv).style.display=='none')
		{
			document.getElementById(miDiv).style.display='block';
		}
		else
		{
			document.getElementById(miDiv).style.display='none';
		}	
	}
	catch (e){ alert(e);}
}

function writeEmbed(cls, cb, mt, p) {
	var h = '', n;

	h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
	h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
	h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
	h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
	h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
	h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
	h += '>';

	for (n in p)
		h += '<param name="' + n + '" value="' + p[n] + '">';

	h += '<embed type="' + mt + '"';

	for (n in p)
		h += n + '="' + p[n] + '" ';

	h += '></embed></object>';

	document.write(h);
}

function writeFlash(p) {
	writeEmbed(
		'D27CDB6E-AE6D-11cf-96B8-444553540000',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'application/x-shockwave-flash',
		p
	);
}

function writeShockWave(p) {
	writeEmbed(
	'166B1BCA-3F9C-11CF-8075-444553540000',
	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
	'application/x-director',
		p
	);
}

function writeQuickTime(p) {
	writeEmbed(
		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
		'video/quicktime',
		p
	);
}

function writeRealMedia(p) {
	writeEmbed(
		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'audio/x-pn-realaudio-plugin',
		p
	);
}

function writeWindowsMedia(p) {
	p.url = p.src;
	writeEmbed(
		'6BF52A52-394A-11D3-B153-00C04F79FAA6',
		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
		'application/x-mplayer2',
		p
	);
}

function desplazarPaginador(idObj, direccion, desplazamiento)
{
	var obj = document.getElementById(idObj);
	var objMargin = (obj.style.marginLeft == '' ? 0 : parseInt(obj.style.marginLeft));
	var anchoPadre = parseInt(obj.parentNode.clientWidth);
	var maxDesplazamiento;
	if((obj.clientWidth < anchoPadre))
		return false;
	if(direccion == -1)
		maxDesplazamiento = obj.clientWidth + objMargin - anchoPadre;
	else if(direccion == 1)
		maxDesplazamiento = Math.abs(objMargin);
	else if(direccion == 0)
	{
		var seleccionada = document.getElementById('pag_seleccionada');
		var aux = seleccionada.offsetLeft + (seleccionada.clientWidth / 2);
		aux = aux - (anchoPadre / 2);
		if(aux < 0)
			return false;
		else
			aux = (aux < (obj.clientWidth - anchoPadre) ? aux : (obj.clientWidth - anchoPadre));
		obj.style.marginLeft = (-aux) + 'px';
		return true;
	}
	else
		return false;
	if(maxDesplazamiento > anchoPadre)
		maxDesplazamiento = anchoPadre;
	if(!desplazamiento || desplazamiento > maxDesplazamiento)
		desplazamiento = maxDesplazamiento;
	var paso = Math.floor(anchoPadre / 20);
	if(paso > desplazamiento)
		paso = desplazamiento;
	obj.style.marginLeft = ((obj.style.marginLeft == '' ? 0 : parseInt(obj.style.marginLeft)) + (paso * direccion)) + 'px';
	desplazamiento -= paso;
	if(desplazamiento > 0)
		window.setTimeout("desplazarPaginador('" + idObj + "', " + direccion + ", " + desplazamiento + ")", 10);
	return true;
}
