
document.observe("dom:loaded", function() {
        $('main_modelle').setOpacity(0.0);
        $('main_kundenservice').setOpacity(0.0);
        $('main_erlebniswelt').setOpacity(0.0);
        $('main_gebrauchtwagen').setOpacity(0.0);
        $('main_gewerbekunden').setOpacity(0.0);
        $('main_beratung').setOpacity(0.0);
		$('main_bluedrive').setOpacity(0.0);
});

document.observe("dom:loaded", function() {
	var timeoutmain=null;
	
	$$('div[class="main"]')[0].observe('mouseover', function(e){
		clearTimeout(timeoutmain);
		if($('main_modelle').getOpacity()==0){
			timeoutmain = setTimeout(function(){
				new Effect.Opacity( 'main_modelle', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_kundenservice', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_erlebniswelt', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_gebrauchtwagen', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_gewerbekunden', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_beratung', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_bluedrive', { from: 0.0, to: 1.0, duration: 0.5 });
			});
		}
	});

	$$('div[class="main"]')[0].observe('mouseout', function(e){
		if($('main_modelle').getOpacity()==0){
			clearTimeout(timeoutmain);
		} else {
			timeoutmain = setTimeout(function(){
				new Effect.Opacity( 'main_modelle', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_kundenservice', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_erlebniswelt', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_gebrauchtwagen', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_gewerbekunden', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_beratung', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_bluedrive', { from: 1.0, to: 0.0, duration: 0.5 });
			});
		}
	});

	$$('div[class="dialog"]')[0].observe('mouseover', function(e){
		clearTimeout(timeoutmain);
		if($('main_modelle').getOpacity()==0){
			timeoutmain = setTimeout(function(){
				new Effect.Opacity( 'main_modelle', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_kundenservice', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_erlebniswelt', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_gebrauchtwagen', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_gewerbekunden', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_beratung', { from: 0.0, to: 1.0, duration: 0.5 });
				new Effect.Opacity( 'main_bluedrive', { from: 0.0, to: 1.0, duration: 0.5 });
			});
		}
	});

	$$('div[class="dialog"]')[0].observe('mouseout', function(e){
		if($('main_modelle').getOpacity()==0){
			clearTimeout(timeoutmain);
		} else {
			timeoutmain = setTimeout(function(){
				new Effect.Opacity( 'main_modelle', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_kundenservice', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_erlebniswelt', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_gebrauchtwagen', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_gewerbekunden', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_beratung', { from: 1.0, to: 0.0, duration: 0.5 });
				new Effect.Opacity( 'main_bluedrive', { from: 1.0, to: 0.0, duration: 0.5 });
			});
		}
	});
});

