function toggleVisibility(elementName, showOrHide){
	if(showOrHide == "show") {
		document.getElementById(elementName).className = 'visible';
	} else {
		document.getElementById(elementName).className = 'hidden';
	}
}

function toggleActive(sections, show){
	var formElements = document.requestDetailsForm.elements;
	//updateProductService
	//if (sections instanceof Array) {
	if (sections instanceof Array) {
//		alert(sections+': value is Array!');
	} else {
		sections = new Array(sections);
//		alert(sections+': Not an array');
	}
	for (var s=0; s<sections.length; s++) {
		var section = sections[s];
		try{
			if (show == "on"){
				toggleVisibility(section, 'show');
			} else {
				toggleVisibility(section, 'hide');
			}
//		} catch(e){}
		}catch(e){}
//		} catch(e){alert(e.lineNumber)}
		for (var i=0; i<formElements.length; i++) {
			try{
				var isInSection = formElements[i].getAttribute("name").toLowerCase().indexOf(section.toLowerCase()) > -1;
				if (isInSection && show == "on"){
					formElements[i].setAttribute("required", "true");
				} else if (isInSection){
					formElements[i].setAttribute("required", "false");
				}
			} catch(e){}
		}
	}
}

function applyHighlighting(element, setHighlight){
	if (setHighlight){
		if (element.className.indexOf('highlight') == -1 && element.className){
				element.className = element.className + ' highlight';
		} else if (element.className.indexOf('highlight') == -1) {
			element.className = 'highlight';
		}
	} else{
		try{
			element.className = element.className.replace('highlight', '');
		} catch(e){}
	}
}