// functions to highlight featured items.
var contentInterval = null;
var curContent = 0;
window.onload = function(){
	// show first featured content fContent1
	advanceContent();
	// now start interval.
	contentInterval = setInterval('advanceContent();',10000);
	// advance logos
	setInterval("advanceLogos();",5000);
	// set dt onmouseover, out & click functions
// Not functioning in ie7..  Need work around.
//	setAllProductLinks();
}
function advanceContent(){
// hides old, shows new content using curContent. 1 is default
// hide current
	if (curContent > 0){
		$("fContent"+curContent).fade();
	}
// advance curContent.
	var nextContent = curContent + 1;
	if ($("fContent"+nextContent)){
		curContent++;
	// show next content if exists otherwise reset curcontent
		$("fContent"+curContent).appear({ queue: 'end' });
	} else {
		curContent = 0;	
		advanceContent();
	}
// highlight correct content link	
	advanceContentLink();	
}
function advanceContentLink(){
	var contentAdvancer = $("contentAdvancer");
	var lis = contentAdvancer.getElementsByTagName("li");
	for (var i=0, il = lis.length;i < il;i++){
		var currentLi = lis[i];
		var currentLink = currentLi.childNodes[0];
	// add a 1 to i cuz we start with 1;
		if (i+1 == curContent)
			currentLink.className = "current";
		else
			currentLink.className = "";
	}
}
function displayContent(contentID){
// stop interval
	if (contentInterval != null){
		clearInterval(contentInterval);
		contentInterval = null;
	}
// hide current content;
	if (curContent > 0 && curContent != contentID){
		$("fContent"+curContent).fade();
	}
/// show content
	if (curContent != contentID){
		$("fContent"+contentID).appear({ queue: 'end' });
		curContent = contentID;
	}
// highlight correct link
	advanceContentLink();
}
function advanceLogos(){
	var logos2Scroll;
	if($("logos2Scroll").visible()){
		$("logos2Scroll").blindUp();
		$("logos2Scroll2").blindDown();
	} else if($("logos2Scroll2").visible()) {
		$("logos2Scroll2").blindUp();
		$("logos2Scroll3").blindDown();
	} else {
		$("logos2Scroll3").blindUp();
		$("logos2Scroll").blindDown();
	}
}
function setAllProductLinks(){
// add functions to definition list terms.
	var allProducts = $("allProducts");
	var apTerms = allProducts.getElementsByTagName("dt");
	
//need correct method for adding attributes in ie7.  I think it's in that new book I have.
	for (var i=0,il=apTerms.length;i<il;i++){
		var curTerm = apTerms[i];
	// add onmouseover
		curTerm.setAttribute("onmouseover","highlightBtn(this,'on');");
	// add onmouseout
		curTerm.setAttribute("onmouseout","highlightBtn(this,'off');");
	// add onclick
		curTerm.setAttribute("onclick","location.href='products.asp';");
	}
}
function highlightBtn(btn,onOff){
	var clsName = "";
	if (onOff == "on")
		clsName = "highlight";

	btn.className = clsName;
}
