Event.observe(window, 'load', function() {
	
	// observe the images for mouse momement
	var extDiv = $('pro1');
	if(extDiv){
	
		$R(1,6).each(function(x){
			var pro = "pro" + x;
			if($(pro) == null) return;
			Element.setOpacity($(pro), 0.8);
		
		    Event.observe(pro, 'mouseover', function(event){
				var element = Event.element(event);
		        $(pro).addClassName('activeP');
				Element.setOpacity($(pro), 1.0);
		    });

			Event.observe(pro, 'mouseout', function(event){
				var element = Event.element(event);
		        $(pro).removeClassName('activeP');
				Element.setOpacity($(pro), 0.8);
		    });
		});
	}
	
	// observe the links for mouse momement
	$R(1,3).each(function(x){
		var btn = "btn" + x;
		var hdn	= "hdn" + x;
		if($(btn) == null) return;
		
		Element.setOpacity($(btn), 0.8);
		
	    Event.observe(btn, 'mouseover', function(event){
			var element = Event.element(event);
	        $(btn).addClassName('active');
			Element.setOpacity($(btn), 1.0);
			$(hdn).addClassName('Hactive');
	    });

		Event.observe(btn, 'mouseout', function(event){
			var element = Event.element(event);
			Element.setOpacity($(btn), 0.8);
	        $(btn).removeClassName('active');
			$(hdn).removeClassName('Hactive');
	    });
	});
	
});


//the impression updater

function updateheader(div_id,timeout,pic_id){
	setTimeout('loadNew2('+div_id+','+pic_id+','+timeout+')',timeout);
}
function loadNew2(div_id,pic_id,timeout){
	Element.setOpacity('test', 0.0);
	var pic_id = pic_id + 1;
		
	new Ajax.Updater(
		'test',
		'pages/new_header.php', 
		{
			parameters: 'pic_id='+pic_id+'&div_id='+div_id+'&timeout='+timeout,
			evalScripts:true,
			onSuccess: function() {
				Effect.Appear('test', { duration: 1.0 });
			}
		}
  	);
}

//the overlay for webshop
function loadMov(moviename){
	new Effect.ScrollTo("maincontainer");
	new Effect.Appear($('alpha70'),{from:0.0, to:0.8, duration:0.5});
	//new Effect.Appear($('popup'),{from:0.0, to:0.8, duration:0.8});
	setTimeout('movie("'+moviename+'")',1000);
}
function movie(moviename){
	new Ajax.Updater(
		'popup',
		'pages/loadmovie.php',
		{
            method: 'post',
			parameters: 'moviename='+moviename,
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache'],
            onComplete: function () {
				Effect.Appear('popup',{ duration: 1.0 });
			}
		});
}

function fadeMov(){
	$('popup').style.display = 'none';
	new Effect.Fade($('alpha70'),{duration:0.5});	
}

function makecontact(){

	form_values = Form.serialize('contactversturen');
	
	new Ajax.Updater(
		'contactversturen',
		'pages/mailto.php',
		{
			method: 'post',
			parameters: form_values,
			requestHeaders: ['Expires', 'Thu, 17 May 2001 10:17:17 GMT', 'Cache-Control', 'no-cache, must-revalidate', 'Pragma', 'no-cache'],
			onComplete: function () {
				Effect.Appear('contactversturen',{ duration: 1.0 });
			}
		});
}
function deactivate() {
	$('submitBtn').disabled=true;
	//$('indicator').style.display = 'block';
	//$('buttonVerstuur').style.display = 'none';
}
