function initRollovers()
{
	if ( !document.getElementById )
	{
		return;
	}

	var aPreload = [];
	var sTempSrc;
	
	if ( $( 'navi' )  )
	{
		$( 'navi' ).descendants().each( function( s )
		{ 
			var i = 0;
			if ( $( s ).hasClassName( 'imgover' ) )
			{
				var src 	= s.getAttribute( 'src' );
				var ftype 	= src.substring( src.lastIndexOf( '.' ), src.length );
				var ending	= src.substring( 0, src.lastIndexOf( '.' ) );
				ending		= ending.substring( ending.length - 2 );
				if ( ending !== '_a' )
				{
					var hsrc = src.replace( ftype, '_a' + ftype );
					s.setAttribute( 'hsrc', hsrc );

					aPreload[i] = new Image();
					aPreload[i].src = hsrc;

					Event.observe( s, 'mouseover', function( event )
					{
						sTempSrc = Event.element( event ).getAttribute( 'src' );
						Event.element( event ).setAttribute( 'src', Event.element( event ).getAttribute( 'hsrc' ) );
					} );
					Event.observe( s, 'mouseout', function( event )
					{
						if ( !sTempSrc )
						{
							sTempSrc = Event.element( event ).getAttribute( 'src' ).replace( '_a' + ftype, ftype );
						};
						Event.element( event ).setAttribute( 'src', sTempSrc );
					} );
				};
				i++;
			};
		} );
	};
}

function toggle_display(layer_id, control_id, faq, bottom_id)
{
	
	var testwas = $(layer_id).getStyle( 'display' );

	if ( $(layer_id).getStyle( 'display' ) == 'none' ){
		if(faq == true){
			

			if(bottom_id != 'false') {
				
				
			 $(bottom_id).style.display = 'none';
			 var bottom_id_light = bottom_id +'_light';
			 $(bottom_id_light).style.display = 'block';
			 
			 $(control_id).setAttribute('src', htmlUrl + 'images/buttons/btn_minus_yellow.gif');
			}else {
			 $(control_id).setAttribute('src', htmlUrl + 'images/buttons/btn_minus_yellow_light.gif');
			}
			
			new Effect.Parallel(
				[
					new Effect.SlideDown( layer_id, 0, 100, { sync: true } ),
					new Effect.Appear( layer_id, { sync: true } )
				],
				{
					transition: false,
					duration: 0.3
				}
			);
		}else{
			if(layer_id == 'guarantee_info') {
				img = 'btn_teaser_close_yellow.gif';
			}else {
				img = 'btn_teaser_close.gif';
			}

			$(control_id).setAttribute( 'src', htmlUrl + 'images/buttons/'+img );
			new Effect.SlideDown( layer_id, 0, 100, { sync: true } );
		}
	}
	else
	{
		
		if(faq == true){
			new Effect.BlindUp( layer_id);
			if(bottom_id != 'false') {
		 		var bottom_id_light = bottom_id +'_light';
		 		$(bottom_id_light).style.display = 'none';
				$(bottom_id).style.display = 'block';
			 
			 $(control_id).setAttribute('src', htmlUrl + 'images/buttons/btn_plus_yellow.gif');
			}else {
			 $(control_id).setAttribute('src', htmlUrl + 'images/buttons/btn_plus_yellow_light.gif');
			}
		} else {
			if(layer_id == 'guarantee_info') {
				img = 'btn_teaser_open_yellow.gif';
			}else {
				img = 'btn_teaser_open.gif';
			}
			$(control_id).setAttribute( 'src', htmlUrl + 'images/buttons/'+img );
			new Effect.SlideUp( layer_id, 100, 0, { sync: true, duration: 0.3 } );
		}
	}
	
	return false;
}

function changeSparmatik (id) {
	switch (id) {
		case 1:
			if($('sparmatiklicht').src.indexOf( 'sparmatik_licht_box_gross.gif' ) > -1)  {
				showboxText1.defer();
			}else {
				showcontentText1.defer();
			}
			break;
		case 2:
			if($('sparmatikstandby').src.indexOf( 'sparmatik_standby_box_gross.gif' ) > -1)  {
				showboxText2.defer();
			}else {
				showcontentText2.defer();
			}
			break;
		case 3:
			if ( $( 'sparmatikheizung' ).src.indexOf( 'sparmatik_heizung_box_gross.gif' ) > -1 )
			{
				showboxText3.defer();
			} else {
				showcontentText3.defer();
			}
			break;
	}
}

function submitForm (id) {
	$(id).submit();
}

function showboxText1() {
	$('sparmatiklicht').setAttribute( 'src', htmlUrl + 'images/sparmatik_licht_inhalt.gif' );
	$('sparmatiklink1').update( 'Box ansehen');
}

function showcontentText1() {
	$('sparmatiklicht').setAttribute( 'src', htmlUrl + 'images/sparmatik_licht_box_gross.gif' );
	$('sparmatiklink1').update( 'Inhalte ansehen');
}

function showboxText2() {
	$('sparmatiklink2').update('Box ansehen');
	$('sparmatikstandby').setAttribute( 'src', htmlUrl + 'images/sparmatik_standby_inhalt.gif' );
}

function showcontentText2() {
	$('sparmatiklink2').update('Inhalte ansehen');
	$('sparmatikstandby').setAttribute( 'src', htmlUrl + 'images/sparmatik_standby_box_gross.gif' );
}

function showboxText3() {
	$('sparmatiklink3').update('Box ansehen');
	$('sparmatikheizung').setAttribute( 'src', htmlUrl + 'images/sparmatik_heizung_box_inhalt.gif' );
}

function showcontentText3() {
	$('sparmatiklink3').update('Inhalte ansehen');
	$('sparmatikheizung').setAttribute( 'src', htmlUrl + 'images/sparmatik_heizung_box_gross.gif' );
}

function link_popup ( src, features )
{
	return raw_popup( src.getAttribute( 'href' ),
	src.getAttribute( 'target' ) || '_blank', features );
}

function raw_popup ( url, target, features )
{
	var theWindow = window.open( url, target, features );
	if ( theWindow !== undefined ) {
		theWindow.focus();
		return theWindow;
	}
}