<!--
window.addEvent('domready', function() {
	if(window.getWidth > 960) {
		$(document.body).setStyle('overflow-x','hidden');
	}
});
window.addEvent('domready', function() {
	// fixing z-index bug on ie7
	if(window.ie7 && navigator.appVersion.indexOf("MSIE 8")==-1){
		var zIndexNumber = 1000;
		$$('div').each(function(el,i){
			if(el.hasClass('bg_holder')) {
				// alert(el.getStyle('z-index'));
			} else {
				el.setStyle('z-index',zIndexNumber);
				zIndexNumber -= 10;
			}
		});
	};
});
// for debugging !@#$%^? ie6
window.addEvent('domready', function() {
	if(window.ie6){
		// alert(navigator.appVersion);
	};
});
window.addEvent('domready', function() {
	// set properties for external links
	var links = $$('a');
    links.each(function(item) {
		if (item.getProperty('rel')) {
			if (item.getProperty('rel')=="ext") {
				item.setProperty('target', '_blank');
				item.addClass('extlink');
			}
			if (item.getProperty('rel')=="exte") {
				item.setProperty('target', '_blank');
			}
		}
    });
	// open all pdfs in a new window
	var links_pdf = $$('a.pdf');
    links_pdf.each(function(item) {
			item.setProperty('target', '_blank');
    });
	if($('submenu_back_btn_url')) {
		// correct dlvplant submenu_back_btn_url with javascript.history(-1)
		$('submenu_back_btn_url').setProperty('href', 'javascript:history.go(-1)');	
	}
});


window.addEvent('domready', function() {
	var print_links = $$('a.rel_print');
    
    print_links.each(function(item) {
		item.addEvent("click", function(event) {
			window.print();				 
					 
		});
    });

});
/* ----- TOOLTIP FUNCTIONS ----- */
/*
window.addEvent('domready', function(){
	var tooltip = new Tips($$('a[title], img[title], .tooltip'), {
		showDelay: 500,
		hideDelay: 0
	});
}); 
*/
/* ----- PIT_TINYMENU FUNCTIONS ----- */

var ptm_settings = new Array();
ptm_settings['ptm_display'] = "none";

// new version:
window.addEvent('domready', function() {
	var myPTMslide = new Fx.Slide('pit_tinymenu_items', { duration:400, transition: Fx.Transitions.Bounce.easeInOut});
	var myLayer = $('pit_tinymenu_items');
	
	if (Cookie.get('ptm_display')) {
		ptm_settings['ptm_display'] = Cookie.get('ptm_display');
		if(ptm_settings['ptm_display'] == "none") {
			myPTMslide.hide();
		} else {
			myPTMslide.show();
		}
	} else {
		ptm_settings['ptm_display'] = "none";
		myPTMslide.hide();
	}
	// var ptm_cookie = Cookie.set('ptm_display', 'none', {path: '/'});
	$('pit_tinymenu_nav_btn_link').addEvent('click', function(e){
		e = new Event(e);
		myPTMslide.toggle();
		e.stop();
		if(ptm_settings['ptm_display'] == "none") {
			ptm_settings['ptm_display'] = "block";	
		} else {
			ptm_settings['ptm_display'] = "none";		
		}
		ptm_cookie = Cookie.set('ptm_display', ptm_settings['ptm_display'], {path: '/'});
	});
});
/* ----- IE6ACTIVE FUNCTIONS ----- */
window.addEvent('domready', function() {
									 
	var activebarContainer = $('activebar_container');
	var activebarContent = $('activebar_content');
	var activebarBtnClose = $('activebar_btn_close');
	
	if(activebarContainer) {
		if (Cookie.get('activebar_display')) {
			activebarContainer.style.display = Cookie.get('activebar_display');
		} else {
			activebarContainer.style.display = "block";
		}
		activebarBtnClose.addEvent("click", function(event) {
			activebarContainer.style.display = "none";
			ptm_cookie = Cookie.set('activebar_display', 'none', {path: '/'});
		});
	}
});
/* ----- TOGGLE FUNCTIONS ----- */
function toggleLayer(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display == "block" ? "none":"block";
	} else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display == "block" ? "none":"block";
	} else if (document.layers)	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display == "block" ? "none":"block";
	}
}
/* CONTACTFORM */
// See validate.js -- validating all rel="required" form items

/*
// new periodical (timer) class
periodical_class = new Class({
    initialize: function(dateString){
        this.count = 0;
        this.startTimer();
    },
    updateCount: function(){
        this.count++;
    },
    stopTimer: function(){
        $clear(this.periodicalTimer);
    },
    startTimer: function(){
        this.periodicalTimer = this.updateCount.periodical(1000, this);
    }
});
*/
/* ZODAN Harmonica voor Contactpagina */
window.addEvent('domready', function(){
	var url_hash = "";
	if(window.location.hash) {url_hash = window.location.hash.substring(1);}

	var pitems = $$('.pitem');
	var pitem_count = 0;
	pitems.each(function(item){

		var thisCollapsable = item.getElement( '.harm_collapse' );
		var thisHeader =  item.getElement( '.harm_opener' );
		var toggler = item.getElement( '.toggle' );
		var myCollapsableSlide = new Fx.Slide(thisCollapsable, { duration:400, transition: Fx.Transitions.Bounce.easeInOut});
		if (url_hash.length==0) {
			if(pitem_count != 0) {// only leave the first item open
				myCollapsableSlide.hide();
			} else{
				thisHeader.toggleClass('active');
			}
		} else {
			if(toggler.getProperty('name') == url_hash) { // if url anchor is set, open this one
				myCollapsableSlide.show();
				thisHeader.toggleClass('active');
			} else {
				myCollapsableSlide.hide();
			}	
		}
		pitem_count++;	
		toggler.addEvent('click', function(e){
			e = new Event(e);
			myCollapsableSlide.toggle();
			thisHeader.toggleClass('active');
			e.stop();
		});
	});
}); 
/* oldschool countdown */
function countdown_clock(year, month, day, hour, minute, format) {
	countdownOld(year, month, day, hour, minute, format);                
}  
function countdownOld(year, month, day, hour, minute, format) {
	var divToUpdate = $('timer');
	var innerHTML = "";
	
	Today = new Date();
	Todays_Year = Today.getFullYear();
	Todays_Month = Today.getMonth();                  
	//Convert both today's date and the target date into miliseconds.                           
	Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();
	Target_Date = (new Date(year, month - 1, day, hour, minute, 00)).getTime();                  
	//Find their difference, and convert that into seconds.                  
	Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
	if(Time_Left < 0) {	Time_Left = 0;}
         
	switch(format) {
		case 0:
			//The simplest way to display the time left.
			newHTML = Time_Left + ' seconds';
			divToUpdate.setHTML(newHTML);
			break;
		case 1:
			//More datailed.
			days = Math.floor(Time_Left / (60 * 60 * 24));
			Time_Left %= (60 * 60 * 24);
			hours = Math.floor(Time_Left / (60 * 60));
			Time_Left %= (60 * 60);
			minutes = Math.floor(Time_Left / 60);
			Time_Left %= 60;
			seconds = Time_Left;
			
			dps = 'dagen'; hps = 'uur'; mps = 'minuten'; sps = 'seconden';
			//ps is short for plural suffix.
			if(days == 1) dps ='dag';
			if(hours == 1) hps ='uur';
			if(minutes == 1) mps ='minuut';
			if(seconds == 1) sps ='seconde';
			
			innerHTML = days + ' ' + dps + ' ';
			innerHTML += hours + ' ' + hps + ' ';
			innerHTML += ' en ';
			innerHTML += minutes + ' ' + mps;
			// innerHTML += seconds + ' ' + sps;
			divToUpdate.setHTML(innerHTML);
			break;

		default: 
			innerHTML = Time_Left + ' seconds';
			divToUpdate.setHTML(innerHTML); 
	}
	 //Recursive call, keeps the clock ticking.
	 setTimeout('countdownOld(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 1000);
}

//-->
