	function add_col(class_name) {
		//alert(document.getElementById('prod_ref').className);
		//document.getElementById('prod_ref').style.display="none";
		//alert(document.styleSheets[1].rules[1].selectorText);
		class_name_sh = "."+class_name+"_sh";
		id_name_a = class_name+"_a";
		for(var i = 0 ; (ss = document.styleSheets[i]) != undefined ; i++)
				for(var j = 0 ; (sr = ss.cssRules[j]) != undefined ; j++)
					if(sr.selectorText == class_name_sh) {
						sr.style.cssText="display: block";
						document.getElementById(id_name_a).style.display = 'none';
					}
						//sr.style.cssText = 'color: ' + newcolor;
	}

		
	function bg(ele, bgColour) {
		ele.style.backgroundColor = bgColour;	
	}
	

	function change_bg(item_id, bg_colour) {
		document.getElementById(item_id).style.backgroundColor=bg_colour;
	}
	

	function characters_remaining(textarea, maxlength, elem_notification, chars_left_colour, limit_reached_colour) {
		elem_notification.innerHTML = '(' + (maxlength - textarea.value.length) + ' characters left)';
		elem_notification.style.color = ((maxlength - textarea.value.length) < 1) ? limit_reached_colour : chars_left_colour;
	}
	
	
	function collapse_col(col_name) {
		var arr = new Array();
        arr = document.getElementsByName(col_name);
		
		document.getElementById(col_name).style.color = '#303030';
		document.getElementById('col_'+col_name).style.display = 'none';
		document.getElementById('exp_'+col_name).style.display = 'inline';
       
        for(var i = 0; i < arr.length; i++)
        {
            var obj = document.getElementsByName(col_name).item(i);
            obj.style.width = '25';
            obj.style.fontSize = '4px';
        }
		document.getElementById(col_name).style.fontSize = '8pt';
	}


	function expand_col(col_name, width) {
		var arr = new Array();
        arr = document.getElementsByName(col_name);
		
		document.getElementById(col_name).style.color = '#ffffff';
		document.getElementById('exp_'+col_name).style.display = 'none';
		document.getElementById('col_'+col_name).style.display = 'inline';
       
        for(var i = 0; i < arr.length; i++)
        {
            var obj = document.getElementsByName(col_name).item(i);
            obj.style.width = width + 'px';
            obj.style.fontSize = '10pt';
        }
		document.getElementById(col_name).style.fontSize = '8pt';
	}


	function input_switch(box, io, text) {
		
		if (io == 'input') {
			if ( box.value == text ) { box.value = ""; }
		} else {
			if ( box.value == "" ) { box.value = text; }
		}
	}


	function limit_prod_desc_entry(textarea, maxlength, elem_notification, chars_left_colour, limit_reached_colour) {		
		if (textarea.value.length > (maxlength-1)) {
			textarea.value = textarea.value.substring(0, (maxlength));
			characters_remaining(textarea, maxlength, elem_notification);
			return false;
		} else {
			return true;
		}
	}
	

	function menu(menu_id, display) {
		document.getElementById(menu_id).style.display = display;
	}

		
	function hideAllByTagName(tag, name_prefix) {
		
		var elems = document.getElementsByTagName(tag);
		var prefix_len = name_prefix.length;
		
		for (i=0; i < elems.length; i++) {
			if (elems[i].id.substr(0,prefix_len) == name_prefix) {
				document.getElementById(elems[i].id).style.display = 'none';
			}
		}
		
	}


	function highlight(square) {
		document.getElementById(square).style.visibility='visible';
	}


	function highlight_off(square) {
		document.getElementById(square).style.visibility='hidden';
	}
	
	
	function remove_col(class_name) {
		//alert(document.getElementById('prod_ref').className);
		//document.getElementById('prod_ref').style.display="none";
		//alert(document.styleSheets[1].rules[1].selectorText);
		class_name_sh = "."+class_name+"_sh";
		id_name_a = class_name+"_a";
		for(var i = 0 ; (ss = document.styleSheets[i]) != undefined ; i++)
				for(var j = 0 ; (sr = ss.cssRules[j]) != undefined ; j++)
					if(sr.selectorText == class_name_sh) {
						sr.style.cssText="display: none";
						document.getElementById(id_name_a).style.display = 'inline';
					}
						//sr.style.cssText = 'color: ' + newcolor;

	}
	
	
	function set_bg(eleID, bgColour) {
		document.getElementById(eleID).style.backgroundColor = bgColour;	
	}
	

	function set_expanded_indicator(doc_object, id_row) {

		for (i=0; i < doc_object.length; i++) {
			
			if (doc_object.elements[i].id.substr(0,14) == 'row_openstate_') {
				id_row_others = doc_object.elements[i].id.substr(14);
				document.getElementById('row_expand_'+id_row_others).src = '/_images/buttons/expand_minus.png';
			}
		}
					
		document.getElementById('row_expand_' + id_row).src = '/_images/buttons/expand_plus.png';
	}


	function show_frame(frame, op) {
		if (op) {
			document.getElementById(frame).style.display = op;
		} else {
			document.getElementById(frame).style.display = (document.getElementById(frame).style.display == 'block') ? 'none' : 'block';
		}
	}


	function showHide(eleID) { 
	   elem = document.getElementById(eleID);    
	   if (elem.className=="eleShown") {elem.className="eleHidden";} 
	   else { elem.className="eleShown";} 
	}


	function toggle_frame(frame, op) {
		
		if (op) {
			document.getElementById(frame).style.visibility = op;
		} else {
			document.getElementById(frame).style.visibility = (document.getElementById(frame).style.visibility == 'visible') ? 'hidden' : 'visible';
		}
	}
	
