Cufon.replace('.midcol-top h2.light, .introbox .text h2, .introtext .text h2, .telefonchat .telefon, .midcol h1, .telfon', { fontFamily: 'Gotham-Light' });
Cufon.replace('.introbox .text h1, .introtext .text h1, .block-bottom .text h2, .midcol h1 span, .maincol-top h1, .telfon span, .sendsoknad h2 span, .nyhetslisteboks h3, .sendsoknad .btn, .ledige a', { fontFamily: 'Gotham' });
Cufon.replace('.midcol-top h2.medium, .introbox .btn,.contact-btn, .introtext .btn, .blocks-three h2, .blocks-four h2, .footer-cont h3, .telefonchat .chat .startchat, .relatedblog h3, .relatedarticle h3, .kontaktform h3, .maincol-top h2', { fontFamily: 'Gotham-Medium' });
Cufon.replace('.nav a:not(.nocufon)', { fontFamily: 'Gotham-Medium' });
Cufon.replace('.midcol-top h2.book, .midcol h2', { fontFamily: 'Gotham Book' });

var godown=180;
var hoverstarted=false;
var dd_idle=750;
var dd_show_speed=1000;
var dd_hide_speed=500;
var pad_show_speed=500;
var pad_hide_speed=500;

/**
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)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 ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){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.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);

function hover_in() {
		if(($(this).parent().parent().parent().hasClass("nav"))&&
			($(this).parent().find(".dropdown").length)&&
			(!$(this).parent().find(".dropdown").is(":visible"))) {
			hoverstarted=true;
			$(".content").animate({paddingTop:godown+"px"},pad_show_speed);
			$(".nav li a").removeClass("active");
			$(this).addClass("active");
			$(this).parent().find(".dropdown").fadeIn(dd_show_speed,function(){
				hoverstarted=false;
			});
		}
		$(this).css("text-decoration","none");
}
function hover_out(){
}

$(document).ready(function() {
    $(".dropdown").hide(0);
    $('a.email').each(function() {
        var k = $(this).text().replace('(a)', '@');
        $(this).attr("href", 'mailto:' + k).text(k);
    });
    $(".nav li a").click(function(e) {
        if (($(this).parent().find(".dropdown").length) && (!hoverstarted)) {
            e.preventDefault();
            if ($(this).parent().find(".dropdown").is(":visible")) {
                $(this).parent().find(".dropdown").fadeOut(dd_hide_speed, function() {
                    $(".nav li a").removeClass("active");
                    $(this).css("text-decoration", "none");
                    $(".content").animate({ paddingTop: "0" }, pad_hide_speed);
                });
            } else {
                if ($(this).parent().find(".dropdown").length) {
                    $(".content").animate({ paddingTop: godown + "px" }, pad_show_speed);
                    $(this).addClass("active");
                    $(this).parent().find(".dropdown").fadeIn(dd_show_speed);
                }
            }
            return false;
        }
    });
    $(".nav li a").hoverIntent({
        over: hover_in,
        timeout: dd_idle,
        out: hover_out
    });


    if ($("#front-slider").length) {
        var slider = $('#front-slider').bxSlider({
        infiniteloop: true,
        auto: true
    });

    $('.thumbs a').click(function() {
        var thumbIndex = $('.thumbs a').index(this);
        slider.goToSlide(thumbIndex);
        $('.thumbs a').removeClass('pager-active');
        $(this).addClass('pager-active');
        return false;
    });

    /* $('.thumbs a:first').addClass('pager-active'); */

    }
});
