window.onload = function () {
	//All the inputs in the right column get focus/blur handlers which makes them switch color
	if ($('right-col')) {
		var rightColInputs = new Array('q','login_code','login_password','newsletter_name','newsletter_email');

		for (var i=0; i<rightColInputs.length; i++) {
			if($(rightColInputs[i])){
				$(rightColInputs[i]).addEvent('focus',function(){this.toggleClass('hasfocus')});
				$(rightColInputs[i]).addEvent('blur',function(){this.toggleClass('hasfocus')});
			}
		}
		
	}

	//append additional code to the focus and blur eventhandlers of the searchbox
	if ($('q')) {
		$('q').onfocus = function () {
			this.toggleClass('hasfocus');
			$('searchicon').src = '/img/search_icon_active.gif';
		}

		$('q').onblur = function () {
			this.toggleClass('hasfocus');
			$('searchicon').src = '/img/search_icon_inactive.gif';
		}
	}

	//If this is the splashpage insert the flash element
	if ($('splashpage')) {
		var d = new Date();
		var so = new SWFObject("/flash/ade-splash.swf?"+d.getYear(), "splashmovie", "580", "625", "8", "#000000");
		so.addParam('wmode','transparent');
		so.write("splash");
	}

	//Invoke the print function
	if ($('printlink')) {
		$('printlink').onclick = function () {
			window.print();
		}
	}
	
	//Show a message telling that cookies need to be turned on!
	if ($('login_save')) {
		$('login_save').onclick = function () {
			if(this.checked){
				$('login_save_message').setStyle('display','block');
			}else{
				$('login_save_message').setStyle('display','none');
			}
		}
	}	
	

	//if a holder for a map exists, generate a map
	if ($('map') && typeof GBrowserIsCompatible != 'undefined') {
		if (GBrowserIsCompatible()) {
			adeMap.initMap();
			if ($('togglefestival')) $('togglefestival').onclick = function () {adeMap.toggleCategory('festival-locations')};
			if ($('toggleiamsterdam')) $('toggleiamsterdam').onclick = function () {adeMap.toggleCategory('iamsterdam')};
			if ($('togglerecordstores')) $('togglerecordstores').onclick = function () {adeMap.toggleCategory('record-stores')};
			if ($('toggled3')) $('toggled3').onclick = function () {adeMap.toggleCategory('d3')};
			if ($('togglestayokay')) $('togglestayokay').onclick = function () {adeMap.toggleCategory('stayokay')};
			if ($('togglefelixmeritis')) $('togglefelixmeritis').onclick = function () {adeMap.toggleCategory('felix-meritis')};
			if ($('toggleahbr')) $('toggleahbr').onclick = function () {adeMap.toggleCategory('ahbr')};
			if ($('togglepresale')) $('togglepresale').onclick = function () {adeMap.toggleCategory('presale')};
		}
	}

	if ($('keyword')) {
		$('keyword').onfocus = function () {if (this.value == 'keyword') { this.value = ''}}
		$('keyword').onblur = function () {if (this.value == '') { this.value = 'keyword'}}
	}

	if ($('lastname')) {
		$('lastname').onfocus = function () {if (this.value == 'last name') { this.value = ''}}
		$('lastname').onblur = function () {if (this.value == '') { this.value = 'last name'}}
	}

	if ($('company')) {
		$('company').onfocus = function () {if (this.value == 'company') { this.value = ''}}
		$('company').onblur = function () {if (this.value == '') { this.value = 'company'}}
	}
}


