
/**
 * toggle faq entries
 */
function faq_toggle(id) {
	
	$$('span.faq_item_detail').each( Element.hide );
	$('faq_item_'+id).show();

} //


// [#FORM_HANDLING] 
if ( document.addEventListener ) document.addEventListener( 'DOMContentLoaded', form_ff_adapt, false );

/**
 * [#FORM_HANDLING] does insert span tags in labels in order to prevent width in mozilla (Firefox) browsers
 * using the Mozilla-specific document.addEventListener() method to launch the script. 
 * This really is ideal, as it only runs for Mozilla (which is all we need) and 
 * it launches as soon as the DOM has been loaded.
 */
function form_ff_adapt() {
	
	if (navigator.userAgent.match(/\bMozilla\b/)) {
	
		// Hide forms
		// $$('form').hide(); // latest prototype version and safari 2 does not recognize elements which are set display to hidden (as if they didn't exists)
		// with new $ version 1.2.1 and noconflict(), it can be used again
		
		/**
		* with latest version of $ 1.2.1 li/label does not function properly, only label used here
		* $( 'form#editform' ).find( 'li/label' ).each( function( i ){
		*/
		var f = $$('form label'); // get all label elements within form
		
		for(var i=0; i<f.length; i++){
			
			var labelContent = f[i].innerHTML;
			var labelWidth = f[i].getStyle('width');
			var labelSpan = document.createElement( 'span' );
				labelSpan.style.display = 'block';
				labelSpan.style.width = labelWidth;
				labelSpan.innerHTML = labelContent;
			f[i].style.display = '-moz-inline-box';
			f[i].innerHTML = ""; // statt this.innerHTML = null; fuer opera 9.0
			f[i].appendChild( labelSpan );
			
		}
	  
		// Show forms
		// $$('form').show();
	
	} // end if
} // end form_ff_adapt


/*------------------------------------------------------------------------------
Function:       FigureHandler()
Author:         Aaron Gustafson (aaron at easy-designs dot net)
Creation Date:  28 August 2007
Version:        0.1
Homepage:       http://code.google.com/p/easy-designs/wiki/FigureHandler
License:        MIT License (see homepage)
Note:           If you change or improve on this script, please let us know by
                emailing the author (above) with a link to your demo page.
------------------------------------------------------------------------------*/
function FigureHandler(g,h) {

	if(typeof(h)!=='object'){
		var h={'75-100':'full-col', '67-75':'three-quarters-col', '50-67':'two-thirds-col', '34-50':'half-col', '25-34':'third-col', '0-25':'quarter-col'}
	}
	var i='div.figure';
	if(typeof(g)=='string')i='#'+g+' '+i;
	
	function init(){
		$$(i).each(function(a){
			var b=a.getElementsByTagName('img')[0].width;
			var c=parseInt($(a.parentNode).getStyle('width'));
			var d=Math.ceil(b/c*100);
			var e,col_class;
			for(var f in h) { 		
				e=f.split('-');
				if(d>e[0]&&d<=e[1]){ 	
					col_class=h[f];
					break;
				}
			}
			//alert(col_class);
			a.addClassName(col_class);
			$A(a.getElementsByTagName('p')).each(function(p) { 	p.style.width=b+'px' })
		})
	}init()
}

