/*
##########################################
# Script: /js/functions.js               #
# Copyright (C) 2003-2007 Forwart Design #
# Author: Peter Arts                     #
# http://www.forwart.nl                  #
##########################################
*/


$(document).ready(function(){if($("#dynheader").length>0){$("#dynheader ul.tabs a").click(function(b){b.preventDefault();$("#dynheader ul.tabs li").removeClass("active");$(this).parent("li").addClass("active");dynheaderLoad($(this).attr("href"))});var a=$("#dynheader ul.tabs li.active a").attr("href");dynheaderLoad(a)}if($("#headlines").length>0){$("#headlines .headline h1 a").click(function(c){var b=$(this).parents(".headline").find("p");if(!b.hasClass("active")){c.preventDefault();$("#headlines .headline p.active").slideUp("fast",function(){b.slideDown().addClass("active")}).removeClass("active")}})}});function dynheaderLoad(a){window.clearTimeout(autoAdvanceDynheaderTimeout);autoAdvanceDynheaderIndex=-1;$("#dynheader .contents").fadeOut(250,function(){$("#dynheader .contents").html('<p class="loading">Loading...</p>')});$.get(a,function(b){try{height=$("height",b).text();var d=$("contents",b).text();$("#dynheader .contents").animate({height:height+"px"},1000,"swing",function(){$("#dynheader .contents").html(d);parseDynheaderContents()})}catch(c){$("#dynheader .contents").html("An error has occured.")}})}function parseDynheaderContents(){$("#dynheader .contents a").click(function(b){var a=$(this).attr("href");if(a.indexOf("/dynheader/")!==-1){b.preventDefault();dynheaderLoad(a)}});$("#dynheader .contents .img").css({top:"140px"});$("#dynheader .contents .img").animate({top:"30px"},1000);$("#dynheader .contents .img img").mouseenter(function(a){stopAutoAdvanceDynheaderContents(this);$(this).stop().animate({width:"240px",height:"170px",top:"-75px"},2000)});$("#dynheader .contents .img img").mouseleave(function(){$(this).stop().animate({width:"123px",height:"87px",top:"0px"},2000)});autoAdvanceDynheaderTimeout=window.setTimeout(autoAdvanceDynheaderContents,2000)}var autoAdvanceDynheaderTimeout;var autoAdvanceDynheaderIndex=-1;function autoAdvanceDynheaderContents(){if(autoAdvanceDynheaderIndex>=0){var b=$("#dynheader .contents .img img:eq("+autoAdvanceDynheaderIndex+")");b.stop().animate({width:"123px",height:"87px",top:"0px"},2000)}var a=$("#dynheader .contents .img img").length;autoAdvanceDynheaderIndex=(autoAdvanceDynheaderIndex+1)%a;var c=$("#dynheader .contents .img img:eq("+autoAdvanceDynheaderIndex+")");c.stop().animate({width:"240px",height:"170px",top:"-75px"},2000);autoAdvanceDynheaderTimeout=window.setTimeout(autoAdvanceDynheaderContents,5000)}function stopAutoAdvanceDynheaderContents(a){window.clearTimeout(autoAdvanceDynheaderTimeout);var b=$("#dynheader .contents .img img:eq("+autoAdvanceDynheaderIndex+")");b.stop().animate({width:"123px",height:"87px",top:"0px"},2000)};