PGX.js.push('http://www.orangesystems.nl/_templates/library/translate/scripts/translate.js');

var _class = new Class.create({
	
	initialize: function() {
		if (!$('language')) return;
		$('language').observe('change', function(event) {
			location.href = PGX.prefix + event.element().getValue();
		});
	}
	
});

new _class();

PGX.js.push('http://www.orangesystems.nl/_templates/library/menu/scripts/menu.js');

var _class = new Class.create({
	
	initialize: function() {
		$$('.li_menu').each(function(menu) {
			var submenu = menu.down('.ul_submenu');
			submenu.hide();
			submenu.setStyle({ top: '0px' });
			
			if (menu.down('.li_submenu')) {
				menu.down('a').href = 'javascript:;';
				menu.down('a').setStyle({ 'cursor': 'default' });
				menu.observe('mouseover', (function() { submenu.show(); }).bind(submenu));
				menu.observe('mouseout', (function() { submenu.hide(); }).bind(submenu));
			}
		});
	}
	
});

new _class();

PGX.js.push('http://www.orangesystems.nl/_templates/library/slide/scripts/slide.js');

var _class = new Class.create({
	
	initialize: function() {
		if(typeof pgiEdit == 'undefined') {
			this.time = 6;
			
			this.get((function(json) {
				this.json = json;
				this.length = (json.length - 1);
				this.hash = $H(json);
				
				this.buttons();
				this.slide(0);
			}).bind(this));
		};
	},
	
	get: function(oncomplete) {
		var language = $(document.body).lang;
		pgx('orange.slide', {
			language: language,
			onComplete: function(response) {
				oncomplete(response.responseText.evalJSON());
			}
		});
	},
	
	buttons: function() {
		if ($$('.animation_buttons') && $$('.animation_buttons').first()) {
			this.json.each((function(row, n) {
				var sClass = 'animation_false';
				if (n == 0) sClass = 'animation_true';
				
				var img = new Element('img', { src: '_templates/animation/images/button_false.png', 'class': 'animation_button ' + sClass } );
				$$('.animation_buttons').first().insert( { bottom: img });
				img.observe('click', (function() { this.slide(n); }).bind(this));
			}).bind(this));
		}
	},
	
	update: function(n) {
		if ($$('.animation_buttons') && $$('.animation_buttons').first()) {
			var elm = $$('.animation_true').first();
			elm.src = '_templates/animation/images/button_false.png';
			elm.toggleClassName('animation_true');
			
			if (n == 0) {
				elm = $$('.animation_buttons').first().down(0);
			} else {
				elm = $$('.animation_buttons').first().down(0).next((n - 1));
			}
			
			elm.src = '_templates/animation/images/button_true.png';
			elm.toggleClassName('animation_true');
		}
	},
	
	slide: function(n) {
		clearTimeout(this.delay);
		if (n > this.length) n = 0;
		
		if ($$('.animation') && $$('.animation').first()) {
			var params = this.hash.get(n);
			params.display = (params.button_link == '' || params.button_text == '') ? 'none' : '';
			params.source = '/_templates/animation/content.html';
			params.onComplete = (function(response) {
				if ($('animation_cont')) {
					this.time = 8;
					this.animation(response.responseText);
				} else {
					$$('.animation').first().update(response.responseText);
				}
			}).bind(this)
			pgx('core.html', params);
		}
		
		this.update(n);
		n = (n + 1);
		this.delay = this.slide.bind(this).delay(this.time, n);
	},
	
	animation: function(html) {
		var width = document.viewport.getWidth();
		var plus = 250;
		var min = 977;
		var show = ((((width - min) / 2) + min) - plus);
		var hide = (width + plus);
		
		if (!$('animation')) {
			$('animation_cont').hide();
			$('animation_cont').update(html);
			$('animation').setStyle({ left: show + 'px' });
			$('animation_cont').show();
		} else {
			new Effect.Move('animation', {
				x: hide,
				y: 0,
				mode: 'absolute',
				transition: Effect.Transitions.sinoidal,
				duration: 1.5,
				afterFinish: function() {
					
					var div = new Element('div');
					div.update(html);
					var content = div.down(0).innerHTML;
					$('animation').update(content);
					
					new Effect.Move('animation', {
						x: show,
						y: 0,
						mode: 'absolute',
						transition: Effect.Transitions.sinoidal,
						duration: 1.5
					})
					
				}
			})
		}
	}
	
});

new _class();

PGX.js.push('http://www.orangesystems.nl/_templates/library/footer/scripts/footer.js');

var _class = new Class.create({
	
	initialize: function() {
		$$('.lib_footer div.fade').each(function(div) {
			div.setOpacity(0.33);
			div.observe('mouseover', function() { this.setOpacity(1.0); });
			div.observe('mouseout', function() { this.setOpacity(0.33); });
		});
	}
	
});

new _class();

PGX.js.push('http://www.orangesystems.nl/_templates/library/button/scripts/button.js');

var _class = new Class.create({
	
	initialize: function() {
		
		$$('.media_btn_ov').each( function(elm) {

			a = elm.down('.media_btn_ct a');
			if(a) {				
				elm.observe('click', function() {
					window.location = a.href;
				});				
			}
			
		});
		
	}
	
});

new _class();

_gaq.push(['_setAccount', 'UA-21167962-1'], ['_trackPageview']);

var addthis_config = addthis_config || {}; addthis_config.data_ga_property = 'UA-21167962-1'; addthis_config.data_ga_social = true;

PGX.js.push('/js/a1acb8aecc16aa6c12bafae9c25005961c10928b.js'); 
PGX.css.push('/_templates/root/styles/root.css'); PGX.css.push('/_templates/menu/styles/top.css'); PGX.css.push('/_templates/search/styles/search.css'); PGX.css.push('/_templates/menu/styles/general.css'); PGX.css.push('/_templates/animation/styles/animation.css'); PGX.css.push('/_templates/crumble/styles/crumble.css'); PGX.css.push('http://www.orangesystems.nl/_templates/library/footer/styles/footer.css'); 
PGX.track({"play.site":[],"play.site.config":[],"play.site.tdk":{"p":"15273","c":"14814","r":"1302"},"play.site.content":{"p":"15273","c":"14814","r":"1302"},"play.site.menu":{"p":"15273","c":"14814","r":"1302"},"play.site.block":{"p":"15273","c":"14814","r":"1302"},"shared.google.analytics":{"p":"15273","c":"14814","r":"1302"}});

