﻿/* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*  Copyright © 2008 George McGinley Smith
*/
jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend(jQuery.easing, { def: 'easeOutQuad', swing: function(x, t, b, c, d) { return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInQuad: function(x, t, b, c, d) { return c * (t /= d) * t + b; }, easeOutQuad: function(x, t, b, c, d) { return -c * (t /= d) * (t - 2) + b; }, easeInOutQuad: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t + b; return -c / 2 * ((--t) * (t - 2) - 1) + b; }, easeInCubic: function(x, t, b, c, d) { return c * (t /= d) * t * t + b; }, easeOutCubic: function(x, t, b, c, d) { return c * ((t = t / d - 1) * t * t + 1) + b; }, easeInOutCubic: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; return c / 2 * ((t -= 2) * t * t + 2) + b; }, easeInQuart: function(x, t, b, c, d) { return c * (t /= d) * t * t * t + b; }, easeOutQuart: function(x, t, b, c, d) { return -c * ((t = t / d - 1) * t * t * t - 1) + b; }, easeInOutQuart: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; return -c / 2 * ((t -= 2) * t * t * t - 2) + b; }, easeInQuint: function(x, t, b, c, d) { return c * (t /= d) * t * t * t * t + b; }, easeOutQuint: function(x, t, b, c, d) { return c * ((t = t / d - 1) * t * t * t * t + 1) + b; }, easeInOutQuint: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; }, easeInSine: function(x, t, b, c, d) { return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; }, easeOutSine: function(x, t, b, c, d) { return c * Math.sin(t / d * (Math.PI / 2)) + b; }, easeInOutSine: function(x, t, b, c, d) { return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; }, easeInExpo: function(x, t, b, c, d) { return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b; }, easeOutExpo: function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; }, easeInOutExpo: function(x, t, b, c, d) { if (t == 0) return b; if (t == d) return b + c; if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function(x, t, b, c, d) { return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; }, easeOutCirc: function(x, t, b, c, d) { return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; }, easeInOutCirc: function(x, t, b, c, d) { if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; }, easeInElastic: function(x, t, b, c, d) { var s = 1.70158; var p = 0; var a = c; if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3; if (a < Math.abs(c)) { a = c; var s = p / 4; } else var s = p / (2 * Math.PI) * Math.asin(c / a); return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; }, easeOutElastic: function(x, t, b, c, d) { var s = 1.70158; var p = 0; var a = c; if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3; if (a < Math.abs(c)) { a = c; var s = p / 4; } else var s = p / (2 * Math.PI) * Math.asin(c / a); return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; }, easeInOutElastic: function(x, t, b, c, d) { var s = 1.70158; var p = 0; var a = c; if (t == 0) return b; if ((t /= d / 2) == 2) return b + c; if (!p) p = d * (.3 * 1.5); if (a < Math.abs(c)) { a = c; var s = p / 4; } else var s = p / (2 * Math.PI) * Math.asin(c / a); if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; }, easeInBack: function(x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c * (t /= d) * t * ((s + 1) * t - s) + b; }, easeOutBack: function(x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; }, easeInOutBack: function(x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b; return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b; }, easeInBounce: function(x, t, b, c, d) { return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b; }, easeOutBounce: function(x, t, b, c, d) { if ((t /= d) < (1 / 2.75)) { return c * (7.5625 * t * t) + b; } else if (t < (2 / 2.75)) { return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b; } else if (t < (2.5 / 2.75)) { return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b; } else { return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b; } }, easeInOutBounce: function(x, t, b, c, d) { if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b; } });

/* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
*  <http://cherne.net/brian/resources/jquery.hoverIntent.html>
*  @author    Brian Cherne <brian@cherne.net>
*/
(function($) { $.fn.hoverIntent = function(f, g) { var cfg = { sensitivity: 7, interval: 100, timeout: 0 }; cfg = $.extend(cfg, g ? { over: f, out: g} : f); var cX, cY, pX, pY; var track = function(ev) { cX = ev.pageX; cY = ev.pageY; }; var compare = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { $(ob).unbind("mousemove", track); ob.hoverIntent_s = 1; return cfg.over.apply(ob, [ev]); } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function() { compare(ev, ob); }, cfg.interval); } }; var delay = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = 0; return cfg.out.apply(ob, [ev]); }; var handleHover = function(e) { var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; while (p && p != this) { try { p = p.parentNode; } catch (e) { p = this; } } if (p == this) { return false; } var ev = jQuery.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } if (e.type == "mouseover") { pX = ev.pageX; pY = ev.pageY; $(ob).bind("mousemove", track); if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function() { compare(ev, ob); }, cfg.interval); } } else { $(ob).unbind("mousemove", track); if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function() { delay(ev, ob); }, cfg.timeout); } } }; return this.mouseover(handleHover).mouseout(handleHover); }; })(jQuery);

/* jQuery TOC Plugin v1.0.2
*  http://code.google.com/p/samaxesjs/
*  Copyright (c) 2008 samaxes.com
*/
/*!
 * samaxesJS JavaScript Library
 * jQuery TOC Plugin v1.0.2
 * http://code.google.com/p/samaxesjs/
 *
 * Copyright (c) 2008 samaxes.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


(function($) {
	/*
	 * The TOC plugin dynamically builds a table of contents from the headings in
	 * a document and prepends legal-style section numbers to each of the headings.
	 */
	$.fn.toc = function(options) {
		var defaults = {
			exclude: 'h1, h5, h6',
			area: 'body',
			type: 'ordered'
		};
		defaults.type = $(this).hasClass("ordered") ? "ordered": "unordered"
		
		var opts = $.extend({}, defaults, options);
		var toc = this.append('<ul></ul>').children('ul');
		var headers = {h1: 0, h2: 0, h3: 0, h4: 0, h5: 0, h6: 0};
		var index = 0;
		var indexes = {
			h1: (opts.exclude.match('h1') === null && $('h1').length > 0) ? ++index : 0,
			h2: (opts.exclude.match('h2') === null && $('h2').length > 0) ? ++index : 0,
			h3: (opts.exclude.match('h3') === null && $('h3').length > 0) ? ++index : 0,
			h4: (opts.exclude.match('h4') === null && $('h4').length > 0) ? ++index : 0,
			h5: (opts.exclude.match('h5') === null && $('h5').length > 0) ? ++index : 0,
			h6: (opts.exclude.match('h6') === null && $('h6').length > 0) ? ++index : 0
		};

		var append2TOC = function (toc, index, headers, i, what, text, sect) {
			for (var j = 1; j < index; j++) {
				if (toc.find('> li:last > ul').length === 0) {
					toc = toc.append('<li><ul></ul></li>');
				}
				toc = toc.find('> li:last > ul');
			}

			if ($(what).attr('id') === '') {
				$(what).attr("id", "sect-" + i );
			}
			toc.append('<li>'+sect+'<a href="#' + $(what).attr('id') + '">' + text + '</a></li>');
		};

		
		/*
		* Checks if the last node is an 'ul' element.
		* If not, a new one is created.
		*/
		var checkContainer = function (header, toc) {
			if (header === 0 && !toc.find(':last').is('ul')) {
				toc.find('li:last').append('<ul></ul>');
			}
		};

		/*
		* Updates headers numeration.
		*/
		var updateNumeration = function (headers, header) {
			$.each(headers, function(i, val) {
				if (i === header)  {
					++headers[i];
				} else if (i > header) {
					headers[i] = 0;
				}
			});
		};

		/*
		* Prepends the numeration to a heading.
		*/
		var addNumeration = function (headers, header) {
			var numeration = '';
			$.each(headers, function(i, val) {
				if (i <= header && headers[i] > 0)  {
					numeration += headers[i] + '.';
				}
			});
			return numeration+ " ";
		};



		return this.each(function() {
	   	$(opts.area).find(':header').not(opts.exclude).each(function(i) {
				var $this = $(this);
				var hn = this.tagName.toLowerCase();
				var headersHn, indexesHn; 
				if ($this.is('h6')) {
					headersHn = headers.h6;
					indexesHn = indexes.h6;
				} else if ($this.is('h5')) {
					headersHn = headers.h5;
					indexesHn = indexes.h5;
				} else if ($this.is('h4')) {
					headersHn = headers.h4;
					indexesHn = indexes.h4;
				} else if ($this.is('h3')) {
					headersHn = headers.h3;
					indexesHn = indexes.h3;
				} else if ($this.is('h2')) {
					headersHn = headers.h2;
					indexesHn = indexes.h2;
				} else if ($this.is('h1')) {
					headersHn = headers.h1;
					indexesHn = indexes.h1;
				}
				if (!$this.is('h1')) {
					checkContainer(headersHn, toc);
				}
				updateNumeration(headers, hn);
				var sect = "";
				var text = $this.text();
				if (opts.type == "ordered") {
					sect = addNumeration(headers, hn);
					$this.text( sect + text );
				}
				append2TOC(toc, indexesHn, headers, i, $this, text, sect);
				
				
			});
		});
	};
})(jQuery);









/* idTabs ~ Sean Catchpole - Version 2.2 - MIT/GPL */
(function(){var dep={"jQuery":"http://code.jquery.com/jquery-latest.min.js"};var init=function(){(function($){$.fn.idTabs=function(){var s={};for(var i=0;i<arguments.length;++i){var a=arguments[i];switch(a.constructor){case Object:$.extend(s,a);break;case Boolean:s.change=a;break;case Number:s.start=a;break;case Function:s.click=a;break;case String:if(a.charAt(0)=='.')s.selected=a;else if(a.charAt(0)=='!')s.event=a;else s.start=a;break;}}
if(typeof s['return']=="function")
s.change=s['return'];return this.each(function(){$.idTabs(this,s);});}
$.idTabs=function(tabs,options){var meta=($.metadata)?$(tabs).metadata():{};var s=$.extend({},$.idTabs.settings,meta,options);if(s.selected.charAt(0)=='.')s.selected=s.selected.substr(1);if(s.event.charAt(0)=='!')s.event=s.event.substr(1);if(s.start==null)s.start=-1;var showId=function(){if($(this).is('.'+s.selected))
return s.change;var id="#"+this.href.split('#')[1];var aList=[];var idList=[];$("a",tabs).each(function(){if(this.href.match(/#/)){aList.push(this);idList.push("#"+this.href.split('#')[1]);}});if(s.click&&!s.click.apply(this,[id,idList,tabs,s]))return s.change;for(i in aList)$(aList[i]).removeClass(s.selected);for(i in idList)$(idList[i]).hide();$(this).addClass(s.selected);$(id).show();return s.change;}
var list=$("a[href*='#']",tabs).unbind(s.event,showId).bind(s.event,showId);list.each(function(){$("#"+this.href.split('#')[1]).hide();});var test=false;if((test=list.filter('.'+s.selected)).length);else if(typeof s.start=="number"&&(test=list.eq(s.start)).length);else if(typeof s.start=="string"&&(test=list.filter("[href*='#"+s.start+"']")).length);if(test){test.removeClass(s.selected);test.trigger(s.event);}
return s;}
$.idTabs.settings={start:0,change:false,click:null,selected:".selected",event:"!click"};$.idTabs.version="2.2";$(function(){$(".idTabs").idTabs();});})(jQuery);}
var check=function(o,s){s=s.split('.');while(o&&s.length)o=o[s.shift()];return o;}
var head=document.getElementsByTagName("head")[0];var add=function(url){var s=document.createElement("script");s.type="text/javascript";s.src=url;head.appendChild(s);}
var s=document.getElementsByTagName('script');var src=s[s.length-1].src;var ok=true;for(d in dep){if(check(this,d))continue;ok=false;add(dep[d]);}if(ok)return init();add(src);})();

var $jQ = jQuery.noConflict();

$jQ(document).ready(function() {
	//  MSIE 6 only
	var IE6 = false;
	if ($jQ.browser.msie && $jQ.browser.version < 7) {
		IE6 = true;
	}
	/*	
	$jQ("tabel.data tr:odd").addClass("odd");
	$jQ("tabel.data tr:even").addClass("even");
	alert($jQ("tabel.data").length)
	*/

	$jQ("a.toggle").click(function() {
		$jQ($jQ(this).attr("href")).slideToggle("slow", "easeInBack");
	});



	// Top menu
	if (!IE6) {
		$jQ(".col-1-3 .media .text h2 a").hoverIntent(
		  	function() {
		  		$jQ(this).parent().parent().animate({
		  			height: "64px"
		  		}, "slow", "easeOutBack");
		  	},
		  	function() {
		  		$jQ(this).parent().parent().animate({
		  			height: "48px"
		  		}, "normale", "easeInBack");
		  	}
		)
	}


	//  Search box
    // .attr("value", "Søg")
    if ($jQ("#search input.text").length) {
	    $jQ("#search input.text")
		    .attr("value", $jQ("#search input.text").attr("title"))
		    .focus(function() {
			    if (this.value == this.title) {
				    this.value = "";
			    }
			    $jQ(this).addClass("active");
		    })
		    .blur(function() {
			    if (this.value == "") {
				    this.value = this.title;
			    }
			    $jQ(this).removeClass("active");
		    });
    }


	if ($jQ("#tabs").length) {
		$jQ("#tabs").addClass("js");

		var tab = $jQ(".tab");

		var s = [];
		s.push('<ul>');

		for (var i = 0; i < tab.length; i++) {
			s.push('<li><a href="#' + tab[i].id + '">' + tab[i].title + '</a></li>');
			tab[i].title = "";
		}
		s.push('</ul>');
		$jQ("#tabs .tabs .tabnavi").append(s.join(''));

		tab.appendTo("#tabs .tabs .tabpanel");

		$jQ(".tab-header").hide();

		var options = {};
		if (window.location.hash) {
			var hash = window.location.hash;
			currentHash = $jQ("#tabs " + hash);
			if (currentHash.length) {
				options = { 
					start: hash.replace("#", "") 
				}
			}
		}

		if (IE6) { // IE6 only
			$jQ("#tabs").idTabs(options);
		} else {
			$jQ("#tabs").idTabs(function(id, list, set) {
				$jQ("a", set).removeClass("selected")
					.filter("[href$='" + id + "']", set).addClass("selected");
				for (var i = 0, il = list.length; i < il; i++) {
					$jQ(list[i]).hide();
				}
				$jQ(id).slideDown("fast", "easeInOutQuad");
				return false;
			}, options);
		}

		if ($jQ("#tabs.maxHeight").length) {
			var tabs = $jQ("#tabs .tabs .tabpanel .tab");
			var maxHeight = 0;
			for (var i = 0, il = tabs.length; i < il; i++) {
				if ($jQ(tabs[i]).height() > maxHeight) {
					maxHeight = $jQ(tabs[i]).height();
				}
			}
			/* +20 are padding top and bottom */
			$jQ("#tabs").css("min-height", maxHeight + 20);
			if (IE6) {
				$jQ("#tabs .tabs .tabpanel").css("height", maxHeight + 20);
			}
		}
	}

    if (IE6) {
		$jQ("#logo img").attr("src", $jQ("#logo img").attr("src") +".gif");
	}

	$jQ("#toc").toc({area: "#content"});

});