// 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 = "#0F238C";
var border_color = "#ffffff";
var menu_border = "#ffffff";
var hovercolor = "#ff0202";
var dividercolor = "#ffffff";
// 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();
// TAB 1 IS ABOUT INNERACT
Layer[1] = new LayerSpecs(submenu_x,submenu_y,160,'#7e5b9f','#7e5b9f','#7e5b9f'
, '<a href="index.php?page=our-philosophy" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Our Philosophy</a>'
, '<a href="index.php?page=our-commitment" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Our Commitment</a>'
, '<a href="index.php?page=who-we-are" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Who We Are</a>'
, '<a href="index.php?page=our-story" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Our Story</a>'
, '<a href="index.php?page=our-community" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Our Community</a>'
);
// TAB 2 IS THE CONFIDENCE BLUEPRINT
Layer[2] = new LayerSpecs(submenu_x,submenu_y,220,'#d2e4f0','#d2e4f0','#d2e4f0'
, '<a href="index.php?page=the_confidence_blueprint#my-confidence-quotient" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;My Confidence Quotient</a>'
, '<a href="index.php?page=the_confidence_blueprint#is-it-for-you" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Is it for you?</a>'
, '<a href="index.php?page=the_confidence_blueprint#team-confidence-gage" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Team Confidence Gage</a>'
, '<a href="index.php?page=the_confidence_blueprint#cultivating-team-confidence" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Cultivating Team Confidence</a>'
);
// TAB 3 IS LEARNING SOLUTIONS
Layer[3] = new LayerSpecs(submenu_x,submenu_y,200,'#d2e4f0','#d2e4f0','#d2e4f0'
, '<a href="index.php?page=leadership" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Leadership</a>'
, '<a href="index.php?page=teams" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Teams</a>'
, '<a href="index.php?page=communication" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Communication</a>'
, '<a href="index.php?page=business" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Business</a>'
, '<a href="index.php?page=personal" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Personal Effectiveness</a>'
, '<a href="index.php?page=self-assessment-toolkit" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Self Assessment</a>'
, '<a href="index.php?page=celiac" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Celiac Coaching</a>'
, '<a href="index.php?page=coaching-bundles" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Coaching Bundles</a>'
, '<a href="index.php?page=keynote-topics" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Keynote Topics</a>'
);
// TAB 4 IS OUR FANS
Layer[4] = new LayerSpecs(submenu_x,submenu_y,200,'#d2e4f0','#d2e4f0','#d2e4f0'
// , '<a href="http://www.inneract.ca/our_fans/educational.html" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Educational</a>'
// , '<a href="http://www.inneract.ca/our_fans/professional.html" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Professional</a>'
// , '<a href="http://www.inneract.ca/our_fans/industry.html" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Industry</a>'
// , '<a href="http://www.inneract.ca/our_fans/entrepreneur.html" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Entrepreneur</a>'
);
// TAB 5 IS EXPLORATION CENTRE
Layer[5] = new LayerSpecs(submenu_x,submenu_y,200,'#d2e4f0','#d2e4f0','#d2e4f0'
, '<a href="index.php?page=article-archive" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Article Archive</a>'
, '<a href="index.php?page=the-book-shelf" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;The Book Shelf</a>'
, '<a href="index.php?page=valued-affiliates" class="submenubar"><img src="images/submenu-right.gif" align="right" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract"><img src="images/submenu-left.gif" align="absmiddle" border="0" hspace="0" vspace="0" height="20" width="12" alt="inneract">&nbsp;Valued Affiliates</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="2" bgcolor="#ffffff">'+Layer[i].info+'</TABLE></div>');  // place this into table tag for bgcolor:   bgcolor="#ffffff"
	} 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="2" bgcolor="#ffffff">'+Layer[i].info+'</TABLE></SPAN>');  // place this into table tag for bgcolor:   bgcolor="#ffffff"
	} 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 += 15;  
		submenu_x += 0; 
		
	}
	else
	{
 		submenu_y += 16;  
		submenu_x += 0; 
		
	}
	

	
	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 = 20;
			
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CELL BACKGROUND COLOUR CAN BE CHANGED HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
			if (document.all){ 
				this.info += '<tr><TD valign="middle" WIDTH="'+Width+'" height="'+cellheight+'" bgcolor="#0F238C" class="submenubar"><span style="line-height:103%;">'+arguments[i]+'</span></TD></tr>'; 
			} else if (document.getElementById){ 
				this.info += '<tr><TD valign="middle" WIDTH="'+Width+'" height="'+cellheight+'" bgcolor="#0F238C" class="submenubar">'+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