﻿var arrLabel = new Array();
var arrLink = new Array();

function addSubMenu (index){
	arrLabel[index] = new Array();
	arrLink[index] = new Array();
}

function addSubMenuItem (index, label, url) {
	 arrLabel[index][arrLabel[index].length] = label;
	 arrLink[index][arrLink[index].length] = url;
}

//creating the drop down div for respective main navs
function makeRolloverMenu(){
	var strDiv = "";
	var strTable = "";	
	
	for (var i=0 ; i<arrLabel.length ; i++)	{
		strDiv += " <div id='SubMenu_" + i + "' class=\"nav_subMenu\" onmouseover=\"showSubMenu(" + i + ");\" onmouseout=\"hideSubMenu(" + i + ");\"> <table border=0 cellpadding=0 cellspacing=0><tr><td class=>";
		strTable = "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td><div class=\"nav_subMenuBg\">";
		
	  	for(var j=0 ; j<arrLabel[i].length; j++) {
			strTable += "<div id='SubMenu_"+ i + "_" + j + "' class='nav_subMenuItem' onClick='setLink("+i+","+j+")'; onMouseOver='rollOver(this);' onMouseOut='rollOut(this);' >" + arrLabel[i][j] + "</div>";
		}
		
		strTable += "</td></tr></table>";
		strDiv += strTable +" </td></tr></table></div>";
	}
	document.write(strDiv);
}

function setLink(i, j) {
	window.location = arrLink[i][j];
}

function rollOver(obj) {
	//alert(obj);
	obj.className = 'nav_subMenuItemHover';
}

function rollOut(obj) {
	obj.className = 'nav_subMenuItem';
}


//showing the drop down menu + changing the rollover effect for main nav image
function showSubMenu(index) {
	var topDistance = 102;
	var menuItemWidth = 130;
	var containerWidth = 780;
	var oSM1 = document.getElementById("SubMenu_" + index);
	var iLeftOffset = ((document.body.offsetWidth - containerWidth) / 2);
	var leftDistance = index * menuItemWidth + iLeftOffset;
	
	oSM1.style.top = topDistance + 'px';
	oSM1.style.left = leftDistance + 'px';
	//alert(leftDistance);
	oSM1.style.visibility = 'visible';
	
	var oMM1 = document.getElementById("nav_" + index);
	var imgFileName = oMM1.src;
	oMM1.src = imgFileName.replace(/_off/,"_over");
}

//hiding the dropdown menus + resetting the main nav image
function hideSubMenu(index) {
	var oSM1 = document.getElementById("SubMenu_" + index);
	oSM1.style.visibility = 'hidden';
	
	var oMM1 = document.getElementById("nav_" + index);
	var imgFileName = oMM1.src;
	oMM1.src = imgFileName.replace(/_over/,"_off");
}

//Creating the Global Nav Menu Here-----------------------------------------------------
addSubMenu(0);
addSubMenuItem(0, "Brand Equity & Health", "http://www.knowledgenetworks.com/issues/branding.html");
addSubMenuItem(0, "Market Definition & Targeting", "http://www.knowledgenetworks.com/issues/market.html");
addSubMenuItem(0, "New Product Development & Evaluation", "http://www.knowledgenetworks.com/issues/product.html");
addSubMenuItem(0, "Marketing ROI", "http://www.knowledgenetworks.com/issues/roi.html");
addSubMenuItem(0, "Brand Identity & Advertising Assessment", "http://www.knowledgenetworks.com/issues/brand-id.html");
addSubMenuItem(0, "Digital Ad Campaign Evaluation", "http://www.knowledgenetworks.com/issues/digital-ad.html");
addSubMenuItem(0, "Consumer Trends & Choices", "http://www.knowledgenetworks.com/issues/consumer.html");
addSubMenuItem(0, "Tactical Marketing", "http://www.knowledgenetworks.com/issues/tmp.html");

addSubMenu(1);
addSubMenuItem(1, "Consumer Packaged Goods & Retail", "http://www.knowledgenetworks.com/industries/cpg.html");
addSubMenuItem(1, "Pharmaceuticals & Healthcare", "http://www.knowledgenetworks.com/industries/pharma.html");
addSubMenuItem(1, "Government & Academic Research", "http://www.knowledgenetworks.com/ganp/index.html");
addSubMenuItem(1, "Media", "http://www.knowledgenetworks.com/industries/media.html");
addSubMenuItem(1, "Financial Services", "http://www.knowledgenetworks.com/industries/financial.html");

addSubMenu(2);
addSubMenuItem(2, "Choice Modeling", "http://www.knowledgenetworks.com/approaches/choice.html");
addSubMenuItem(2, "Market Segmentation", "http://www.knowledgenetworks.com/approaches/segmentation.html");
addSubMenuItem(2, "Market Forecasting", "http://www.knowledgenetworks.com/approaches/forecasting.html");
addSubMenuItem(2, "Long-Term Value Analysis", "http://www.knowledgenetworks.com/approaches/longterm.html");
addSubMenuItem(2, "Marketing Mix Modeling", "http://www.knowledgenetworks.com/approaches/mix.html");
addSubMenuItem(2, "Messaging & Claims Testing", "http://www.knowledgenetworks.com/approaches/messaging.html");
addSubMenuItem(2, "Integrated Online Quant-Qual Research", "http://www.knowledgenetworks.com/approaches/quant-qual.html");

addSubMenu(3);
addSubMenuItem(3, "KnowledgePanel&reg;", "http://www.knowledgenetworks.com/knpanel/index.html");
addSubMenuItem(3, "Service Bureau", "http://www.knowledgenetworks.com/sb/index.html");
addSubMenuItem(3, "KnowledgePanel Latino<font size=1><sup>SM</sup></font>", "http://www.knowledgenetworks.com/resources/kp-latino.html");
addSubMenuItem(3, "National Shopper Lab", "http://www.knowledgenetworks.com/resources/nsl.html");
addSubMenuItem(3, "MultiMedia Mentor&reg;", "http://www.knowledgenetworks.com/mmm/index.html");
addSubMenuItem(3, "Home Technology Monitor&trade;", "http://www.knowledgenetworks.com/htm/index.html");

addSubMenu(4);
addSubMenuItem(4, "Quality in Research", "http://www.knowledgenetworks.com/quality/index.html");
addSubMenuItem(4, "A:I/R Newsletter", "http://www.knowledgenetworks.com/accuracy/index.html");
addSubMenuItem(4, "Case Studies", "http://www.knowledgenetworks.com/insights/index.html#studies");
addSubMenuItem(4, "White Papers", "http://www.knowledgenetworks.com/insights/index.html#papers");
addSubMenuItem(4, "KNOW&trade; Magazine", "http://www.knowledgenetworks.com/know/index.html");

addSubMenu(5);
addSubMenuItem(5, "About Us", "http://www.knowledgenetworks.com/company/about.html");
addSubMenuItem(5, "Executive Team&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "http://www.knowledgenetworks.com/company/executives.html");
addSubMenuItem(5, "Directors", "http://www.knowledgenetworks.com/company/directors.html");
addSubMenuItem(5, "Investors", "http://www.knowledgenetworks.com/company/investors.html");
addSubMenuItem(5, "Contact Us", "http://www.knowledgenetworks.com/company/contact.html");
addSubMenuItem(5, "Careers", "http://www.knowledgenetworks.com/company/careers.html");
addSubMenuItem(5, "News", "http://www.knowledgenetworks.com/news/index.html");

makeRolloverMenu();