// 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 = "#000000";
var bgcolor = "#000000";
var border_color = "#000000";
var menu_border = "#000000";
var hovercolor = "#000000";
var dividercolor = "#000000";


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>');
//}
//////////////////////////////////////////////

Layer = new Array();
Layer[1] = new LayerSpecs(submenu_x,submenu_y,250,'#000000','#000000','#000000'
, '<a href="casestudy1.html" class="submenubar" >&nbsp;- Improving Productivity & Efficiency</a>'
, '<a href="casestudy2.html" class="submenubar" >&nbsp;- Profitable Growth</a>'
, '<a href="casestudy3.html" class="submenubar" >&nbsp;- Optimizing ERP Opportunities</a>'
);
Layer[2] = new LayerSpecs(submenu_x,submenu_y,375,'#000000','#000000','#000000'
, '<a href="sbadiagnostic_5.html" class="submenubar" >&nbsp;- Culture-Strategy Fit Profile&#8482 and Check-Up&#8482;</a>'
, '<a href="sbadiagnostic_8.html" class="submenubar" >&nbsp;- The Strategic Alignment Survey&#8482;</a>'
, '<a href="sbadiagnostic_snapshot_demo.html" class="submenubar" >&nbsp;- Culture Snapshot&#8482;</a>'
, '<a href="sbadiagnostic_1.html" class="submenubar" >&nbsp;- The Organizational MRI&#8482;</a>'
, '<a href="sbadiagnostic_6.html" class="submenubar" >&nbsp;- Accelerating Culture Change - Months or years?</a>'
, '<a href="sbadiagnostic_4.html" class="submenubar" >&nbsp;- Preventing Value Drain - Identify Culture Synergies and Tensions In Mergers & Acquisitions</a>'
, '<a href="sbadiagnostic_7.html" class="submenubar" >&nbsp;- For Consultants - Grow Your Business with the Culture-Strategy Fit Profile</a>'
);
/////////////////////////////////////////////////////////

// Loop to create master nav table(ie/nn6) or layer(nn4.x)
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="#990000">'+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="#990000">'+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="#990000"">'+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>'); 
	}
}


function Show(menuNumber, submenu_id) {
	if(document.layers){
  		submenu_y += 1;
		submenu_x += 142;
		
	}
	else
	{
 		submenu_y += 0;
		submenu_x += 142;	
		
	}
	

	
	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 = 15;

			if (document.all){ 
				this.info += '<tr><TD valign="middle" WIDTH="'+Width+'" height="'+cellheight+'" bgcolor="#EEEEEE" 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="#EEEEEE" 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