function removeClass( obj, cName ) {
	var	rep = obj.className.match( ' '+cName ) ? ' '+cName : cName;
	obj.className = obj.className.replace( rep, '' );
}
function hasClass( obj, cName ) {
	var	re =  new RegExp( '\\b'+cName+'\\b');
	return( re.test(obj.className ) );
}
function addClass( obj, cName ) {
	if( !hasClass( obj, cName ) ) {
		obj.className += obj.className ? ' '+cName : cName;
	}
}
/*
 * Given a string with an element 'id' and optionally a string
 * with the frame name containing the element, return a reference
 * to the object or null.
 */
function xGetElementById( id, frame ) {
	if( typeof(id) == 'string' ) {
		var	doc;
		if( frame && typeof(frame) == 'string' && frame != '' )
			doc = eval ( "top."+frame+".document" );
		else	doc = document;
		if( doc.getElementById )
			id = doc.getElementById( id );
		else if( doc.all )
			id = doc.all[id];
		else	id = null;
	}
	return id;
}
/*
 * Given a tag ID and a CSS property (as strings), set the given property
 * of that ID to the value provided.  The property is set directly on the
 * tag, not in the stylesheet.
 */
function
setStylePropertyById( id, property, value ) {
	if( document ) {
		// Modern browsers (Netscape 6, etc.)
		if( document.getElementById ) {
			var styleObject = document.getElementById( id );
			if( styleObject != null ) {
				styleObject = styleObject.style;
				styleObject[property] = value;
			}
		// Internet Explorer version 4
		} else if( document.all ) {
			document.all[id].style[property] = value;
		// Netscape Navigator 4
		} else {
			document[id][property] = value;
		}
	}
}
/*
 * Given a tag ID and a CSS property (as strings), remove the given property
 * of that ID.  The property is removed directly from the tag, not in the
 * stylesheet.
 */
function
unsetStylePropertyById( id, property ) {
	if( document ) {
		// Modern browsers (Netscape 6, etc.)
		if( document.getElementById ) {
			var styleObject = document.getElementById( id );
			if( styleObject != null ) {
				styleObject = styleObject.style;
				delete styleObject[property];
			}
		// Internet Explorer version 4
		} else if( document.all ) {
			delete document.all[id].style[property];
		// Netscape Navigator 4
		} else {
			delete document[id][property];
		}
	}
}

/*
 * Given a tag ID and a CSS property (as strings), get the value of that
 * property for that ID.
 */
function
getStylePropertyById( id, property ) {
	if( document ) {
		// Modern browsers (Netscape 6, etc.)
		if( document.getElementById ) {
			var styleObject = document.getElementById( id );
			if( styleObject != null ) {
				styleObject = styleObject.style;
				return styleObject[property];
			}
		// Internet Explorer version 4
		} else if( document.all ) {
			return document.all[id].style[property];
		// Netscape Navigator 4
		} else {
			return document[id][property];
		}
	}
	return null;
}

function
saveWindowSize( formName, wFieldName, hFieldName ) {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement &&
		 ( document.documentElement.clientWidth ||
		   document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body &&
		 ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	//window.alert( 'Width = ' + myWidth + "\n" +
	//		'Height = ' + myHeight );
	if( formName && formName != "" ) {
		var frm = eval( "document."+formName );
		if( frm && wFieldName && wFieldName != "" ) {
			var wObj = eval( "frm."+wFieldName );
			if( wObj ) wObj.value = myWidth;
		}
		if( frm && hFieldName && hFieldName != "" ) {
	   		//var hObj = eval( "document.forms['"+formName+"']."+hFieldName );
			//if( hObj ) hObj.value = myHeight;
			var hObj = eval( "frm."+hFieldName );
			if( hObj ) hObj.value = myHeight;
		}
	}
}

function
saveScreenSize( formName, wFieldName, hFieldName ) {
	var screenWidth = 640, screenHeight = 480;
	if( screen ) {
		screenWidth = screen.width;
		screenHeight = screen.height;
	}
	//alert( 'Width = ' + screenWidth + "\n" +
	//		'Height = ' + screenHeight );
	if( wFieldName && wFieldName != "" ) {
	   	var wObj = eval( "document.forms['"+formName+"']."+wFieldName );
		if( wObj ) wObj.value = screenWidth;
	}
	if( hFieldName && hFieldName != "" ) {
	   	var hObj = eval( "document.forms['"+formName+"']."+hFieldName );
		if( hObj ) hObj.value = screenHeight;
	}
}
// Show the sizes of the object passed labeled with the name passed
function
showSizesOf( name, gb ) {
	alert(  "The " + name + " dimensions are:\n" +
		"\tclientWidth: " + gb.clientWidth + "\n" +
		"\tclientHeight: " + gb.clientHeight + "\n" +
		"\toffsetWidth: " + gb.offsetWidth + "\n" +
		"\toffsetHeight: " + gb.offsetHeight + "\n" +
		"\toffsetTop: " + gb.offsetTop + "\n" +
		"\toffsetLeft: " + gb.offsetLeft + "\n" +
		"\twidth: " + gb.width + "\n" +
		"\theight: " + gb.height + "\n"
		);
}

