/**
 * Bootstrap.js - Bootstrap for all Javascript functionality
 * 
 * @author  Webstores <info at webstores dot nl>
 *           Copyright (c) Webstores internet totaalbureau <http://www.webstores.nl/>
 */

var albumLightWindow;

WS.Event.addEvent(window, 'load', function() {
	
	if($('portal')) {
		var wolken = new FlashObject('resources/swf/wolken.swf', '', '1280', '230', '8', '#FFFFFF');
		wolken.addParam('quality', 'high');
		wolken.addParam('wmode', 'transparent');
		wolken.write('clouds');
		
		var navigatie = new FlashObject('resources/swf/navigatie.swf', '', '950', '550', '8', '#FFFFFF');
		navigatie.addParam('quality', 'high');
		navigatie.addParam('wmode', 'transparent');
		navigatie.write('portal-navigation');
	}
	
	albumLightWindow = new lightwindow({
		contentOffset: {
			width: 18,
			height: 6
		},
		dimensions: {
			image: { height: 250, width: 250 },
			page: { height: 250, width: 250 },
			inline: { height: 250, width: 250 },
			media: { height: 250, width: 250 },
			external: { height: 250, width: 250 },
			titleHeight: 30
		},
		viewportPadding: 3
	});
	
	$$('.page-thumb').each(function(el) {
		el.observe('click', function(e) {
			Event.stop(e);
			albumLightWindow.activateWindow({
				href: this.href,
				width: 863,
				height: 600,
				type: 'external'
			});
		});
	});

	$$('.album-thumb').each(function(el) {
		el.observe('click', function(e) {
			Event.stop(e);
			albumLightWindow.activateWindow({
				href: this.href,
				width: 873,
				height: 600,
				type: 'external'
			});
		});
	});
	
	/*$('book').observe('click', function(e) {
		Event.stop(e);
		albumLightWindow.activateWindow({
			href: this.href,
			width: 963,
			height: 600,
			type: 'external'
		});
	});*/
	
	$$('#plattegrond a')[0].observe('click', function(e) {
		Event.stop(e);
		albumLightWindow.activateWindow({
			href: this.href,
			width: 963,
			height: 600,
			type: 'external'
		});
	});
	
	var val = new WS.Validation('contact-form');
	val.initialize();
	var val2 = new WS.Validation('order-form');
	val2.initialize();
	
	var newsVal = new WS.Validation('newsletter');
	newsVal.initialize();
	
	if(WS.browser.IE6) {
		$('leafs') ? WS.Util.fixPngBackground('leafs', 'resources/img/leafs.png') : false;
		$('portal') ? WS.Util.fixPngBackground('logo', 'resources/img/portal-logo.png') : WS.Util.fixPngBackground('logo', 'resources/img/logo.png');
		!$('portal') ? WS.Util.fixPngBackground('message', 'resources/img/message-bg.png') : false;
		$('content-head') ? WS.Util.fixPngBackground($$('#content-head img')[0]) : false;
	}
	
	if($('fluister')){
		if(typeof thema != 'undefined') {
		if(thema == "kampeerdorp") { file = 'fluister_groen'; }
		else if(thema == "horecaplaza") { file = 'fluister_rood'; }
		else if(thema == "waterwereld") { file = 'fluister_blauw'; }
		else if(thema == "speelkasteel") { file = 'fluister_geel'; }
		else if(thema == "cobusclub") { file = 'fluister_paars'; }
		else {file = 'fluister_groen';}
		}
		else {file = 'fluister_groen';}
		var sign = new SWFObject('/resources/swf/'+file+'.swf', 'fluister', '240', '77', '8', '#FFFFFF');
		sign.addParam('wmode', 'transparent');
		sign.addVariable('xmlfile', 'http://www.zandstuve.com/resources/xml/music.xml');
		sign.addVariable('pauzed', 'false');
		sign.write('fluister');
	}
});
