// Handle menu function
function handleMenuJump(selectObj)
{
	destination = selectObj.options[selectObj.selectedIndex].value;
	if(destination != '') {
		location.href=destination;
	} else {
		selectObj.selectedIndex = 0;
	}
}

// Set all checkboxes function
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}

// Used in new/edit order screen
function toggleCategory(buttonObj, category)
{
	buttonObj.blur();
	// Get all table rows
	elements = document.getElementsByTagName('tr');
	countElements = elements.length;

	for(var i = 0; i < countElements; i++)
	{
		el = elements[i];
		// If 'category' attribute is defined and it 
		// matches the selected category, toggle the display of the row
		if(el.attributes.category && el.attributes.category.value == category)
		{
			if ( el.style.display != "none" ) {
				el.style.display = 'none';
			}
			else {
				el.style.display = '';
			}
		}
	}
	if(buttonObj.value == '+') {
		buttonObj.value = '–';
	} else {
		buttonObj.value = '+';
	}
}

// Initialize highslide for instructions
hs.graphicsDir = '/wholesale/js/highslide/graphics/';
hs.outlineType = 'rounded-white';
hs.expandCursor = 'null';
hs.restoreCursor = 'null';
hs.dimmingOpacity = 0.15;
hs.showCredits = false;
hs.allowMultipleInstances = false;
hs.width = 605;
hs.align = 'center';
hs.preserveContent = true;
