if(document.layers) {
	//alert("Niteo.com will render properly in Netscape 6.0 and above.");
}

var the_bases = new Array();
function doPreload() {
	//original the_newbases = new Array('home','aboutus','coresolutions','industrysolutions','clients','news','casestudies','careers','contactus');
	//the_newbases = new Array('home','aboutniteo','solutions','services','industries','clients','partners','newscollateral');
	the_newbases = new Array('home','aboutniteo','solutions','services','industries','clients','partners','casestudy','newscollateral');
	for(x=0;x<the_newbases.length;x++) {
		the_bases[the_bases.length] = the_newbases[x];
	}

	the_images = new Array();

	for(x=0;x<the_bases.length;x++) {
	 the_images[the_images.length] = "/img/menus/menu_1_"+the_bases[x]+"_off.gif";
	 the_images[the_images.length] = "/img/menus/menu_1_"+the_bases[x]+"_over.gif";
	 the_images[the_images.length] = "/img/menus/menu_1_"+the_bases[x]+"_on.gif";
	}

   preloadImages(the_images);
}

function preloadImages(the_images_array) {

   for(var loop = 0; loop < the_images_array.length; loop++)

   {
 	var an_image = new Image();
	an_image.src = the_images_array[loop];
   }
}


function openENPop(url,W,H) {
	newWin = window.open(url,"popWin","width="+(W+40)+",height="+(H+40)+",scrollbars=yes");
}


function openPop_WH(url,width,height) {
	newWin = window.open(url,"popWin","width="+width+",height="+height+",scrollbars=yes");
}
function openPop_Max(url) {
	newWin = window.open(url,"popWin","width=618,height=600,scrollbars=yes,resizable=yes");
}
function openPop(url) {
	newWin = window.open(url,"popWin","width=618,height=600,scrollbars=yes");
}
function openSmallPop(url) {
	newWin = window.open(url,"popWin","width=524,height=400,scrollbars=no");
}
function popCaseStudy(url) {
	newWin = window.open(url,"popWin","width=476,height=385,scrollbars=no");
}
function popCEGlobe(url) {
	newWin = window.open(url,"popWin","width=650,height=550,scrollbars=yes");
}
function popDownload(url) {
	newWin = window.open(url,"popWin","width=606,height=500,scrollbars=yes,resizable=yes,status=yes");
}
function popROIPrint(url) {
	newWin = window.open(url,"popWin","width=720,height=500,left=0,top=0,scrollbars=yes,resizable=yes,status=yes");
}


function examine(anObj) {
	for(i in anObj) {
		alert(i+": "+anObj[i]);
	}
}

beenHere = 0;
aPosY = 0;
scrollState=0;
tracker=0;
function startScroll(scrollDir) {
	scrollInterval = 30;
	scrollState = setInterval("moveSubPageContent('" + scrollDir + "')",scrollInterval);
}

function clearScroll(){
	clearInterval(scrollState);
}

function autoScrollSubPageContent(dir,howlong) {
	moveSubPageContent(dir,howlong);
}

function resetScroller() {
	//don't reset if user hasn't scrolled layer yet
	if(beenHere) {
			dir = 'up';
			howMuch=Math.abs(tracker);
			moveSubPageContent(dir,howMuch);
	}
}

function moveSubPageContent(dir,inc){
	if(!inc) {
		inc=10;
	}
	anObj = document.getElementById('subpageContent');
	if(!beenHere) {
		beenHere=1;
		anObj.style.top = anObj.style.top-1;
		anObj.style.top = parseInt(anObj.style.top)+1;
		//original anObj.style.clip ="rect(0px, 315px, 280px, 0px)";
		anObj.style.clip ="rect(0px, 315px, 280px, 0px)";
		//anObj.style.clip ="rect(0px, 315px, 304px, 0px)";
		aPosY = parseInt(eval("anObj.style.top"));
	}

	if(dir=='dn'){
		//alert(aPosY); //aahhh the style.top is a string! -1px!!
		anInc = -inc;
		clipv = anObj.style.clip.split("rect(")[1].split(")")[0].split("px");
		clipTop = parseInt(clipv[0]);
		clipBottom = parseInt(clipv[2]);
		//clipBottom = parseInt(clipv[2]) + 24;
		clipHeight = clipBottom-clipTop;
		if(Math.abs(anObj.offsetTop)+clipHeight>=anObj.offsetHeight) {
			return false;
		}
	} else{
		anInc = inc;
		//alert(anObj.offsetTop+anInc);
		//alert(anObj.offsetTop)
		if(anObj.offsetTop>=0) {
			return false;
		}
	}
	//alert(anObj.style.clip);
	aPosY = aPosY+anInc;
	tracker = tracker+anInc;
	anObj.style.top = parseInt(aPosY);
	clipv = anObj.style.clip.split("rect(")[1].split(")")[0].split("px");
	//alert(clipv);
	clipTop = parseInt(clipv[0])-anInc;
	clipRight = parseInt(clipv[1]);
	clipBottom = parseInt(clipv[2])-anInc;
	clipLeft = parseInt(clipv[3]);
	theClipTxt = "rect("+clipTop+"px, "+clipRight+"px, "+clipBottom+"px, "+clipLeft+"px)";
	document.getElementById('subpageContent').style.clip = theClipTxt;
	//alert(anObj.style.clip);
}

tempSrc="";
function simpleRoll(whichImg,whatSrc) {
	if(!whatSrc) {
		whichImg.src = tempSrc;
	} else {
		tempSrc = whichImg.src;
		whichImg.src = "/img/"+whatSrc+".gif";
	}
}

tempSrc="";
function roll(s_imgID,state) {
//	srcOfImg = document.getElementById(s_imgID).src;
//	alert(document.getElementById(s_imgname).src);
	if(state=="over") {
		tempSrc = document.images[s_imgID].src;
		s_imgname_roll = "/img/menus/"+s_imgID+"_"+state+".gif";
	} else if (state=="off") {
		s_imgname_roll = tempSrc;
	} else {
		s_imgname_roll = "/img/menus/"+s_imgID+"_"+state+".gif";
	}
	document.images[s_imgID].src = s_imgname_roll;
}

function rollContentArrow(s_imgName,imgBase,state) {
	if(state=="over") {
		tempSrc = document.images[s_imgName].src;
		s_imgname_roll = "/img/"+imgBase+"_"+state+".gif";
	} else if (state=="off") {
		s_imgname_roll = tempSrc;
	} else {
		s_imgname_roll = "/img/"+imgBase+"_"+state+".gif";
	}
	document.images[s_imgName].src = s_imgname_roll;
}

function writeMenuLine(whichMenu,whichHref) {
	mainString = "menu_1_"+mainPage;
	string2Write="";

	if(mainPage == "index" && whichMenu == "menu_1_home") {
		string2Write = "<img id=\""+whichMenu+"\" src=\"/img/menus/"+whichMenu+"_on.gif\" width=\"169\" height=\"12\" alt=\"\" border=\"0\">";
		return string2Write;
	}

	if (whichMenu!=mainString) {
		string2Write = "<a href=\""+whichHref+"\" onmouseover=\"roll('"+whichMenu+"','over');\" onmouseout=\"roll('"+whichMenu+"','off');\" onmousedown=\"roll('"+whichMenu+"','on');\"><img id=\""+whichMenu+"\" src=\"/img/menus/"+whichMenu+"_off.gif\" width=\"169\" height=\"12\" alt=\"\" border=\"0\"></a>";
	} else {
		string2Write = "<img id=\""+whichMenu+"\" src=\"/img/menus/"+whichMenu+"_off.gif\" width=\"169\" height=\"12\" alt=\"\" border=\"0\">";
	}
	return string2Write;
}

function writeSubMenuLine(whichMenu,whichHref) {
	subpgString = "menu_1_"+subPage;
	string2Write="";
	if (whichMenu!=subpgString) {
		if( (whichMenu == "menu_1_cscpmabi") || (whichMenu == "menu_1_cssoaaws") || (whichMenu == "menu_1_lgpcep") || (whichMenu == "menu_1_lrdhpc")) {
		    string2Write = "<a href=\""+whichHref+"\" onmouseover=\"roll('"+whichMenu+"','over');\" onmouseout=\"roll('"+whichMenu+"','off');\" onmousedown=\"roll('"+whichMenu+"','on');\"><img id=\""+whichMenu+"\" src=\"/img/menus/"+whichMenu+"_off.gif\" width=\"218\" height=\"22\" alt=\"\" border=\"0\"></a>";
		}
		else {
		    string2Write = "<a href=\""+whichHref+"\" onmouseover=\"roll('"+whichMenu+"','over');\" onmouseout=\"roll('"+whichMenu+"','off');\" onmousedown=\"roll('"+whichMenu+"','on');\"><img id=\""+whichMenu+"\" src=\"/img/menus/"+whichMenu+"_off.gif\" width=\"218\" height=\"12\" alt=\"\" border=\"0\"></a>";
		}
	} else {
		if( (whichMenu == "menu_1_cscpmabi") || (whichMenu == "menu_1_cssoaaws") || (whichMenu == "menu_1_lgpcep") || (whichMenu == "menu_1_lrdhpc")) {
		    string2Write = "<img id=\""+whichMenu+"\" src=\"/img/menus/"+whichMenu+"_off.gif\" width=\"218\" height=\"22\" alt=\"\" border=\"0\">";
		}
		else {
		    string2Write = "<img id=\""+whichMenu+"\" src=\"/img/menus/"+whichMenu+"_off.gif\" width=\"218\" height=\"12\" alt=\"\" border=\"0\">";
		}
	}
	return string2Write;
}

function finalizeSubPage() {
	//alert("clean up time");
	doPreload();
	if(mainPage=="privacypolicy" || mainPage=="index"){
		return true;
	}

	//-- hide scrollbars when not necessary
	anObj = document.getElementById('subpageContent');
	// mainPage = "index";
	if(anObj.offsetHeight<280 || (mainPage == "index")) {
		document.getElementById('scrollUp1').style.visibility='hidden';
		document.getElementById('scrollDown1').style.visibility='hidden';
		document.getElementById('scrollUp2').style.visibility='hidden';
		document.getElementById('scrollDown2').style.visibility='hidden';
	} else {
		document.getElementById('scrollUp1').style.visibility='visible';
		document.getElementById('scrollDown1').style.visibility='visible';
		document.getElementById('scrollUp2').style.visibility='visible';
		document.getElementById('scrollDown2').style.visibility='visible';
	}


	// original mainPageArray = ["aboutus","industrysolutions","coresolutions","clients","news","casestudies","careers","contactus"];
	// mainPageArray = ["aboutniteo","solutions","services","industries","clients","partners","newscollateral"];
	// prev mainPageArray = ["aboutniteo","solutions","services","industries","clients","partners","newscollateral"];
	mainPageArray = ["aboutniteo","solutions","services","industries","clients","partners","casestudy","newscollateral"];
	// Previous aboutniteoArray = ["niteooverview","necconnection","leadershipteam","collateralcenter","inthenews","contactus"];
	aboutniteoArray = ["aboutus","thenecconnection","leadershipteam","contactus"];
	qualityfocusArray = [];
	solutionsArray = ["overview","csep","cscpmabi","cscm","csimasso","cssoaaws","cssc"];
	servicesArray = ["overview","sevaroadmap","seucdesign","seddad","sesa","seoffshore"];
	industriesArray = ["overview","financialservices","manuhitech","hlthcarepharma","teleutil","retail","highereducation"];
	//clientsArray = ["clientsclients","casestudies"];
	clientsArray = [];
	partnersArray = [];
	//collateralArray = ["inthenews","ccenter"];
	collateralArray = ["inthenews","ccenter"];
	//newscollateralArray = ["news","collateral"];
	newscollateralArray = ["news","collater"];
	newsArray = [];
//	casestudiesArray = ["overview","lincolncenter","fxall","americanheartassociation","sun","federalreservebankofboston"];
//	casestudiesArray = ["overview","lincolncenter","fxall","americanheartassociation","sun"];
//	casestudiesArray = ["overview","lincolncenter","trendmicro","fxall","sun","cdc","isitc"];
	//casestudiesArray = ["overview","t25rb","fdc","apw","cdc","fxall","isitc","lincolncenter","smbc","sun","trendmicro","gopr","gmmf","lcb","lmlic"];
	//casestudiesArray = ["overview","t25rb","fdc","apw","cdc","fxall","isitc","lincolncenter","smbc","sun","trendmicro","gopr","gmmf","lcb","lmlic"];

	casestudyArray = ["overview","apw","cdc","fdc","fxall","isitc","lincolncenter","smbc","sun","t25rb","trendmicro","gopr","gmmf","lcb","lmlic","lgpc","lgpcep","lrdhpc"];

	careersArray = ["overview","viewcurrentjobpostings"];
	contactusArray = [];

	mainPageCheck:
	for(x=0;x<mainPageArray.length;x++) {
		if(mainPage==mainPageArray[x]) {

			//sideID=mainPageArray[x]+"Side";
			//document.getElementById(sideID).style.backgroundColor = "#F0F1F3";
			imgID = "menu_1_"+mainPageArray[x];
			document.images[imgID].src = "/img/menus/"+imgID+"_on.gif";
			break mainPageCheck;
		}
	}
	theMainPgSubPgArrayString = mainPageArray[x]+"Array";

	theMainPgSubPgArray = eval(theMainPgSubPgArrayString);
	subPageCheck:
	for(x=0;x<theMainPgSubPgArray.length;x++){
		if(subPage==theMainPgSubPgArray[x]) {

			if( (subPage=="overview") || (subPage=="aboutus") || (subPage=="clientsclients") || (subPage=="news") ) {
				overviewColor = "#FFFFFF";
				overviewColor2 = "#FFFFFF";
			} else {
				overviewColor = "#F0F1F3";
				overviewColor2 = "#E2E4E7";
			}

			document.getElementById("overviewTop1").style.backgroundColor=overviewColor;
			document.getElementById("overviewTop2").style.backgroundColor=overviewColor;
			document.getElementById("overviewTop3").style.backgroundColor=overviewColor2;
			document.getElementById("overviewSide2").style.backgroundColor=overviewColor;

			sideID = theMainPgSubPgArray[x]+"Side";
			imgID = "menu_1_"+theMainPgSubPgArray[x];
			document.images[imgID].src = "/img/menus/"+imgID+"_on.gif";
			document.getElementById(sideID).style.backgroundColor = "#FFFFFF";
//			break subPageCheck;
		} else {
			sideID = theMainPgSubPgArray[x]+"Side";
			imgID = "menu_1_"+theMainPgSubPgArray[x];
			document.images[imgID].src = "/img/menus/"+imgID+"_off.gif";
			document.getElementById(sideID).style.backgroundColor = "#E2E4E7";
		}
	}
}

function loadHTML2Sub(cntBaseName) {
	resetScroller();
	cntVar = eval(cntBaseName+"HTML");
	document.getElementById("subpageContent").innerHTML=cntVar;
	oldsubPage = subPage;
	subPage = cntBaseName;
	imgClickedString = writeSubMenuLine("menu_1_"+cntBaseName,"");
	if(oldsubPage!="overview") {
		linkTo = "javascript:loadHTML2Sub('"+oldsubPage+"');";
	} else {
		linkTo = "/"+mainPage+".html";
	}
	imgOldString = writeSubMenuLine("menu_1_"+oldsubPage,linkTo);
	document.getElementById(cntBaseName+"Cell").innerHTML = imgClickedString;
	document.getElementById(oldsubPage+"Cell").innerHTML = imgOldString;
	finalizeSubPage();
}