function getObjectById(id, style) {
    var o;
	
    if (is.DOM)      o = document.getElementById(id);
	else if (is.ns)  o = document.layers[id];
    else if (is.ie)  o = document.all[id];
   
	if (o && style) {
		if (is.DOM)
			o = o.style;
		else
			o = eval(doc + '["' + id + '"]' + sty);
	}
	if (o) o.id = id;

    return o;
}

function hidelayer(o) {
	if (typeof(o) == "string") 
		o = getObjectById(o, true);
	if (o && o.id != UNHIDE_SEC) o.visibility = "hidden";
}

function showlayer(id) {
	o = getObjectById(id, true);
	if (o) o.visibility = "visible";
}

function mouseInLastMenu() {
	if (o_LAST && o_LAST.id) {
		//if (mouseonid == o_LAST.id) return;
		
		if (!mouseInObject(o_LAST.id)) {
			if (UNHIDE_SEC) {
				hidemenu(o_LAST.id);
				showunhidemenu();
			} else
				hidemenu(o_LAST.id);
		}
	}
}

function hidemenu(id) {
	o = getObjectById(id, true);
	if (o && id != UNHIDE_SEC) {
		o.visibility = "hidden";
		o.top  = -500;
		o.left = -500;
	}
}

var mouseonid = null;
var MENU_LEFT_OFFSET    = 5;
var MENU_LIMIT_POSITION = true;
var o_LAST              = null;
var UNHIDE_SEC          = null;

function mouseInObject(id) {
	o  = getObjectById(id);
	inY = false;
	inX = false;
	
	if (yMousePos >= (o.offsetTop - 12) && yMousePos <= ((o.offsetTop - 12) + (o.offsetHeight + 12)))
		inY = true;
	if (xMousePos >= o.offsetLeft && xMousePos <= (o.offsetLeft + o.offsetWidth))
		inX = true;
			
	//window.status = "object[" + id + "](" + o.offsetTop + ", " + o.offsetLeft + ", " + o.offsetWidth+ ", " + o.offsetHeight + ")";
	//window.status = window.status + " xMousePos=" + xMousePos + ", yMousePos=" + yMousePos;
	//window.status = window.status + " inX=" + inX + ", inY=" + inY;
	
	return (inX && inY)
}

function showmenu(id, m) {
	o  = getObjectById(id, true);
	oo = getObjectById(id);
	t  = getObjectById("menu");
	ts = getObjectById("menu", true);

	ts.position = "relative";
	//if (o_LAST != null && o_LAST.id != UNHIDE_SEC) o_LAST.visibility = "hidden";
	if (o_LAST != null) o_LAST.visibility = "hidden";
	o_LAST = o;
	
	if (o && t) {
		if (id != UNHIDE_SEC) o.visibility = "hidden";

		if (m) {
			x_left = (m.offsetLeft + t.offsetLeft) - MENU_LEFT_OFFSET;

			if (MENU_LIMIT_POSITION) {
				limit = (parseInt(t.offsetLeft) + parseInt(t.width)) - 
						(x_left + oo.offsetWidth);
				if (limit < 0) x_left = parseInt(x_left) - Math.abs(limit);
			}
			
			o.left = x_left;
			o.top  = m.offsetTop + m.offsetHeight + t.offsetTop;
		}

		o.visibility = "visible";
	}
	if (is.ie) ts.position = "static";
	
	//if (o_LAST && o_LAST.id) menuonid = o_LAST.id;
}

function posmenus() {
	if (UNHIDE_SEC) hidemenu(UNHIDE_SEC);
	menus = ['about', 'comunity', 'business', 'jobs', 'contact', 'faq'];
	for (i=0; i < menus.length; i++) {
		menu_o = getObjectById('m_' + menus[i]);
		showmenu(menus[i], menu_o, true);
	}
	showunhidemenu();
}

function showunhidemenu() {
	if (UNHIDE_SEC) {
		menu_o = getObjectById('m_' + UNHIDE_SEC);
		showmenu(UNHIDE_SEC, menu_o);
	}
}

function close_flashintro() {  
o = getObjectById("flashintro", true);  
if (o) setTimeout("o.visibility = 'hidden'", 200); 
}  