//drop down
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;
//go toselect 
function GoProd(s)
	{	var d = s.options[s.selectedIndex].value;
	self.location.href=d
	}
// -- PURPOSE: to collapse all elements
// -- Usage: collapseAll(list of items to collapse)

function collapseAll() {
	for (var i=0; i<collapseAll.arguments.length; i++) {
		var element = document.getElementById(collapseAll.arguments[i]);
		if (element) {
			element.style.display = "none";
		}
	}
}


// -- PURPOSE: to expand all elements
// -- Usage: expandAll(list of items to expand)

function expandAll() {
	for (var i=0; i<expandAll.arguments.length; i++) {
		var element = document.getElementById(expandAll.arguments[i]);
		if (element) {
			element.style.display = "block";
		}
	}
}

// -- PURPOSE: to expand collapsed elements or collapse expanded elements
// -- Usage: expandCollapse(list of items to expand/collapse)

function expandCollapse() {
	for (var i=0; i<expandCollapse.arguments.length; i++) {
		var element = document.getElementById(expandCollapse.arguments[i]);
		if (element) {
			element.style.display = (element.style.display == "none") ? "block" : "none";
		}
	}
}

// -- PURPOSE: to expand an item and collapse many others
// -- Usage: expandFirst(item to expand, list of items to collapse)

function expandFirst() {
	expandAll(expandFirst.arguments[0]);
	for (var i=1; i<expandFirst.arguments.length; i++) {
		collapseAll(expandFirst.arguments[i]);
	}
}

// -- PURPOSE: to change a group of elements to hidden
// -- Usage: hideAll(list of elements to hide);

function hideAll() {
	for (var i=0; i<hideAll.arguments.length; i++) {
		var element = document.getElementById(hideAll.arguments[i]);
		if (element) {
			element.style.visibility = "hidden";
		}
	}
}

// -- PURPOSE: to highlight the cells in a row where the checkbox is checked
// -- Usage: highlightChecked(form with checkboxes, class used when not highlighted, class used when highlighted)

function highlightChecked(myForm, normal, highlighted) {
	// myElement should be a checkbox element nested in a <td>, if it is checked, the row will be highlighted
	for (var i=0; i<myForm.elements.length; i++) {
		var myElement = myForm.elements[i];
		if (myElement.type == "checkbox" && myElement.parentNode.tagName == "TD" || myElement.parentNode.tagName == "td") {
			var kids = myElement.parentNode.parentNode.childNodes;
			for (var j=0; j<kids.length; j++){
				if (myElement.checked) {
					kids[j].className = highlighted;
				} else {
					kids[j].className = normal;
				}
			}
		}
	}
}


// -- PURPOSE: resets a style property from hyphenated form to uppercase form (background-color to backgroundColor).
// -- NOTE: This is an internal function used be setStyle and getStyle and shouldn't be used directly.  It is only used for IE

function resetStyleTag(styleTag) {
	// IE uses the backgroundColor form instead of background-color when using setAttribute on element.style, so we have to parse it.
	// don't call this in Netscape because you have to user element.setAttribute("style") instead and it uses the background-color form
	var searchString = new RegExp("-([a-z])", "g");
	if (searchString.test(styleTag)) {
		return styleTag.replace(searchString, RegExp.$1.toUpperCase());
	}
	return styleTag;
}

// -- PURPOSE: to set the style of a particular item (Cross-browser version)
// -- Usage: setStyle(element to be changed, style property to be set, value to set property to)
// -- NOTE: This is a function you'd most likely not call from HTML, but only from other JS functions

function setOrderByClass(orderByFull,ascClass,descClass) {
	var searchString = new RegExp("([+ ]|%20|%2520)+DESC", "i");
	var orderBy = orderByFull.replace(searchString,"");
	var orderByElement = document.getElementById("order_by_"+orderBy);
	if (orderByElement) {
		if (orderBy != orderByFull) {
			orderByElement.className = descClass;
		} else {
			orderByElement.className = ascClass;
		}
	}
}
	
function setStyle(myElement, styleTag, styleValue) {
	// IE uses element.style.setAttribute and element.style.getAttribute
	if (currentElement.style.setAttribute && currentElement.style.removeAttribute) {
		styleTag = resetStyleTag(styleTag);
		if (styleValue) {
			currentElement.style.setAttribute(styleTag, styleValue);
		}
		else {
			currentElement.style.removeAttribute(styleTag, 0);
		}
	}
	// Netscape uses element.setAttribute("style") and element.getAttribute("style")
	else if (currentElement.setAttribute && currentElement.getAttribute) {
		var tempStyle = " " + currentElement.getAttribute("style");
		var searchString = new RegExp(" " + styleTag + "[^\;\"]+.", "i");
		if (searchString.test(tempStyle)) {
			var replaceString = (styleValue) ? styleTag + ": " + styleValue + "; " : "";
			tempStyle = tempStyle.replace(searchString, replaceString);
		}
		else {
			tempStyle = styleTag + ": " + styleValue + ";" + tempStyle;
		}
		currentElement.setAttribute("style", tempStyle, 0);
	}
}

// -- PURPOSE: to change a group of elements to visible
// -- Usage: showAll(list of elements to show);

function showAll() {
	for (var i=0; i<showAll.arguments.length; i++) {
		var element = document.getElementById(showAll.arguments[i]);
		if (element) {
			element.style.visibility = "visible";
		}
	}
}

// -- PURPOSE: to make an element visible and a list of elements invisible.
// -- Usage: showFirst(element to make visible, list of elements to hide)

function showFirst() {
	showAll(showFirst.arguments[0]);
	for (var i=1; i<showFirst.arguments.length; i++) {
		hideAll(showFirst.arguments[i]);
	}
}

// -- PURPOSE: to change a group of elements from visible to hidden or vice versa
// -- Usage: showHide(list of elements to show/hide);

function showHide() {
	for (var i=0; i<showHide.arguments.length; i++) {
		var element = document.getElementById(showHide.arguments[i]);
		if (element) {
			element.style.visibility = (element.style.visibility == "hidden") ? "visible" : "hidden";
		}
	}
}


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=500,left = 12,top = -116');");
}


