// menu
function menu_show(id)
{
	if (!id) return;
	if (this.elem) hideNow();

	menu_over(id);
}

function menu_hide(id)
{
	this.elem.display = "none";
	this.elem = null;
}

function findPos(obj)
{
	var curleft = curtop = 0;

	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return curleft;
}

function menu_over(id)
{
	var open;
	var docwidth, docheight;

	if(!id) return;

	if(this.menu_timer){
		clearTimeout(this.menu_timer);
		this.menu_timer=0;
	}

	open = document.getElementById("menu-" + id);

	if(!open) {
		if(this.ie4) open = document.all["menu-"+id];
		else if(this.nn4) open = document.layers["menu-"+id];
	}

	if(!open)return;
	if(!this.nn4)open = open.style;

	if(this.elem && open!=this.elem)hideNow();
	this.id = id;

	//opera Netscape 6 Netscape 4x Mozilla 
	if (window.innerWidth || window.innerHeight){ 
		docwidth = window.innerWidth; 
		docheight = window.innerHeight; 
	} 
	//IE Mozilla 
	if (document.body.clientWidth || document.body.clientHeight){ 
		docwidth = document.body.clientWidth; 
		docheight = document.body.clientHeight; 
	} 	

	var menu_item = document.getElementById('menu_item_left_' + id);

	var item_left = findPos(menu_item);

	open.left = item_left;	
	open.display = "block";

	this.elem = open;
}

function menu_out()
{
	if (this.elem) this.menu_timer = setTimeout('hideNow()',500);
}

function hideNow()
{
	if (this.elem) menu_hide(this.id);
	this.elem = 0;
	this.id = 0;
}
// end menu

function input_enter(id,f,text)
{
	var _elem = document.getElementById(id);
	if (!_elem) return;

	if (f && _elem.value == text) {
		_elem.value = "";
		_elem.style.color = "black";
	}
	if (!f && _elem.value.length == 0) {
		_elem.value = text;
		_elem.style.color = "#a29c8e";
	}
}

function show_window(href, width, height)
{
	window.open(href, '', 'width='+(width+15)+',height='+(height+20)+',resizable=no');
}

// Init funciton
function init()
{
	var agt=navigator.userAgent.toLowerCase();

	this.dom = (document.getElementById)?(true):(false);
	this.nn4 = document.layers;

    this.major = parseInt(navigator.appVersion);
    this.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    this.ie3    = (this.ie && (this.major < 4));
    this.ie4    = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) );
	this.iemac  = (this.ie && (agt.indexOf("mac")!=-1));

	this.hide_delay = 500;
}

// partners functions
function partners_over(id)
{
	eval("document.getElementById('partners_img_"+ id +"').src = image_"+ id +".src");
}

function partners_out(id)
{
	eval("document.getElementById('partners_img_"+ id +"').src = image_bw_"+ id +".src");
}
