	//
	// AJINA Open Source AJAX-Framework (Subprojec from phpFormular)
	//
	// http://www.ajina.org
	//
	// Copyright (c) 2005, 2006 by Andreas van Loock
	//
	// This source file is subject to version 2.0 of the GPL license,
	// that is bundled with this package in the file LICENSE, and is
	// available through the world-wide-web at the following url:
	//
	//
	// If you did not receive a copy of the phpFormular license and are unable
	// to obtain it through the world-wide-web, please send a note to
	// info@toolpixx.com so we can mail you a copy immediately.
	//
	// Author: Andreas van Loock
	//

	//
	// Toogle a html-element. If style-display of element (id) is negativ (none or empty)
	// then toogle to block, if positiv (block) then toogle to negativ (none)
	//
	// @param id String HTML-Id of the HTML-Element
	//
	function toogleHTMLElement(id) {

		try {
			if(document.getElementById( id ).style.display == 'none' ||
			   document.getElementById( id ).style.display == '') {

				document.getElementById( id ).style.display = 'block';
			} else {
				document.getElementById( id ).style.display = 'none';
			}
			return true;
		} catch(e) {
			alert('toogleHTMLElement:' + e);
		}
	}

	//
	// Hide a html-element.
	//
	// @param id String HTML-Id of the HTML-Element
	//
	function hideHTMLElement(id) {

		try {
			document.getElementById( id ).style.display = 'none';
			return true;
		} catch(e) {
			alert('hideHTMLElement:' + e);
		}
	}

	//
	// Fade a html-element
	//
	// @param id String HTML-Id of the HTML-Element
	// @param opacity Integer Opacity of the HTML-Element
	//
	function fadeHTMLElement(id, opacity) {
		
		try {
			document.getElementById( id ).style.opacity = '.'+opacity;
			document.getElementById( id ).style.filter = 'alpha(opacity:'+opacity+')';
			return true;
		} catch(e) {
			alert('fadeHTMLElement:' + e);
		}
	}
	
	//
	// Fade out
	//
	// @param id String HTML-Id of the HTML-Element
	// @param opacity Integer Opacity of the HTML-Element
	// @param newopacity Interger New opacity what is charge by function
	//
	function fadeOutHTMLElement(id, opacity, newopacity, speed) {
	
		try {
			if (!fadeCheckHTMLElement(id, newopacity)) {
				var newopacity = parseInt(newopacity - 5);
				if ( newopacity > opacity) {
					fadeHTMLElement(id, newopacity);
					opacityID = window.setTimeout("fadeOutHTMLElement('"+id+"','"+opacity+"','"+newopacity+"', '"+speed+"')", speed);
				}
			}
			else { 
				fadeHTMLElement(id, opacity);
			}
			return true;
		} catch(e) {
			alert('fadeOutHTMLElement:' + e);
		}
	}
	
	//
	// Fade check
	//
	// If html-element is setup to fade out and the actually opacity is smaller then the
	// opacity then do not fade it.
	//
	// @param id String HTML-Id of the HTML-Element
	// @param opacity Integer Opacity of the HTML-Element
	//
	function fadeCheckHTMLElement(id, newopacity) {
		
		try {
			if (document.getElementById( id ).style.opacity < newopacity) {
				return false;
			} else {
				return true;
			}
		} catch(e) {
			alert('fadeCheckHTMLElement:' + e);
		}
	}
	
	//
	// Show a html-element.
	//
	// @param id String HTML-Id of the HTML-Element
	//
	function showHTMLElement(id) {

		try {
			document.getElementById( id ).style.display = 'block';
			return true;
		} catch(e) {
			alert('showHTMLElement:' + e);
		}
	}

	//
	// Display the htmlcode at the htmlid-container
	//
	// @param id String HTML-Id of the HTML-Element
	//
	function innerHTMLElement(id, code) {

		try {
			document.getElementById( id ).innerHTML = code;
			return true;
		} catch(e) {
			alert('innerHTMLElement:' + e);
		}
	}
	
	//
	// Is a html-element.
	//
	// @param id String HTML-Id of the HTML-Element
	//
	function isHTMLElement(id) {

		try {
			if (document.getElementById( id )) {
				return true;
			} else {
				return false;
			}
		} catch(e) {
			alert('hideHTMLElement:' + e);
		}
	}
