/**
 * CustomrSite Javascript Behaviour
 */
jQuery.centrik_form_comments = {
	toggle : function() {
		$('form.wordpress_post_comment').each(
			function() {
				$(this).children('fieldset:eq(0)').children('legend:eq(0)').click(
					function() {
						this.lastChild.innerHTML = (this.lastChild.innerHTML == 'yes' ? 'no' : 'yes');
						//the form element fieldsets to act on
						$(this.form).children('fieldset:gt(0)').each(
							function() {
								if(this.className != 'helpers') {
									if(this.style.display == 'none' || this.offsetHeight == 0) {
										$(this).show();
									} else {
										$(this).hide();
									}
								}
							}
						);
					}
				);
			}
		);
	}
}

//slideshow handling
jQuery.centrik_slideshow = {
	slide : null,
	slides : null,
	set : null,
	handle : function() {
		var t = this;
		this.slides = $(this.slide).children('div.slides');
		this.set = $(this.slides).children();
		this.buttons = $(this.slide).children('p.buttons').children();
		if(this.total() > 1) {
			this.buttons.each(
				function(b) {
					$(this).click( function(event) { t.nextslide(); } );
				}
			);
		}
	},
	total : function() {
		return this.set.length;
	},
	getactive : function() {
		return $(this.slides).find('div.active');
	},
	getfirst : function() {
		return $(this.set)[0];
	},
	getlast : function() {
		return $(this.set)[this.set.length - 1];
	},
	isfirst : function() {
		return $(e).hasClass('first');
	},
	islast : function(e) {
		return $(e).hasClass('last');
	},
	nextslide : function() {
		var a = this.getactive();
		var t = this;
		$(a).slideUp(
			350,
			function() {
				$(this).removeClass('active');
				var n = (t.islast(this) ? t.getfirst() : $(this).next());
				$(n).slideDown(190);
				$(n).addClass('active');
			}
		);
	}
};