/*
try {
    console.assert(1);
} catch(e) {
    if (typeof loadFirebugConsole == 'function') {
         loadFirebugConsole();
    }  else {
        console = {
            log: function() {},
            debug: function() {},
            info: function() {},
            warn: function() {},
            assert: function() {}
        };
    }
}

*/

// HOMEPAGE INTRO

var DS = DS || {};

DS.Adegeest = new Class({
	numItems: 0,
	curItem: 0,
	delay:   15000,
	clickDelay: 30000,
	runTimer: null,
	 
	initialize: function(){
		// Initialisation is called by the DOMREADY statement..
		$$('#introhome_nav a').each(function(theEle){
			this.numItems++;
			theEle.addEvent('click',function (){
								this.activateHomeItem(theEle);
							}.bind(this));								  
		}.bind(this));
		$('introhome_nav').getFirst('a').addClass('active');
		$$('#introtext ol').getFirst('li').addClass('active');
		$$('#introbeeld ol').getFirst('li').addClass('active');
		this.curItem=1;
		this.runTimer=this.autoNextItem.delay(this.delay, this);
		return this;
	},
	
	autoNextItem: function(){
		$$('#introwrapper a').removeClass('active');
		$$('#introwrapper ol li').removeClass('active');
		this.curItem=(this.curItem==this.numItems)?1:this.curItem+1;
		$('introhome_navlink'+this.curItem).addClass('active');
		$('intro_img'+this.curItem).addClass('active');
		$('intro_txt'+this.curItem).addClass('active');
		this.runTimer=this.autoNextItem.delay(this.delay, this);
	},
	
	activateHomeItem: function(theEle){
		$clear(this.runTimer);
		// Kill the timer 
		$$('#introwrapper a').removeClass('active');
		$$('#introwrapper ol li').removeClass('active');
		theEle.addClass('active');
		$('intro_img'+theEle.innerHTML).addClass('active');
		$('intro_txt'+theEle.innerHTML).addClass('active');	
		this.curItem=theEle.innerHTML.toInt();
		// reset the timer with an extra long delay
		this.runTimer=this.autoNextItem.delay(this.clickDelay, this);
	}
});


window.addEvent( 'domready', function(){
	if($('introwrapper')){
		 var DXE=new DS.Adegeest();
	}
});

// RANDOM VLAM

function randomTopImage() {


if ($('vlam')) {
var bg =  new Array();
		bg[0] = "url(/images/vlam01.png) no-repeat top left";
		bg[1] = "url(/images/vlam02.png) no-repeat top left";
		bg[2] = "url(/images/vlam03.png) no-repeat top left";
		bg[3] = "url(/images/vlam04.png) no-repeat top left";
		bg[4] = "url(/images/vlam05.png) no-repeat top left";
		bg[5] = "url(/images/vlam06.png) no-repeat top left";
		bg[6] = "url(/images/vlam07.png) no-repeat top left";

		var random_num = (Math.floor((Math.random()*7)));
		
		$('vlam').setStyle('background', bg[random_num]);
	}
}

window.addEvent ('domready', function() {
	randomTopImage();						  
});


// CUFON FONT REPLACEMENT

Cufon.replace(['div#content > h2','div#hometext > h2'], { 
	fontFamily: 'DINCond-Bold',
	color: '#000'
});

Cufon.replace('div#content > h3', { 
	fontFamily: 'DINCond-Bold',
	color: '#F32938'
});

Cufon.replace(['div.newscontainer > h3','div.previewcontainer h3','div#introtext h3'], { 
	fontFamily: 'DINCond-Bold',
	color: '#F32938'
});

Cufon.replace('div#home_actueel > h2', { 
	fontFamily: 'DINCond-Bold',
	color: '#F32938'
});

Cufon.replace('div.homeblock > h3', { 
	fontFamily: 'DINCond-Bold',
	color: '#000000'
});

Cufon.replace('div#companylinks a', {
	fontFamily: 'DINCond-Bold',
	hover: true
});

Cufon.replace('p.corporatetext', { 
	fontFamily: 'Aldus LT Std',
	color: '#F32D3C'
});

Cufon.replace('div#division', { 
	fontFamily: 'Aldus LT Std',
	color: '#000'
});

Cufon.replace('span.quote', { 
	fontFamily: 'Aldus LT Std',
	color: '#A4A4A4'
});
