function init_dw_Scroll() {
    var wndo = new dw_scrollObj('textframe', 'text');
    wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
    
    // id, autohide (hide when not needed), axis
    wndo.setUpScrollControls('scrollbar', true, 'v');
    
    // Links to swap content 
   // wndo.setUpLoadLinks('extra_controls');
    // Demonstrating jump to top and scroll to ID controls 
    //wndo.setUpScrollControls('extra_controls');

    // Demonstrating how you can include a jump to top link inside the scroll area 

    wndo.setUpScrollControls('textframe');
}



function loadGoogleMaps()
{
	if (GBrowserIsCompatible())
	{
		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(51.9353438, 4.782239), 15);
		map.openInfoWindowHtml(map.getCenter(), "<div style=\"font-family:arial;font-size:12px;\"><b>Den Hoed Aannemers</b><br>Jan Blankenstraat 17<br>2861 BZ Bergambacht<br>T 0182 - 351 225</div>");
	}
} 

Event.observe(window, 'load', function()
{
	if ($('map'))	{		loadGoogleMaps();	}
	
	if ($('carrousel_1'))
	{
		imageScrollCollection = new ImageScrollCollection();
		imageScrollCollection.addImageScroll('carrousel_1','lr',true,true,true,true,carrouselIndex);
	}
	
	if ($('photo_project') || $('photo'))
	{
		newAnimation = new Animation();
		newAnimation.slideshow(1,5000,'dia', 0);
	}
	
	if ($('sfeer'))
	{
		newAnimation = new Animation();
		newAnimation.slideshow(1,5000,'dia', 1);
	}
	
	
	if ($('list_subtopmenu'))
	{
		newNavigator = new NavigatorCollection();
		newNavigator.getNavigator(
		{
			'id'				: "subtopmenu",
			'submenu'			: "downblind",
			'effect'			: "slide"
		});
	}
	
	Event.observe('button_overlay_restauratie', 'mouseover', function(event)
	{
		if(!$('button_li_1').hasClassName("button_1_active"))
		{
			new Effect.Move($('button_1'), { x: 25, y: 0, mode: 'absolute', duration: 0.2  }); 
			return false;
		}
	});
	
	Event.observe('button_overlay_restauratie', 'mouseout', function(event)
	{
		if(!$('button_li_1').hasClassName("button_1_active"))
		{
			new Effect.Move($('button_1'), { x: 0, y: 0, mode: 'absolute', duration: 0.2  }); 
			return false;
		}
	});
	
	Event.observe('button_overlay_onderhoud', 'mouseover', function(event)
	{
		if(!$('button_li_2').hasClassName("button_2_active"))
		{
			new Effect.Move($('button_2'), { x: 25, y: 0, mode: 'absolute', duration: 0.2  }); 
			return false;
		}
	});
	
	Event.observe('button_overlay_onderhoud', 'mouseout', function(event)
	{
		if(!$('button_li_2').hasClassName("button_2_active"))
		{
			new Effect.Move($('button_2'), { x: 0, y: 0, mode: 'absolute', duration: 0.2  }); 
			return false;
		}
	});
	
	Event.observe('button_overlay_nieuwbouw', 'mouseover', function(event)
	{
		if(!$('button_li_3').hasClassName("button_3_active"))
		{
			new Effect.Move($('button_3'), { x: 25, y: 0, mode: 'absolute', duration: 0.2  }); 
			return false;
		}
	});
	
	Event.observe('button_overlay_nieuwbouw', 'mouseout', function(event)
	{
		if(!$('button_li_3').hasClassName("button_3_active"))
		{
			new Effect.Move($('button_3'), { x: 0, y: 0, mode: 'absolute', duration: 0.2  }); 
			return false;
		}
	});
	
	if($('blok2'))
	{
		$('blok2').style.opacity = 0.5;
		$('blok2').style.filter = 'alpha(opacity=' + 50 + ')';
		
		
		Event.observe('blok2', 'mouseover', function(event)
		{
			new Effect.Opacity('blok2', { from: 0.5, to: 1.0, duration: 0.5 });
			return false;
		});
		
		Event.observe('blok2', 'mouseout', function(event)
		{
			new Effect.Opacity('blok2', { from: 1.0, to: 0.5, duration: 0.5 });
			return false;
		});
	}
	
	if($('blok5'))
	{
		Event.observe('blok5', 'mouseover', function(event)
		{
			new Effect.Opacity('blok5', { from: 0.5, to: 1.0, duration: 0.5 });
			
			return false;
		});
		
		Event.observe('blok5', 'mouseout', function(event)
		{
			new Effect.Opacity('blok5', { from: 1.0, to: 0.5, duration: 0.5 });
			return false;
		});
		
		$('blok5').style.opacity = 0.5;
		$('blok5').style.filter = 'alpha(opacity=' + 50 + ')';

	}
	
	if($('blok6'))
	{
		Event.observe('blok6', 'mouseover', function(event)
		{
			new Effect.Opacity('blok6', { from: 0.5, to: 1.0, duration: 0.5 });
			
			return false;
		});
		
		Event.observe('blok6', 'mouseout', function(event)
		{
			new Effect.Opacity('blok6', { from: 1.0, to: 0.5, duration: 0.5 });
			return false;
		});
		
		$('blok6').style.opacity = 0.5;
		$('blok6').style.filter = 'alpha(opacity=' + 50 + ')';

	}
	
	if($('blok1'))
	{
//		$('blok1').style.opacity = 0.0;
//		$('blok1').style.filter = 'alpha(opacity=' + 00 + ')';
	}	
	
	if($('blok12'))
	{
		$('blok12').hide();
	}
	
	if($('blok15'))
	{
		$('blok15').hide();
	}
	
	if($('blok16'))
	{
		$('blok16').hide();
	}
	
	if($('blok3'))
	{
//		$('blok3').style.opacity = 0.0;
//		$('blok3').style.filter = 'alpha(opacity=' + 00 + ')';
	}
	
	if($('blok4'))
	{
//		$('blok4').style.opacity = 0.0;
//		$('blok4').style.filter = 'alpha(opacity=' + 00 + ')';
	}
	
	if ($('dia1').hasClassName('onderhoud'))
	{
		new Effect.Opacity('blok2', { from: 0.5, to: 1.0, duration: 0.0 });
		$('blok12').show();
	}

	if ($('dia1').hasClassName('nieuwbouw'))
	{
		new Effect.Opacity('blok5', { from: 0.5, to: 1.0, duration: 0.0 });
		$('blok15').show();
	}
	
	if ($('dia1').hasClassName('restauratie'))
	{
		new Effect.Opacity('blok6', { from: 0.5, to: 1.0, duration: 0.0 });
		$('blok16').show();
	}
	
	
	
	
});

function getElementsByClass(searchClass,node,tag) {
        var classElements = new Array();
        if ( node == null )
                node = document;
        if ( tag == null )
                tag = '*';
        var els = node.getElementsByTagName(tag);
        var elsLen = els.length;
        var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
        for (i = 0, j = 0; i < elsLen; i++) {
                if ( pattern.test(els[i].className) ) {
                        classElements[j] = els[i];
                        j++;
                }
        }
        return classElements;
}

var Animation = Class.create(
{
	slideshow: function(start,interval,target, fadepercentage)
	{
		var frame 		= start;   
		var nextframe 	= start+1;
		
		if (fadepercentage == 0)
		{
			var fade = 0.0;
		}
		else
		{
			var fade = 0.6;
		}
		
		
		if ($('dia' + frame))
		{
			//var last		= $('dia' + frame).parentNode.getElementsByClassName('dia').length;
			var last = getElementsByClass('dia', $('dia' + frame).parentNode).length;
//			Effect.Appear(target+'1',{duration:.5,from:0.0,to:1.0});   
			
			setInterval(function()
			{   
				
				
				if ($('sfeer'))
				{
					
					new Effect.Opacity('blok2', { from: 1.0, to: 0.5, duration: 0.0 });
					new Effect.Opacity('blok5', { from: 1.0, to: 0.5, duration: 0.0 });
					new Effect.Opacity('blok6', { from: 1.0, to: 0.5, duration: 0.0 });
					
					$('blok12').hide();
					$('blok15').hide();
					$('blok16').hide();
					
					if ($('dia' + nextframe).hasClassName('onderhoud'))
					{
						new Effect.Opacity('blok2', { from: 0.5, to: 1.0, duration: 0.5 });
						$('blok12').show();
					}

					if ($('dia' + nextframe).hasClassName('nieuwbouw'))
					{
						new Effect.Opacity('blok5', { from: 0.5, to: 1.0, duration: 0.5 });
						$('blok15').show();
					}
					
					if ($('dia' + nextframe).hasClassName('restauratie'))
					{
						new Effect.Opacity('blok6', { from: 0.5, to: 1.0, duration: 0.5 });
						$('blok16').show();
					}
					
					
				}
				
				if ($('photodescription' + frame))
				{
					//$('photodescription').show();
					//$('photodescription').innerHTML = '<h3>Fotobeschrijving:</h3><p>' + $('photodescription' + frame).value + '</p>';
					$('content').innerHTML = '<h3>Fotobeschrijving:</h3><p>' + $('photodescription' + frame).value + '</p>';
				}
				
				Effect.Fade(target+frame,
				{	duration:.5,
					from:1.0,
					to:fade,
					afterFinish:function()
					{
						$(target+frame).hide();
						
						
						
					    frame = nextframe;
					    nextframe = (frame == last) ? start : nextframe+1;
					},
					beforeStart:function()
					{
					    Effect.Appear(target + nextframe,{duration:.5,from:fade,to:1.0});
					}
				});
			}, interval);  
			
			 
		}
		return; 
	}
});

function showFaq(id)
{
	if (!$('faq_text_' + id).visible())
	{
		$('faq_text_' + id).show();
		$('faq_h1_' + id).src = '/images/min.gif';
		$('text').style.offsetHeight = ($('text').style.offsetHeight  + $('faq').style.offsetHeight ) +"px";

		var wndo = new dw_scrollObj('textframe', 'text');
	    wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
	    wndo.setUpScrollControls('scrollbar', true, 'v');
	    
	    wndo.setUpScrollControls('textframe');
	}
	else
	{
		$('faq_text_' + id).hide();
		$('faq_h1_' + id).src = '/images/plus.gif';
		$('text').style.offsetHeight  = ($('text').style.offsetHeight  + $('faq').style.offsetHeight ) +"px";

		var wndo = new dw_scrollObj('textframe', 'text');
	    wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
	    wndo.setUpScrollControls('scrollbar', true, 'v');
	    wndo.setUpScrollControls('textframe');
		
	}
	
}