

//// NAVIGATION ////
//// Browser Detect ////
var browser = navigator.appName;
var isIE = document.getElementById ? true : false;
////

//// SCREEN DIMENSIONS ////
var screenW = screen.width;
var screenH = screen.height;
////

//// NAVIGATION DIMENSIONS ////
var nav_width = 791;
var nav_height = 24;
////

var w_reload = true;

window.onresize = function () 
{
	if (w_reload)
	{	
		setTimeout('window.location.reload(true);', 2000);
		w_reload = false;
	}
}



function alertSize() {

 var myWidth = 0;
 var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
  screenW = myWidth;
  screenH = myHeight;
}



function main_nav()
{
	alertSize();
	
	var start_left = Math.round( (screenW/2) - (nav_width/2) * 1);
	var left_pos = 10;
	var top_pos = 134;
	var node;
	if (isIE) 
	{
		window.document.getElementById('NAV').style.width = nav_width + 'px';
		window.document.getElementById('NAV').style.height = nav_height + 'px';
		window.document.getElementById('NAV').className = 'bg-grey';
		node =  window.document.getElementById('NAV');
	} else
	{
		document.location.href = '../upgrade.html';
	}
	
	for (var i=0;i<nav_array.length;i++)
	{
		var my_div = document.createElement('div');
		my_div.setAttribute('id', 'NAV_' + i);
		my_div.style.position 	= 'absolute';
		my_div.style.left		= Math.round( start_left + left_pos * 1 ) + 'px';
		my_div.style.top		= top_pos + 'px';
		my_div.style.width		= nav_array[i][1] + 'px';
		my_div.style.height		= nav_height + 'px';
		my_div.style.visibility = 'visible';
		my_div.style.cursor		= 'pointer';
		my_div.className		= 'nav-off';
		my_div.innerHTML 		= '<div style="width:'+ nav_array[i][1] +'px; height:'+ nav_height +'px;" onmouseover="sub_nav_on('+ i +')"  onmouseout="sub_nav_off('+ i +')" >' + nav_array[i][0]; +'</div>';
		
			
		if (nav_array[i][2]) 
		{
			var my_div_sub = document.createElement('div');
			my_div_sub.setAttribute('id', 'NAV_SUB_' + i);
			my_div_sub.style.position 	= 'absolute';
			my_div_sub.style.left		= 0;
			my_div_sub.style.top		= nav_height + 'px';
			my_div_sub.style.width		= nav_array[i][1] + 'px';
			my_div_sub.style.height		= nav_height + 'px';
			my_div_sub.style.display	= 'none';
			my_div_sub.style.cursor		= 'pointer';
			my_div_sub.className		= 'nav-sub';
			
			var html = '<table border="0" cellspacing="0" cellpadding="0" onmouseover="sub_nav_on('+ i +')" onmouseout="sub_nav_off('+ i +')" >';
			html += '<tr>';
			html += '<td class="sub-nav-drop-VL"><img src="images/common/spacer.gif" width="5" height="5"/></td>';
			html += '<td>';
			
				html += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="nav-sub-table brd-light">';
			for (var ii=0;ii<nav_array[i][2].length;ii++)
			{
				var href = '../' + nav_array[i][0];
				href = href.replace(/ /g, '-');
				href = href.replace(/'/g, '');
				href = href.toLowerCase() + '/?id=' + ii;
				html += '<tr>';
				html +=	'<td class="brd-b padding" nowrap="nowrap">';
				html +=	'<a href="' + href + '" title="' + nav_array[i][2][ii] + '" class="nav-sub">' + nav_array[i][2][ii] + '</a>';
				html +=	'</td>';			
				html +=	'</tr>';
			}
				html +=	'</table>';			
			
			html +=	'</td>';
			html += '<td class="sub-nav-drop-VR"><img src="../images/common/spacer.gif" width="5" height="5"/></td>';
			html +=	'</tr>';
			
			html +=	'<tr>';
			html += '<td class="sub-nav-drop-LB"><img src="../images/common/spacer.gif" width="5" height="5"/></td>';
			html += '<td class="sub-nav-drop-HB"><img src="../images/common/spacer.gif" width="5" height="5"/></td>';
			html += '<td class="sub-nav-drop-RB"><img src="../images/common/spacer.gif" width="5" height="5"/></td>';
			html +=	'</tr>';
			html +=	'</table>';
			my_div_sub.innerHTML 		=  html;
							
			node.appendChild(my_div);	
			my_div.appendChild(my_div_sub);			
		} else
		{
			var href = nav_array[i][0].toLowerCase();
			href = href.replace(" ", "-");
			my_div.innerHTML = '<a href="../' + href + '" class="nav-off">' + nav_array[i][0] + '</a>';
			//my_div.innerHTML = '<a href="?" class="nav-off">' + nav_array[i][0] + '</a>';
			node.appendChild(my_div);	
		}
		left_pos = Math.round( left_pos + nav_array[i][1] + 10 * 1);
	}
}



function sub_nav_on(ID)
{
	if ( window.document.getElementById('NAV_SUB_' + ID) )
	{
		window.document.getElementById('NAV_SUB_' + ID).style.display = 'block';
	}
}
	

function sub_nav_off(ID)
{
	if ( window.document.getElementById('NAV_SUB_' + ID) )
	{
		window.document.getElementById('NAV_SUB_' + ID).style.display = 'none';
	}
}

