	/**
	* toggles a image between two states
	* call like this: onMouseOver="gfxToogle(this, 'active.gif', 'inactive.gif')" onMouseOut="gfxToogle(this, 'active.gif', 'inactive.gif')"
	* image paths and current state are determined automatically.
	*
	* @access	public
	* @param	object		gfx			a DOM object with a .src parameter
	* @param	string		active		the filename or path + filename to the active-state image
	* @param	string		inactive	the filename or path + filename to the inactive-state image
	* @return	void
	*/
	function gfxToggle(gfx, active, inactive) {

		if (typeof gfx == 'object' && gfx.src) {

			if (active.indexOf('/') < 0
			 || inactive.indexOf('/') < 0
			) {

				var matches = gfx.src.match(/^(.*)\/([^\/]+)$/);
	
				switch (matches[2]) {
					case active:
						gfx.src = matches[1] + '/' + inactive;
						break;
	
					case inactive:
						gfx.src = matches[1] + '/' + active;
						break;
	
					default:
				} /* end: switch */
			} else {
				if (gfx.src.indexOf(active) >= 0) {
					gfx.src = inactive;
				} else if (gfx.src.indexOf(inactive) >= 0) {
					gfx.src = active;
				} /* end: if */
			} /* end: if */
		} /* end: if */
	}

	function gfxToggle2(gfx, name, state) {
		gfx.src = eval('gfx_'+name+'_'+state).src;
	}
	
	 /**
	* return an object of the given id
	* @access public
	* @param string objectid of the element
	* @return object HTML Object of the element
	*/
	function $(id) {
		return document.getElementById(id);
	}

	 /**
	* toggles visibility of an object flexible for each block element
	* call like this:
	* toogleObject('objctId')
	*
	* ensure that the object has the defined
	* style="display: none;"
	* or
	* style="display: block;"
	*
	* @access public
	* @param string objectid of the element to be shown or hidden
	* @return void
	*/
	function toggleObject(objId) {
	
		if (objId) {
			var object = document.getElementById(objId);
			if (object) {
				object.style.display = ( object.style.display == 'none' ) ? "block" : "none";
			} /* end: if */
		} /* end: if */
	}

	/**
	* toggles visibility of an object
	* call like this:
	* // for making an object visible
	* showHideObject('objctId', true)
	*
	* // for making an object invisible
	* showHideObject('objctId', false)
	*
	* // for making an object flexible to a checkbox
	* // if checkbox checked than show else hide
	* <input type="checkbox" onChange="showHideObject('objctId', this.checked)">
	*
	* @access	public
	* @param	string		objectid	of the element to be shown or hidden
	* @param	boolean		visibility	of the element to be shown or hidden
	* @return	void
	*/
	function showHideObject(objId, visibility) {

		if (objId) {
			var object = document.getElementById(objId);

			if (object) {

				switch (visibility) {
					case false:
						object.style.visibility = 'hidden';
						object.style.display = 'none';
						break;

					case true:
						object.style.visibility = 'visible';
						object.style.display = 'block';
						break;
				} // end: switch

			} /* end: if */


		} /* end: if */
	}
	
	// Reload CAPTCHA
	function reloadCaptcha(imgIdToReload) {
		document.getElementById(imgIdToReload).setAttribute('src', document.getElementById(imgIdToReload).getAttribute('src')+'?1');
	}
