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.tiypg.com/_pgx/shared/youtube/2.3/youtube.js');

var _class=Class.create({initialize:function(){PGL.youtube=this.youtube.bind(this);PGL.youtube.resize=this.youtube.bind(this)},dim:function(a){var b={};b.width=a.getWidth()?a.getWidth():parseInt(a.getStyle("width"));if((!b.width||isNaN(b.width))&&a.up(0))b.width=a.up(0).getWidth()?a.up(0).getWidth():parseInt(a.up(0).getStyle("width"));b.height=parseInt(b.width/1.662);return b},youtube:function(a){if(Object.isString(a))a=$$("#"+a);else{if(!(a=$(a)))return;a=[a]}a.each(function(a){var d=this.dim(a);
d.height&&a.setStyle({height:d.height+"px"});var f=a.down("object");f&&f.setStyle({height:"100%"});var e=a.down("img");if(e){var c=new Image;c.onload=function(){e.setStyle({marginTop:"-"+(c.height*(d.width/c.width)-d.height)/2+"px"});c=void 0};c.src=e.src}}.bind(this))}});new _class;

PGX.js.push('http://www.tiypg.com/_pgx/shared/queue/2.5/queue.js');

var _class=Class.create({initialize:function(req){_pgq=this;this.req=new Hash;this.index=0;if(req&&req.each)req.each(function(req){this.push(req)}.bind(this))},push:function(req,retry){if(!retry)retry=1;if(retry<=50){if(req){this.req.set(this.index,req);this.index++}this.req.each(function(req){this.apply(req,retry)}.bind(this))}},apply:function(req,retry){this.req.unset(req.key);if(typeof req.value=="function")req.value();else{var value=req.value.slice(0);var bind=null;if(typeof value=="string"){var lib=
value;var params=[]}else{var lib=value.first();var params=value.slice(1);var split=lib.split(".");if(split[0].startsWith("$("))var bind=$(split[0].replace(/\$\(/gi,"").replace(/\)/gi,"").replace(/"/gi,"").replace(/'/gi,""))}try{eval(lib+".apply(bind, params);")}catch(e){try{console.log(e)}catch(e){}var type="";try{eval("var type = typeof "+lib)}catch(e){}if(type!="function")(function(){this.push(req.value,retry+1)}).bind(this).delay(0.1)}}}});new _class(_pgq);

_pgq.push(["PGL.youtube","_f856cfd5"]);

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

var addthis_config = addthis_config || {}; addthis_config.data_ga_property = 'UA-21168241-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.css.push('http://www.tiypg.com/_pgx/shared/youtube/2.3/youtube.css'); 
PGX.track({"play.site":[],"play.site.config":[],"play.site.tdk":{"p":"15492","c":"14814","r":"1302"},"play.site.content":{"p":"15492","c":"14814","r":"1302"},"play.site.menu":{"p":"15492","c":"14814","r":"1302"},"play.site.block":{"p":"15492","c":"14814","r":"1302"},"shared.youtube":{"p":"15492","c":"14814","r":"1302"},"shared.queue":{"p":"15492","c":"14814","r":"1302"},"shared.google.analytics":{"p":"15492","c":"14814","r":"1302"}});

