// JavaScript Document
var nxs_subnavigation = new Array();
var nxs_subnavigation_points = new Array();
var nxs_subnavprio = new Array();
var subnav_open_time = 0.5; //Seconds


function check_opened_nav_time(ident)
{
	if (nxs_subnavigation[ident][3] == 2)
	{ 
		nxs_subnavigation[ident][4] = nxs_subnavigation[ident][4] - 1;
		if (nxs_subnavigation[ident][4] <= 0)
		{
			divid = nxs_subnavigation[ident][2];
			document.getElementById(divid).style.visibility = 'hidden';
			document.getElementById(divid).style.top = '0px';
			document.getElementById(divid).style.left = '0px';
			nxs_subnavigation[ident][3] = 0;
		}
		else
			setTimeout('check_opened_nav_time(\''+ident+'\')', 100);
	}
}


function nxs_act_nav(ident)
{
	if (nxs_subnavigation[ident][3] == 2)
	{
		nxs_subnavigation[ident][3] = 1;
		nxs_subnavigation[ident][4] = subnav_open_time * 10;
	}
}

function nxs_disable_all_navs()
{
	for (ident in nxs_subnavigation) 
	{
		if (nxs_subnavigation[ident][3] > 0)
		{
			divid = nxs_subnavigation[ident][2];
			document.getElementById(divid).style.visibility = 'hidden';
			document.getElementById(divid).style.top = '0px';
			document.getElementById(divid).style.left = '0px';
			nxs_subnavigation[ident][3] = 0;			
		}	
	}
}

function nxs_show_nav(ident)
{		
	if (nxs_subnavigation[ident][3] == 0)
	{
		nxs_disable_all_navs();
		divid = nxs_subnavigation[ident][2];
		divpx = nxs_subnavigation[ident][0];
		divpy = nxs_subnavigation[ident][1];
		
		point_content = '';
		for (point in nxs_subnavigation_points[ident]) 
		{
			point_content = point_content + nxs_subnavigation_points[ident][point];
		}
		document.getElementById(divid).innerHTML = point_content;

		document.getElementById(divid).style.visibility = 'visible';
		document.getElementById(divid).style.top = divpy+'px';
		document.getElementById(divid).style.left = divpx+'px';
		nxs_subnavigation[ident][3] = 1;		
		nxs_subnavigation[ident][4] = subnav_open_time * 10;		
	}
}




function nxs_disable_nav(ident)
{
	if (nxs_subnavigation[ident][3] == 1)
	{
		nxs_subnavigation[ident][3] = 2;
		check_opened_nav_time(ident);
	}	
	/*
	if (nxs_subnavigation[ident][3] > 0)
	{
		divid = nxs_subnavigation[ident][2];
		document.getElementById(divid).style.visibility = 'hidden';
		document.getElementById(divid).style.top = '0px';
		document.getElementById(divid).style.left = '0px';
		nxs_subnavigation[ident][3] = 0;
	}
	*/
}


//Add a new subnavigation
//ident: The ident from navigation
//posx: The Div-Target X-Coordinate
//posy: The Div-Target Y-Coordinate
//tdivname: The used-target-div id
//tdivcssclass: The used-target-div CSS Class (Class musst have: position, left, top, visibility)
function initSubnavigation(ident, posx, posy, tdivname, tdivcssclass, addstyle)
{
	style_code = "";
	if (addstyle != "")
		style_code = ' style="'+addstyle+'"';
		
	div_code = '<div id="'+tdivname+'" class="'+tdivcssclass+'"'+style_code+' onmouseover="nxs_show_nav(\''+ident+'\')" onmousemove="nxs_act_nav(\''+ident+'\')" onmouseout="nxs_disable_nav(\''+ident+'\')"></div>';
	document.write(div_code);
	nxs_subnavigation[ident] = new Array(posx, posy, tdivname, 0, 0);
	nxs_subnavprio[ident] = 0;
	nxs_subnavigation_points[ident] = new Array();
}

//Add a new subnavigationpoint
//ident: The ident from navigation
//code: The code from the nav-point
function addSubnavigationPoint(ident, code)
{		
	a_prio = nxs_subnavprio[ident];	
	nxs_subnavigation_points[ident][a_prio] = code;
	a_prio = a_prio + 1;
	nxs_subnavprio[ident] = a_prio;
}