/**
 * Copyright 2011 - Siesqo
 */
$(document).ready(function()
{
	/*
	 * innerfade headerphotos
	 */
	if($('#headerPhoto').length>0) $('#headerPhoto').cycle({fx:'fade', timeout: 4500, speed: 1500});
	
	/* accordion */
	
	/*
		Temporary disabled
	*/
	/*
		// init vars
		var $items = $('#accordion').find('.item');
		var $headers = $items.find('header');
	
		// set click on accordions items
		$headers.click(function(e)
		{
			// do nothing when already active
			if(clicked == $(this).parent().index()) return false;
	
			// remove all class
			$headers.removeClass('current');
			
			// hide all items
			$items.find('.children').stop(true, true).slideUp();
			
			// redefine clicked
			clicked = $(this).parent().index();
			
			// show clicked items + redefine height
			$(this).addClass('current').parent().find('.children').stop(true, true).slideDown(equalCols);
			
			// return false
			return false;
		});
	*/
	/*
		Temporary Added
	*/
	var $items = $('#accordion').find('.item');
	var $headers = $items.find('header');
	$headers.click(function(e)
	{
		window.location.href = $(this).find('h2 a').attr('href');
	});
	/* END Temporary Added */


	/* set equal column heights */
	if($(".equalCols").length>0)
	{
		// redefine height
		equalCols();
	}
	
	/**
	 * Dropdowns
	 */
	$(".dropdown dt a").click(function()
	{
		var $dropdown = $(this).parent().parent();
		$dropdown.find('dd ul').toggle();
	});

	$(".dropdown dd ul li a").click(function()
	{
		var text = $(this).html();
		var $dropdown = $(this).parent().parent().parent().parent();
		$dropdown.find('dt a span').html(text);
		$dropdown.find('dd ul').hide();
	});

	$(document).bind('click', function(e)
	{
		var $clicked = $(e.target);
		if (!$clicked.parents().hasClass("dropdown"))
			$(".dropdown dd ul").hide();
	});

	function getSelectedValue(id)
	{
		return $("#" + id).find("dt a span.value").html();
	}
});

/*
 * HIGHSLIDE GALLERY
 */
//<![CDATA[
// The gallery example on the front page
var galleryOptions = {
	slideshowGroup: 'gallery',
	wrapperClassName: 'dark',
	//outlineType: 'glossy-dark',
	dimmingOpacity: 0.8,
	align: 'center',
	transitions: ['expand', 'crossfade'],
	fadeInOut: true,
	wrapperClassName: 'borderless floating-caption',
	marginLeft: 100,
	marginBottom: 80,
	numberPosition: 'caption'
};
// add control bar
if (hs.addSlideshow) hs.addSlideshow({
	slideshowGroup: 'gallery',
	interval: 5000,
	repeat: true,
	useControls: true,
	overlayOptions: {
		className: 'text-controls',
		position: 'bottom center',
		relativeTo: 'viewport',
		offsetY: -60
	},
	thumbstrip: {
		position: 'bottom center',
		mode: 'horizontal',
		relativeTo: 'viewport'
	}

});
hs.Expander.prototype.onInit = function() {
	hs.marginBottom = (this.slideshowGroup == 'gallery') ? 150 : 15;
}
//]]>
