var isNS = (navigator.appName == "Netscape");


/* handles primary navigation highlights */
function B_nav(navDiv, flag, topBorder)
{
	if(!isNS)
	{
	tbDiv = document.getElementById(topBorder);
	
	if (flag) // turn highlight on
	{
		navDiv.style.backgroundColor = "#ff6600";
		prevBottomBorderStyle = navDiv.style.borderBottomStyle;
		if(topBorder)
		{
			prevTopBorderStyle = tbDiv.style.borderBottomStyle;
			tbDiv.style.borderBottomStyle = "solid";
		}
		navDiv.style.borderBottomStyle = "solid";
		navDiv.getElementsByTagName('a')[0].style.color = "#000000";
	}
	else // turn highlight off
	{
		navDiv.style.backgroundColor = "transparent";
		if(topBorder)
		{
			tbDiv.style.borderBottomStyle = prevTopBorderStyle;
		}
		navDiv.style.borderBottomStyle = prevBottomBorderStyle
		navDiv.getElementsByTagName('a')[0].style.color = "#ffffff";
	}
	}
	else
	{
		if(flag)
		{
			navDiv.style.backgroundColor = "#ff6600";
			navDiv.getElementsByTagName('a')[0].style.color = "#000000";
		}
		else
		{
			navDiv.style.backgroundColor = "transparent";
			navDiv.getElementsByTagName('a')[0].style.color = "#ffffff";
		}
	}
}
	
/* handles styling the news teasers on mouseovers */
function B_news(newsDiv, flag)
{
	if(flag) // turn highlight on
	{
		newsDiv.getElementsByTagName('a')[0].style.color = "#ffffff";
		newsDiv.getElementsByTagName('span')[0].style.color = "#ff6600";		
	}
	else // turn highlight off
	{
		newsDiv.getElementsByTagName('a')[0].style.color = "#cdcda4";
		newsDiv.getElementsByTagName('span')[0].style.color = "#ffffff";		
	}
}
	
function gotoloc(url) { // changes the pages location
	if(url != "" & url != null)	window.location.href = url;
	else window.status = "navigation not currently working";
}

function B_sr(srDiv, flag)
{
	if(flag) // turn highlight on
	{
		srDiv.style.backgroundColor = "#eeeeee";
		srDiv.getElementsByTagName('a')[0].style.textDecorationUnderline = true;
		srI = srDiv.getElementsByTagName('img')[0];
				
		if(srI)
		{
			srI.style.borderWidth = "1px";
			srI.style.borderColor = "#ffffff";
			//srI.style.marginRight = "13px";
		}
	}
	else // turn highlight off
	{
		srDiv.style.backgroundColor = "#ffffff";
		srDiv.getElementsByTagName('a')[0].style.textDecorationUnderline = false;
		srI = srDiv.getElementsByTagName('img')[0];
				
		if(srI)
		{
			srI.style.borderWidth = "1px";
			srI.style.borderColor = "#000000";
			//srI.style.marginRight = "15px";
		}
	}
}

function B_chkLogin(formID) {
	f = document.getElementById(formID);
	if(f)
	{
		if(f.uname.value != "" & f.pword.value != "") return true;
	}
	return false;
}

function B_chkSiteSearch(sfld) { // checks for sitesearch value
	f = document.getElementById(sfld);
	if(f.value != "" & f.value != "Search Brice")
	{
			searchLoc = "default.asp?id=15&searchAction=search&Search=Search&keyword=" + f.value;
			window.location.href =  searchLoc;
	}
}


function B_chkProjectSearch(formid) { // checks for values in each of the forms fields
	f = document.getElementById(formid);
	if(f.i.value == 0 & f.s.value == 0)
	{
		this.location = "projectmain.asp?id=21";
		//alert("cannot perform a search without criteria");
		return(false);
	}
	else
	{
		return(true);
	}
	
}

/* project image / case study image change script */
function B_detailImg(linkA,imgSrc,imgName,imgDesc)
{
	p = linkA.parentElement;
	aArray = p.getElementsByTagName('a');
	
	for(i=0;i<aArray.length;i++)
	{
		aArray[i].style.color = "#6666ff";
		aArray[i].style.cursor = "pointer";
	}
	
	linkA.style.color = "#000000";
	linkA.style.cursor = "default";
	
	i = document.getElementById('detailImage');
	if(i) i.src = imgSrc;
	if(i) i.alt = imgDesc;
	
	d = document.getElementById('imgDesc');
	if(d) d.innerHTML = imgName;
}