// Direct linking for expand/collapse menu headers without children:
// (Set the wanted target url in href in attribute of &lt;a&gt;-tag-child of .directLink element)
$('.directLink').click(function () {
	$linkElement = jQuery("a", this);
	window.location.href = $linkElement.attr('href');
	return false;
});

var AccordionUtil = function(accWrapper)
{
	var self = this;
	this.$accWrapper = $(accWrapper);

	if(this.$accWrapper.length != 0)
	{
		/*
		var $empties = $(".empty", this.$accWrapper);
		$empties.removeClass();
		$empties.addClass("empty");
		*/
		var $directLinkHeaders = $(".empty", this.$accWrapper).prev("h3");
		$directLinkHeaders.addClass("directLink");
	}
};


function initHeaderDropshadow()
{	
	var $header = jQuery("#header");
	var $pageSel = jQuery("#pageSelected");
	
	var $dsLeft = jQuery("#headDSLeft");
	var $dsRight = jQuery("#headDSRight");
	
	if($pageSel.position()===null)
	{
		$dsLeft.css({
				width: '100%'
			});
	}
	else
	{
		function calcAndPos()
		{
			var winWidth = jQuery(window).width();
			var realHeadPos = Math.round(((winWidth - $header.width())/2));
			var relPos = $pageSel.position().left;
			
			//positioning of dropshadows
			var leftW = relPos + realHeadPos;
			var rightPos = leftW + $pageSel.width();
			
			$dsLeft.css({
				left: 0,
				width: leftW
			});
			
			$dsRight.css({
				left: rightPos - 10,
				width: (winWidth - rightPos +10)
			});
		}
	
		calcAndPos();
		$(window).resize(calcAndPos);
	}
}


