/*
	File        : common.js
	Description : This library contain general-purpose Jabascript funtions used throughout entire website.
	              This library is linked in common navigation (nav.asp) and will be automatically included
	              everywhere common navigation is used.

*/

// These variable are used by _blink() function 
var colors   = Array("#686868","#FF0000");
var speed    = 1000;
var myObject = document.getElementById('blink');
var timerID  = setInterval("_blink(myObject)",speed);

function _blink( obj ) {
	if( ! obj ) {
		clearInterval(timerID);	// stop timer if target object is invalid and quit
		return;
	}
	obj.style.color = colors[0]; // apply whatever color is specified in index [0]
	colors.push(colors.shift()); // now, move that first array element to the end of the line
}

function JumpToIt_old( select_obj ) {
	if(!select_obj) return;                                               // quit if pulldown menu specified in parameter select_obj does not exist.
	if( select_obj.selectedIndex == -1 ) return;                          // quit if selectedIndex = -1 (which is nothing selected)
	if( select_obj.options[select_obj.selectedIndex].value == '') return; // quit if selected option has no value (such as "--- IN PRODUCTION ---")
	// otherwise ...
	location.href = "/products/" + select_obj.name + "/" + select_obj.options[select_obj.selectedIndex].value;
	return true;
}

function JumpToIt( select_obj ){	// can't use until all dropdowns are converted to specify full path
	var newPage = select_obj.options[select_obj.selectedIndex].value;
	if( newPage!="" && newPage!="None")	location.href=newPage;
}


// function used for secondary navigation
function changeClass(elemId, newClass) {
	var elem = null;
	if( document.getElementById ) {
		elem = document.getElementById(elemId);
	} else if ( document.all ) {
		elem = document.all[elemId];
	}
	if(elem) elem.className = newClass;
}
