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

var _class=Class.create({initialize:function(){typeof Lightview!="undefined"&&this.loaded();document.observe("lightview:loaded",this.loaded.bind(this))},loaded:function(){PGL.lightview=this.lightview},lightview:function(a){a=Object.extend({href:"#_lvajaxelement"},Object.clone(a));a.options=Object.extend({width:400,height:300},Object.clone(a.options));if(a.youtube){a.options.width=640;a.options.height=385;a.href="#_lvajaxelement";a.rel="set[inline]";if(typeof a.options.closeButton!="undefined"&&a.options.closeButton==
false)a.rel="inline"}if(a.href=="#_lvajaxelement"){var b=new Element("div",{id:"_lvajaxelement",style:"width:"+a.options.width+"px; height:"+a.options.height+"px; overflow:hidden;"});$("lightviewError").insert(b);a.youtube&&b.pgx("shared.youtube",{video:a.youtube,autoplay:true})}document.observe("lightview:hidden",function(){document.stopObserving("lightview:hidden");$("_lvajaxelement")&&$("_lvajaxelement").destroy()});Lightview.show(a);return a.href=="#_lvajaxelement"?b:Lightview[Lightview._contentPosition]}});
new _class;Element.addMethods({lightview:function(a,b){b=Object.clone(b);b.href="#"+$(a).identify();if(!b.rel){b.rel="set[inline]";if(b.options&&typeof b.options.closeButton!="undefined"&&b.options.closeButton==false)b.rel="inline"}return PGL.lightview(b)}});

PGX.js.push('/_templates/root/scripts/overall.js');

var _class = new Class.create({
	
	initialize: function() {
		
		if (typeof pgiEdit == 'undefined') {			
			this.Right.content();
			this.Right.set();
			this.slide();
		}
		
	},
	
	Ortho: {
		updateSubcat: function(divid, cat_id) {
			$(divid).pgx('core.html', { source: '/_templates/ortho/select_subcat.html', cat_id: cat_id });
		}
	},
	
	slide: function() {
		
		$$('.head_ct_rep').each(function(head_ct) {
			
			var top = head_ct.down('.head_ct_rep_top');
			var bot = head_ct.down('.head_ct_rep_bot');
			bot.setStyle({ position: 'relative', top: '0px', display: 'none' });
			
			head_ct.observe('click', function() {
				var open = head_ct.readAttribute('open');
				
				$$('.head_ct_rep[open="true"]').each( function(head_ctopen) {
					Effect.SlideUp(head_ctopen.down('.head_ct_rep_bot'), { duration: 0.5 });
					head_ctopen.writeAttribute({ open : 'false' });
				});
				
				if (typeof open == 'undefined' || open == 'false' || open == null) {
					Effect.SlideDown(bot, { duration: 0.5 });
					head_ct.writeAttribute({ open : 'true' });
				} else {
					Effect.SlideUp(bot, { duration: 0.5 });
					head_ct.writeAttribute({ open : 'false' });
				}
			});
			
		});
		
	},
	
	Right: {
		
		content: function() {
			
			$$('.right_ct').each( function(right) {
				var top =	right.down('.right_ct_mid_top');
				var bot =	right.down('.right_ct_mid_bot');
				if (!bot.empty() ) {
					
					top.observe('click', function() { 					
						if (bot.getStyle('display') == 'none') {
							new Effect.BlindDown( bot, { duration: 0.5 } );
						} else {
							new Effect.BlindUp( bot, { duration: 0.5 } );
						}				
					});
					
				}else{
					
					var a = right.down('[href]');
					if (typeof a != 'undefined') {
						right.observe('click', function() { window.location = a; });
					}
					
				}
				
			});
			
		},
		
		contentupdate: function(cont, site_cat) {
			if (cont == 'tel') {
				$('right_bot').pgx('core.html', { source: '/_templates/right/telephone_html.html', site_cat: site_cat });
			} else {
				$('right_bot').pgx('core.html', { source: '/_templates/right/ask_html.html', site_cat: site_cat });
			}
		},
		
		set: function() {
			if($('question')) {
				$('question').value = 'Vraag';
			}
		},
		
		update: function() {			
			$('right_balloon').update('Uw bericht is verzonden.<br />Ik neem zo spoedig mogelijk contact met u op.');				
		}
		
	},
	
	Form: {
	
		max: function(elm) {
			var max = elm.readAttribute('rel');
			var length = elm.value.length;
			var still = max - length;
			
			if (still < 0 ) {
				still = 0;
				elm.value = elm.value.substring(0,max);
			}		
			$('max').update(still);
		}
		
	}
	
});

var Root = new _class();

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

var _class=Class.create({initialize:function(){PGL.form=this;PGL.form.bind=this.bind.bind(this);this.forms=new Hash;this.zend()},zend:function(){this.zend=new Hash;this.zend.set("true",{zend:"Zend_Validate_NotEmpty",method:"isValid",params:{value:"{value}"}});this.zend.set("email",{zend:"Zend_Validate_EmailAddress",method:"isValid",params:{value:"{value}"}});this.zend.set("numeric",{zend:"Zend_Validate_Int",method:"isValid",params:{value:"{value}"}});this.zend.set("date",{zend:"Zend_Validate_Date",
method:"isValid",params:{value:"{value}"}});this.zend.set("postcode",{zend:"Zend_Validate_PostCode",vars:"nl_NL",method:"isValid",params:{value:"{value}"}})},bind:function(d,c){c=Object.clone(c);this.forms.set(d,c)},check:function(d,c){if(Object.isElement(d))d=d.identify();var f=$(d);if(f){var a=f.getElements(),g=this.forms.get(d);g.options=Object.clone(c);var h=[],j=[];a.each(function(e){var b=e.readAttribute("required");if(b)if(b=this.zend.get(b)){b=Object.clone(b);b.id=e.identify();if(!b.vars)b.vars=
{};if(b.zend=="Zend_Validate_Date"&&g.format)b.vars.format=g.format;b.vars=Object.toJSON(b.vars);if(!b.params)b.params={};b.params=$H(b.params);b.params.each(function(i){var k=e.getValue();if(e.type=="checkbox")k=e.checked?"true":"";i.value=i.value.replace(/{value}/gi,k);b.params.set(i.key,i.value);j.push(b)})}}.bind(this));pgx("core.zend",{multiple:Object.toJSON(j),onComplete:function(e){e=e.responseText.evalJSON();$H(e).each(function(b){b.value=="false"&&h.push(f.select("#"+b.key).first())});PGL.form.finalize(d,
f,a,g,h)}})}},finalize:function(d,c,f,a,g){var h=a.options;a.className.empty()||f.each(function(e){e.removeClassName(a.className)});if(g.length>0){a.className.empty()||g.each(function(e){e.addClassName(a.className)});!a.element.empty()&&!a.message.empty()&&$(a.element)&&$(a.element).update(a.message);try{Object.isFunction(h.onFailure)&&h.onFailure(c,g)}catch(j){}}else{!a.element.empty()&&$(a.element)&&$(a.element).update();if(a.func){c=c.serialize(true);c.formAction="submit";c.form=d;c.func=a.func;
c.params=a.params;pgx("shared.form",c)}else this.submit(d)}},submit:function(d,c){var f=$(d);if(f){var a=this.forms.get(d).options;if(a.onSuccess){var g=f.serialize(true);try{Object.isFunction(a.onSuccess)&&a.onSuccess(f,g,c)}catch(h){}}else f.action&&f.submit()}}});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.form.bind","ask_quaestion",{"className":"right_bal_err","element":"ask_question_error","message":"Vul de velden in!","format":"DD\/MM\/YYYY","func":"local.mail","params":"zaalndzfaKObi9\/b5NXE0VCo1KOfoKmFkMui0s7Z2M3jyNSbm87K1ZvN4s7A3aPS1N3V292RyeCb2YOk36amnYPfo8\/Lzs\/gkZ7Upl+gm4vC3tDEyIyW0tWJzc3dhZzfaKWbi9Le3tCvzZvSg6TfpqCVm46AsqSJwtXU1c3NnNGDpN+mqJ2D0qDczq7ZzdjPg6ehp5Kdpo7qyM7Nl9nCzdDe1NbU6VCo1KOjppHX0LGbzsrVjqfinZKiaI\/K19Lbr9nK0aDZwtfQmt3Pg6ehp5ejjuDescLZk4+c3KadoZ2DvnOwgb\/V0eHPwtqSj5zm"}]);

PGX.js.push('/_templates/poll/scripts/poll.js');

var _class = new Class.create({
	
	show : function() {
		aParams = {};
		aParams.source = '/_templates/poll/question.html';
		$('ajx_poll').pgx('core.html', aParams);
	},
	
	vote : function() {
		aParams = $('poll').serialize(true);
		aParams.source = '/_templates/poll/results.html';
		$('ajx_poll').pgx('core.html', aParams);
	},
	
	showResults : function() {
		aParams = {};
		aParams.source = '/_templates/poll/results.html';
		$('ajx_poll').pgx('core.html', aParams);
	}
	
});

var Poll = new _class();

_pgq.push(["PGL.form.bind","poll",{"className":"input_err","element":"contactError","message":"* Vul alle verplichte velden in!","format":"DD\/MM\/YYYY"}]);

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

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

PGX.js.push('/js/a1acb8aecc16aa6c12bafae9c25005961c10928b.js'); PGX.js.push('http://www.tiypg.com/_pgx/shared/lightview/2.5.2/scripts/lightview.js'); 
PGX.css.push('http://www.tiypg.com/_pgx/shared/lightview/2.5.2/styles/lightview.css'); PGX.css.push('/_templates/root/styles/home.css'); PGX.css.push('/_templates/root/styles/overall.css'); PGX.css.push('/_templates/menu/styles/top_right.css'); PGX.css.push('/_templates/poll/styles/poll.css'); 
PGX.track({"shared.loader":[],"shared.font":[],"shared.lightview":[],"play.site":[],"play.site.config":[],"play.site.tdk":{"p":"19081","c":"19076","r":"1302"},"play.site.content":{"p":"19081","c":"19076","r":"1302"},"play.site.menu":{"p":"19081","c":"19076","r":"1302"},"shared.form":{"p":"19081","c":"19076","r":"1302"},"shared.queue":{"p":"19081","c":"19076","r":"1302"},"shared.google.analytics":{"p":"19081","c":"19076","r":"1302"}});

