	function changeObjectClass(obj, new_style) {
		obj.className = new_style;
	}

	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}
	
	function sf_popup(anchor,name) {
		
		MM_openBrWindow(anchor.href,name,'toolbar=no,location=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=690,height=550');
		return false;
	}
	
	if(typeof Array.prototype.push != "function"){
		Array.prototype.push = ArrayPush;
		function ArrayPush(value){
			this[this.length] = value;
		}
	}
		
	function getElementsByClassName(oElm, strTagName, oClassNames){
		var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
		var arrReturnElements = new Array();
		var arrRegExpClassNames = new Array();
		if(typeof oClassNames == "object"){
			for(var i=0; i<oClassNames.length; i++){
				arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
			}
		}
		else{
			arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
		}
		var oElement;
		var bMatchesAll;
		for(var j=0; j<arrElements.length; j++){
			oElement = arrElements[j];
			bMatchesAll = true;
			for(var k=0; k<arrRegExpClassNames.length; k++){
				if(!arrRegExpClassNames[k].test(oElement.className)){
					bMatchesAll = false;
					break;                      
				}
			}
			if(bMatchesAll){
				arrReturnElements.push(oElement);
			}
		}
		return (arrReturnElements)
	}
	
	function hideOverlay() {
		document.getElementById("overlayad").style.display = "none";
	}
	
	function expandDiv(idstr) {
		style = document.getElementById(idstr).style;
		
		if (style.display != 'none') {
			style.display = 'none';
		}
		else {
			style.display = 'block';
		}
	}

    function textCounter(name, field, countfield, maxlimit) {
        
      if (field.value.length > maxlimit ) {
        field.value = field.value.substring(0, maxlimit);
        alert(name + ' can only be ' + maxlimit + ' characters in length.');
        countfield.innerHTML = (maxlimit - field.value.length) + ' remaining';
        return false;
      }
      else {
        countfield.innerHTML = maxlimit - field.value.length + ' remaining';
      }
    }

	function f_checkother(select) {
		// select with other
		
		var input = document.getElementById(select.id + '_other');
		var o = false;
		
		for (var i = 0; i < select.options.length; i++) {
			if (select.options[i].selected == true && select.options[i].value == 'other') {
				o = true;
			}
		}
 		
		if (o == true) {
			input.disabled = false;
			input.style.backgroundColor = '#FFF';
		}
		else {
			input.disabled = true;
			input.style.backgroundColor = '#EEE';
		}
	}

	function f_enableinput(inputid,checkbox) {
		var f = checkbox.form;
		var input = document.getElementById(inputid);
		
		if (!checkbox.checked) {
			// input.value = "";
			input.style.backgroundColor = "#EEEEEE";
		}
		else {
			input.style.backgroundColor = "#FFFFFF";
		}
		
		input.disabled = !checkbox.checked;
	}

	function f_enableselect(select,targetid) {

		var input = document.getElementById(targetid);
		
		if (select.options[select.selectedIndex].value > 0) {
			// input.value = "";
			input.style.backgroundColor = "#FFFFFF";
			input.disabled = false;
		}
		else {
			input.style.backgroundColor = "#EEEEEE";
			input.disabled = true;
		}
		
	}
	
	function f_disableinput(inputid,checkbox) {
		var f = checkbox.form;
		var input = document.getElementById(inputid);
		
		if (checkbox.checked) {
			// input.value = "";
			input.style.backgroundColor = "#EEEEEE";
		}
		else {
			input.style.backgroundColor = "#FFFFFF";
		}
		
		input.disabled = checkbox.checked;
	}
