// menu
function menu_show(id)
{
	if (!id) return;
	if (this.elem) hideNow();

	elem = document.getElementById("menu-" + id);
	if (!elem) return;

	var elem = document.getElementById("menu-billet-" + id);
	if (elem) elem.style.display = "block";
	else return;

	elem = document.getElementById("menu-black-line-" + id);
//	if (elem) elem.style.display = "block";
	if (elem) elem.style.visibility = "visible";
	else return;

	elem = document.getElementById("menu-yellow-line-" + id);
//	if (elem) elem.style.display = "block";
	if (elem) elem.style.visibility = "visible";
	else return;

	menu_over(id);
}

function menu_hide(id)
{
	var elem = document.getElementById("menu-billet-" + id);
	if (elem) elem.style.display = "none";

	elem = document.getElementById("menu-black-line-" + id);
//	if (elem) elem.style.display = "none";
	if (elem) elem.style.visibility = "hidden";

	elem = document.getElementById("menu-yellow-line-" + id);
//	if (elem) elem.style.display = "none";
	if (elem) elem.style.visibility = "hidden";

	elem = document.getElementById("menu-" + id);
	if (elem) elem.style.display = "none";
}

function menu_over(id)
{
	var open;
	var docwidth, docheight;

	if(!id) return;
	
	if(this.menu_timer){
		clearTimeout(this.menu_timer);
		this.menu_timer=0;
	}
	
	if(this.dom) open = document.getElementById("menu-"+id);
	else 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.scrollWidth || document.body.scrollHeight){ 
		docwidth = document.body.scrollWidth; 
		docheight = document.body.scrollHeight; 
	} 	
	var k = (docwidth-190)/g_num;
	open.left = 70 + k*(id-1) + (k-250)/2;
	
	open.display = "block";

	this.elem = open;
}

function menu_out()
{
	if (this.elem) this.menu_timer = setTimeout('hideNow()',this.hide_delay);
}

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=0,scrollbars=0,menubar=0,toolbar=0,status=0');
}

// 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");
}

// photogallery
function photogallery_show_img(id)
{
	var _el = parent.document.getElementById("photogallery-big-img");
	_el.src = "/img/photogallery/thumb2/"+id;

	var _el = parent.document.getElementById("photogallery-big-img-link");
	_el.href = "javascript:show_window('/photogallery/?img_one=" + id + "',10,10)";
}