/********** Plugins **********/

/* Copyright (c) 2008 Kean Loong Tan http://www.gimiti.com/kltan
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * Copyright notice and license must remain intact for legal use
 * jFade
 * Version: 1.0 (Jun 30, 2008)
 * Requires: jQuery 1.2.6+
 * 
 *
 * Original Code Copyright (c) 2008 by Michael Leigeber
 * Website: http://www.leigeber.com
 * 
 *
 */ 
(function(A){A.fn.jFade=function(N){var B=A.extend({},A.fn.jFade.defaults,N);var F,C,K,E,H,J,I,M,D;var G=this;var L=function(){var Q=G;B.steps=B.steps||20;B.duration=B.duration||20;clearInterval(Q.timer);C=O(B.end);K=C[0];E=C[1];H=C[2];if(!Q.r){F=O(B.start);r=F[0];g=F[1];b=F[2];Q.r=r;Q.g=g;Q.b=b}J=Math.round(Math.abs(Q.r-K)/B.steps);I=Math.round(Math.abs(Q.g-E)/B.steps);M=Math.round(Math.abs(Q.b-H)/B.steps);if(J==0){J=1}if(I==0){I=1}if(M==0){M=1}Q.step=1;Q.timer=setInterval(function(){P(Q,B.property,B.steps,K,E,H,J,I,M)},B.duration);function P(V,d,a,e,U,X,c,Y,f){var T=V;var S;if(T.step<=a){var R=T.r;var W=T.g;var Z=T.b;if(R>=e){R=R-c}else{R=parseInt(R)+parseInt(c)}if(W>=U){W=W-Y}else{W=parseInt(W)+parseInt(Y)}if(Z>=X){Z=Z-f}else{Z=parseInt(Z)+parseInt(f)}S="rgb("+R+","+W+","+Z+")";A(V).css(d,S);T.r=R;T.g=W;T.b=Z;T.step=T.step+1}else{clearInterval(T.timer);S="rgb("+e+","+U+","+X+")";A(V).css(d,S)}}function O(R){var S=[parseInt(R.substring(0,2),16),parseInt(R.substring(2,4),16),parseInt(R.substring(4,6),16)];return S}};if(B.trigger=="load"){L()}else{A(this).bind(B.trigger,function(){G=this;L()})}return this};A.fn.jFade.defaults={trigger:"load",property:"background",start:"FFFFFF",end:"000000",steps:5,duration:30}})(jQuery);

/********** globale funktioner **********/

$(document).ready(function()
	{
		
		/***** Accordion effekt til more info på forsiden *****/
		
		
		/** tabel version **/
		/** fade ind og ud plus ændring i tekst **/
		$('tr.more_container').hide();
		$('a.more_click').toggle(function(){
			$(this).hide('').text('Hide text').fadeIn('slow');
			$(this).parent('td').parent('tr').prev('tr.more_container').fadeIn('800');
			}, function () {
			$(this).hide().animate({opacity: 1.0}, 300).text('Read more').fadeIn('800');
			$(this).parent('td').parent('tr').prev('tr.more_container').fadeOut('800');
		});
		
	
		/***** fade effekt på billeder i arkivet *****/
		
		$('div.news-list-item > a > img').fadeTo('normal', 0.7);  
		$('div.news-list-item > a > img').hover(function(){  
		$(this).stop().fadeTo('normal', 1.0);  
		},function(){  
		$(this).stop().fadeTo('normal', 0.7);  
		});
		

		/***** Color transition på links *****/
		
	
		  
		/*
		$("a:not(li.act_menu a, a[href='pathName'])").jFade({
			trigger: "mouseover",
			property: 'color',
			start: '3a3939',
			end: '8caac3',
			steps: 15,
			duration: 7
		}).jFade({
			trigger: "mouseout",
			property: 'color',
			start: '8caac3',
			end: '3a3939',
			steps: 15,
			duration: 7
		});
		*/
	
		/***** markering af link i pagebrowseren *****/
		
		var pathName = window.location.href.substr(20)
		$(function(){   			

   			$('.news-list-item > h3 > a').each(function() {
      				var linkName = $(this).attr('href');
      				if (linkName == pathName) { 
      				$(this).css('color','#8CAAC3').css('text-decoration','underline');
      				      				}
      				
   			});
		});
		

			
	});