// JavaScript Document
var homePage = 'yes';

// BEGIN TOPNAV SCRIPT

// ********  creating dropdown nav  *****************

// Global Vars for nav

// initialize and give default values for dropdown menu color variables
var background = "#ffffff";
var bgcolor = "#7bc0f8";
var border_color = "#ffffff";
var menu_border = "#ffffff";
var hovercolor = "#7bc0f8";
var dividercolor = "#7bc0f8";
// these seem to do nothing

var submenu_x;
var submenu_y;



// Simple Browser Check
var ie = "Microsoft Internet Explorer";
var netscape = "Netscape";
var mac = "MacPPC"
var browser = navigator.appName;
var os = navigator.platform;

var No3 = (parseInt(navigator.appVersion) > 3) ? 1:0;

if (navigator.userAgent == 'Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC)') { 
	No3 = 0; 
}
var layer = (document.getElementById && No3) ? "document.getElementById('L'+menu).style" : (document.all) ? "document.all['L'+menu].style" : (document.layers && No3) ? "document.layers['L'+menu]": 0;
var hideMe = (document.all || document.getElementById) ? "hidden" : "hide";
var showMe = (document.all || document.getElementById) ? "visible" : "show";
var timer;
//if (document.layers && No3) {
//	document.write('<style>.navdown {color:#000000; font-size:11px; font-family:Arial,sans-serif; font-weight:normal; text-decoration:none; padding-bottom : 3;	padding-top : 3;}</style>');
//}
//////////////////////////////////////////////

// goto main.css to find the definitions for submenubar
Layer = new Array();
// MENU 1 IS ABOUT
Layer[1] = new LayerSpecs(submenu_x,submenu_y,180,'#d2e4f0','#d2e4f0','#d2e4f0'
, '<a href="http://www.sixsenseinc.com/about/mission.html" class="submenubar">&nbsp;&nbsp;Mission/Vision/Values</a>'
, '<a href="http://www.sixsenseinc.com/about/meet-our-team.html" class="submenubar">&nbsp;&nbsp;Meet Our Team</a>'
// , '<a href="http://www.sixsenseinc.com/about/our-story.html" class="submenubar">&nbsp;&nbsp;Our Story</a>'
, '<a href="http://www.sixsenseinc.com/about/seven-tenets.html" class="submenubar">&nbsp;&nbsp;7 Tenets</a>'
);
// MENU 2 IS PROGRAMS
Layer[2] = new LayerSpecs(submenu_x,submenu_y,250,'#d2e4f0','#d2e4f0','#d2e4f0'
, '<a href="http://www.sixsenseinc.com/programs/building-high-performance-teams.html" class="submenubar">&nbsp;&nbsp;Building High Performance Teams</a>'
, '<a href="http://www.sixsenseinc.com/programs/strategic-thinking.html" class="submenubar">&nbsp;&nbsp;Strategic Thinking Training</a>'
, '<a href="http://www.sixsenseinc.com/programs/strategic-planning.html" class="submenubar">&nbsp;&nbsp;Facilitated Strategic Planning</a>'
, '<a href="http://www.sixsenseinc.com/programs/for-marketers-n-agencies.html" class="submenubar">&nbsp;&nbsp;For Marketers and Agencies</a>'
, '<a href="http://www.sixsenseinc.com/programs/performance-coaching.html" class="submenubar">&nbsp;&nbsp;Performance Coaching</a>'
, '<a href="http://www.sixsenseinc.com/programs/keynotes.html" class="submenubar">&nbsp;&nbsp;Keynotes</a>'
);
// MENU 3 IS TEAM EVENTS
Layer[3] = new LayerSpecs(submenu_x,submenu_y,120,'#d2e4f0','#d2e4f0','#d2e4f0'
, '<a href="http://www.sixsenseinc.com/team-events/articles.html" class="submenubar">&nbsp;&nbsp;Articles</a>'
, '<a href="http://www.sixsenseinc.com/team-events/whitepapers.html" class="submenubar">&nbsp;&nbsp;Whitepapers</a>'
);
// MENU 4 IS NEWSLETTTERS
Layer[4] = new LayerSpecs(submenu_x,submenu_y,150,'#d2e4f0','#d2e4f0','#d2e4f0'
, '<a href="http://www.sixsenseinc.com/newsletters/meet-our-clients.html" class="submenubar">&nbsp;&nbsp;Meet Our Clients</a>'
, '<a href="http://www.sixsenseinc.com/newsletters/what-our-clients-say.html" class="submenubar">&nbsp;&nbsp;What Our Clients Say</a>'
);
// MENU 5 IS MEDIA
Layer[5] = new LayerSpecs(submenu_x,submenu_y,120,'#d2e4f0','#d2e4f0','#d2e4f0'
, '<a href="http://www.sixsenseinc.com/media/articles.html" class="submenubar">&nbsp;&nbsp;Articles</a>'
, '<a href="http://www.sixsenseinc.com/docs/TeamBuilding%20Whitepaper%20-%20Final%202.pdf" class="submenubar">&nbsp;&nbsp;White papers</a>'
//, '<a href="http://www.sixsenseinc.com/media/performance-coaching.html" class="submenubar">&nbsp;&nbsp;Performance Coaching</a>'
//, '<a href="http://www.sixsenseinc.com/media/strategic-thinking.html" class="submenubar">&nbsp;&nbsp;Strategic Thinking</a>'
//, '<a href="http://www.sixsenseinc.com/media/key-notes.html" class="submenubar">&nbsp;&nbsp;Key Notes</a>'
);
// MENU 6 IS OUR CLIENTS
Layer[6] = new LayerSpecs(submenu_x,submenu_y,170,'#d2e4f0','#d2e4f0','#d2e4f0'
, '<a href="http://www.sixsenseinc.com/" class="submenubar">&nbsp;&nbsp;TBD</a>'
, '<a href="http://www.sixsenseinc.com/" class="submenubar">&nbsp;&nbsp;TBD</a>'
, '<a href="http://www.sixsenseinc.com/" class="submenubar">&nbsp;&nbsp;TBD</a>'
, '<a href="http://www.sixsenseinc.com/" class="submenubar">&nbsp;&nbsp;TBD</a>'
);


/////////////////////////////////////////////////////////

// Loop to create master nav table(ie/nn6) or layer(nn4.x)
// bgcolor in the table sets the colour of the borders around each submenu box
for(i=1; i<Layer.length; i++) {

	if (document.getElementById && No3) { 
		document.write('<div onMouseOver="clearTimeout(timer)" onMouseOut=";Hide('+i+')" ID="L'+i+'" STYLE="position:absolute; visibility:hidden; background:'+background+'; top:'+Layer[i].top+'; left:'+Layer[i].left+';"><table border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">'+Layer[i].info+'</TABLE></div>'); 
	} else if (document.all && No3) {
		document.write('<SPAN onMouseOver="clearTimeout(timer);" onMouseOut="Hide('+i+')" ID="L'+i+'" STYLE="position:absolute; visibility:hidden; background:'+background+'; top:'+Layer[i].top+'; left:'+Layer[i].left+';"><table border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">'+Layer[i].info+'</TABLE></SPAN>'); 
	} else if (document.layers && No3) {
		document.write('<LAYER  onMouseOver="clearTimeout(timer);" onMouseOut="Hide('+i+');" ID="L'+i+'" VISIBILITY="hide" position="absolute" BGCOLOR="#ffffff"">'+Layer[i].info+'</LAYER>'); 
		//document.write('<LAYER onMouseOver="clearTimeout(timer);showOver(\''+imgHilite+'\');" onMouseOut="Hide('+i+');showOff(\''+imgHilite+'\');" ID="L'+i+'" VISIBILITY="hide" position="absolute" BGCOLOR="#ffffff" TOP="'+Layer[i].top+'" LEFT="'+Layer[i].left+'">'+Layer[i].info+'</LAYER>'); 
	}
}


// sets the number of pixels down or to the right of the main menu item
function Show(menuNumber, submenu_id) {
	if(document.layers){
  		submenu_y += 34;  
		submenu_x += -89; 
		
	}
	else
	{
 		submenu_y += 33;  
		submenu_x += -86; 
		
	}
	

	
	if (document.layers)
	{
	
		submenu_id.left = submenu_x;
		submenu_id.top = submenu_y;

	}
	else
	{
		if(menuNumber != 0)
		{
		document.getElementById('L' + menuNumber).style.top = submenu_y + 'px';
		document.getElementById('L' + menuNumber).style.left = submenu_x + 'px';
		}
	}

	
	if(timer) { 
		clearTimeout(timer); 
	}

	for(menu=0; menu < Layer.length; menu++) {
		if(Layer[menu]) {
			eval(layer).visibility = hideMe; 
		} 
	}
	if (menuNumber > 0){
		var menu = menuNumber;
		eval(layer).visibility = showMe;
	}
	
}

function Hide(menuNumber) { timer = setTimeout("Show(0, document.L1)", 200); }


function LayerSpecs(Left,Top,Width,bgcolor,hovercolor,dividercolor) { 
	if(No3) {
		if (document.getElementById && document.all) {
			if (homePage=="yes") {
				this.left = Left;
				this.top = parseInt(Top) - 0;;
			} else {
				this.left = parseInt(Left) + 10;
				this.top = parseInt(Top) - 7;
			}
		} else if (document.getElementById && navigator.userAgent.indexOf('Gecko')) {
			if (homePage=="yes") {
				this.left = Left;
				this.top = parseInt(Top) - 0;
			} else {
				this.left = parseInt(Left) + 10;
				this.top = parseInt(Top) - 7;
			}
		} else if (document.all) {
			if (homePage=="yes") {
				this.left = Left;
				this.top = parseInt(Top) - 0;
			} else {
				this.left = parseInt(Left) + 10;
				this.top = parseInt(Top) - 7;
			}
		} else if (document.layers) { 
			// Width = Width + 10;
			if (homePage=="yes") {
				this.left = Left;
				this.top = parseInt(Top) - 0;
			} else {
				this.left = parseInt(Left) + 10;
				this.top = parseInt(Top) - 7;
			}
		}

		this.info  = "";

// initialize layer position for NN4.x
		var T = 0;

// Loop to populate master nav table/layer with content
		for(i=6; i<arguments.length; i++) {

			// check for 2 lines of content within layer and offset accordingly
			if( arguments[i].indexOf('<br>&nbsp;') != -1 ){
				var addOffset = 13;
			} else {
				var addOffset = 0;
			}

// calculates table cell height for NN6 & IE
			var cellheight = 30;
			
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CELL BACKGROUND COLOUR CAN BE CHANGED HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
			if (document.all){ 
				this.info += '<tr><TD valign="middle" WIDTH="'+Width+'" height="'+cellheight+'" bgcolor="#7bc0f8" class="submenubar"><span style="line-height:103%;"><img src="images/spacer.gif" align="left" alt="" width="1" height="15" vspace="0" hspace="0"  border="0">'+arguments[i]+'</span></TD></tr>'; 
			} else if (document.getElementById){ 
				this.info += '<tr><TD valign="middle" WIDTH="'+Width+'" height="'+cellheight+'" bgcolor="#7bc0f8" class="submenubar"><img src="images/spacer.gif" align="left" alt="" width="1" height="15" vspace="0" hspace="0"  border="0">'+arguments[i]+'</TD></tr>'; 
			} else if (document.layers){ 
				this.info += '<LAYER position="absolute" bgcolor="'+bgcolor+'" WIDTH="'+Width+'" TOP="'+T+'" class="submenubar">'+arguments[i]+'</LAYER><br>'; 
			}

// increment layer position for NN4.x
			T += 13 + addOffset;
		}
	} 
}

function getOffsetLeft (el) {
  var ol = el.offsetLeft;
  while ((el = el.offsetParent) != null)
    ol += el.offsetLeft;
  return ol;
}
function getOffsetTop (el) {
  var ot = el.offsetTop;
  while((el = el.offsetParent) != null)
   ot += el.offsetTop;
  return ot;
}

	
function getCoordinates (menu, menu_id) {
	if(document.layers){
  		submenu_x = menu_id.pageX;
		submenu_y =  menu_id.pageY
	}
	else
	{
 		submenu_x = getOffsetLeft(menu);
		submenu_y = getOffsetTop(menu);
	}	
	
}
// END TOPNAV SCRIPT