function(style, key, value)
	{
		var isValue = value != null && (typeof(value.length) == 'undefined' || value.length > 0);
		
		if (style == null || style.length == 0)
		{
			if (isValue)
			{
				style = key + '=' + value + ';';
			}
		}
		else
		{
			if (style.substring(0, key.length + 1) == key + '=')
			{
				var next = style.indexOf(';');
				
				if (isValue)
				{
					style = key + '=' + value + ((next < 0) ? ';' : style.substring(next));
				}
				else
				{
					style = (next < 0 || next == style.length - 1) ? '' : style.substring(next + 1);
				}
			}
			else
			{
				var index = style.indexOf(';' + key + '=');
				
				if (index < 0)
				{
					if (isValue)
					{
						var sep = (style.charAt(style.length - 1) == ';') ? '' : ';';
						style = style + sep + key + '=' + value + ';';
					}
				}
				else
				{
					var next = style.indexOf(';', index + 1);
					
					if (isValue)
					{
						style = style.substring(0, index + 1) + key + '=' + value + ((next < 0) ? ';' : style.substring(next));
					}
					else
					{
						style = style.substring(0, index) + ((next < 0) ? ';' : style.substring(next));
					}
				}
			}
		}
		
		return style;
	}
function(style, key, value)
	{
		var isValue = value != null && (typeof(value.length) == 'undefined' || value.length > 0);
		
		if (style == null || style.length == 0)
		{
			if (isValue)
			{
				style = key + '=' + value + ';';
			}
		}
		else
		{
			if (style.substring(0, key.length + 1) == key + '=')
			{
				var next = style.indexOf(';');
				
				if (isValue)
				{
					style = key + '=' + value + ((next < 0) ? ';' : style.substring(next));
				}
				else
				{
					style = (next < 0 || next == style.length - 1) ? '' : style.substring(next + 1);
				}
			}
			else
			{
				var index = style.indexOf(';' + key + '=');
				
				if (index < 0)
				{
					if (isValue)
					{
						var sep = (style.charAt(style.length - 1) == ';') ? '' : ';';
						style = style + sep + key + '=' + value + ';';
					}
				}
				else
				{
					var next = style.indexOf(';', index + 1);
					
					if (isValue)
					{
						style = style.substring(0, index + 1) + key + '=' + value + ((next < 0) ? ';' : style.substring(next));
					}
					else
					{
						style = style.substring(0, index) + ((next < 0) ? ';' : style.substring(next));
					}
				}
			}
		}
		
		return style;
	}
function ( style , key , value ) { var isValue = value != null && ( typeof ( value . length ) == 'undefined' || value . length > 0 ) ; if ( style == null || style . length == 0 ) { if ( isValue ) { style = key + '=' + value + ';' ; } } else { if ( style . substring ( 0 , key . length + 1 ) == key + '=' ) { var next = style . indexOf ( ';' ) ; if ( isValue ) { style = key + '=' + value + ( ( next < 0 ) ? ';' : style . substring ( next ) ) ; } else { style = ( next < 0 || next == style . length - 1 ) ? '' : style . substring ( next + 1 ) ; } } else { var index = style . indexOf ( ';' + key + '=' ) ; if ( index < 0 ) { if ( isValue ) { var sep = ( style . charAt ( style . length - 1 ) == ';' ) ? '' : ';' ; style = style + sep + key + '=' + value + ';' ; } } else { var next = style . indexOf ( ';' , index + 1 ) ; if ( isValue ) { style = style . substring ( 0 , index + 1 ) + key + '=' + value + ( ( next < 0 ) ? ';' : style . substring ( next ) ) ; } else { style = style . substring ( 0 , index ) + ( ( next < 0 ) ? ';' : style . substring ( next ) ) ; } } } } return style ; }
Function: setStyle

Adds or removes the given key, value pair to the style and returns the
new style. If value is null or zero length then the key is removed from
the style. This is for cell styles, not for CSS styles.

Parameters:

style - String of the form [(stylename|key=value);].
key - Key of the style to be changed.
value - New value for the given key.
Function : setStyle
Returns the style string