function leadMount()
{
	var label, url, lenX, subm, posX, img, evtA;
	var lenY = 37;

	document.write('<ul class="mainMenu">');
	for(i = 0; i < menu.length; i++)
	{
		label = menu[i][0];
		url = menu[i][1];
		lenX = menu[i][2];
		posX = menu[i][3] ? menu[i][3] : false;
		evtA = subs[i].length > 0 ? 'javascript:swapMenu(' + i + ');' : '';
		img = new Image(lenX, lenY);
		// Preload
		img.src = 'img/mnu.' + parseInt(i + 1) + '.on.gif';
		// Montagem
		document.write('<li><a href="' + url + '" onmouseover="' + evtA + '" onmouseout="' + evtA + '"><img src="img/mnu.' + parseInt(i + 1) + '.off.gif" width="' + lenX + '" height="' + lenY + '" alt="' + label + '" id="mnu' + i + '" /></a></li>');
	}
	document.write('</ul>');
}

function mountSubmenu()
{
	var label, url, offset, brdLen;
	var base = 0;
	var mnuLen = 210;
	for(i = 0; i < subs.length; i++)
	{
		offset = parseInt(base - 381);
		
		base = parseInt(base + menu[i][2]);
		brdLen = parseInt(mnuLen - menu[i][2]);
		// alert(base);
		if(subs[i].length > 0)
		{
			document.write('<div id="sub' + i + '" style="display:none; position:absolute; left:50%; top:150px; background:#FEFEFE; border-top:0px; border-bottom:0px; margin-left:' + offset + 'px; width:' + mnuLen + 'px;" class="subm" onmouseover="javascript:this.style.display = \'block\';document.getElementById(\'mnu' + i + '\').src = \'img/mnu.' + parseInt(i + 1) + '.on.gif\';void(0);" onmouseout="javascript:this.style.display = \'none\';document.getElementById(\'mnu' + i + '\').src = \'img/mnu.' + parseInt(i + 1) + '.off.gif\';void(0);">');
			document.write('<div style="background:#FEFEFE; float:right; height:1px; width:' + brdLen + 'px;"><hr /></div>');
			document.write('<ul style="clear:both;">');
				// AQUI....
			for(j = 0; j < subs[i].length; j++)
			{
				label = subs[i][j][0];
				url = subs[i][j][1];
				document.write('<li><a href="' + url + '"><span>&gt;</span>' + label + '</a></li>');
			}
			document.write('</ul>');
			document.write('<div class="reset"><hr /></div>');
			document.write('</div>');
		}
	}
}

function swapMenu(id)
{
	var obj = document.getElementById('mnu' + id);
	var spl = obj.src.split('.');
	spl[parseInt(spl.length - 2)] = spl[parseInt(spl.length - 2)] != 'off' ? 'off' : 'on';
	obj.src = spl.join('.');
	swapSubmenu(id);
	void(0);
}

function swapSubmenu(id)
{
	var obj = document.getElementById('sub' + id);
	var mode;
	mode = obj.style.display != 'none' ? 'none' : 'block';
	obj.style.display = mode;
	//alert(mode);
	void(0);
}

function loadFlash(a, b, c)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + b + '" height="' + c + '" id="prices" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="' + a + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="bgcolor" value="#006699" />');
	document.write('<embed src="' + a + '" quality="high" wmode="transparent" bgcolor="#006699" width="' + b + '" height="' + c + '" name="prices" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function popup(a, b, c, d)
{
	var page = a;
	var lenX = b;
	var lenY = c;
	var scrl = d;
	var posX = parseInt((screen.width / 2) - (lenX / 2));
	var posY = parseInt((screen.height / 2) - (lenY / 2));
	var attr = 'width=' + lenX + ',height=' + lenY + ',top=' + posY + ',left=' + posX + ',scrollbars=' + scrl;
	window.open(page, 'popup', attr);
	void(0);
}