﻿//$(document).ready(function() {
//  $(".accordion ul").each (function() {
//    $(this).css("height", $(this).height()).hide();
//  });
//  setTimeout(function() {
//    // Accordion
//    $('.accordion > li > a.expanded + ul').slideToggle('medium');
//    $('.accordion > li > a').click(function() {
//       $('.accordion > li > a.expanded').not(this).toggleClass('expanded').toggleClass('collapsed').parent().find('> ul').slideToggle('medium');
//      $(this).toggleClass('expanded').toggleClass('collapsed').parent().find('> ul').slideToggle('medium');
//      return false;
//    }).filter(':first').click();
//  }, 250);
//});


//$(document).ready(function () {
//    var $div = $('.accordion ul');
//    var height = $div.height();
//    $div.hide().css({ height : 0 });
//
//    $('.accordion a').click(function () {
//        if ($div.is(':visible')) {
//            $div.animate({ height: 0 }, { duration: 400, complete: function () {
//                $div.hide();
//            } });
//        } else {
//            $div.show().animate({ height : height }, { duration: 400 });
//        }
//        
//        return false;
//    });
//});

$(window).load(function() {
    $('#slider').nivoSlider({
        effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
        animSpeed:500, //Slide transition speed
        pauseTime:3000,
        directionNav:true, //Next & Prev
        directionNavHide:false, //Only show on hover
        controlNav:true, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav:true, //Use left & right arrows
        pauseOnHover:true //Stop animation while hovering
    });
    klausulSoegning();
    jQuery('a[href*="mailto:"]').click(function (data) {
      _gaq.push(['_trackEvent', 'Klik på email', this.href.split("mailto:")[1]]);
    });
});

var settings={
        opacity: 0.6,
        background: '#999',
        zIndex: 1999,
        animateTime: 500,
        minDistanceToViewport: 50,
        closeOnBlockClick: true,
        fixedTop: null,
        fixedLeft: null,
        onClosed: function () {}
 
};


function klausulSoegning() {
  jQuery(".showKlausul img.luk").bind("click", function(){ 
    jQuery(".showKlausul").Co3ModalWindowClose();
  });
  jQuery(".klausul-row img.aaben").each(function() {
    jQuery(this).bind("click",function() { 
      jQuery(this).parent().find(".showKlausul").Co3ModalWindowOpen(settings);
    });
  });
}


function gadw_konv(id,label) {
  var google_conversion_id = id;
  var google_conversion_language = "en";
  var google_conversion_format = "3";
  var google_conversion_color = "ffffff";
  var google_conversion_label = "label";
  var google_conversion_value = 0;
  jQuery('#gadw_img').html('<div style="display:inline;"><img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/'+id+'/?label='+label+'&amp;guid=ON&amp;script=0"/></div>');
}

function getURLParam(strParamName) {
	return getParameterFromLink(strParamName, window.location.href);
}

function getParameterFromLink(strParamName, strLink) {
	var strParam;
	if (strLink.indexOf("?") > -1) {
		var strQueryString = strLink.substr(strLink.indexOf("?")),
			arrQueryString = strQueryString.split("&");
		for (var i = 0; i < arrQueryString.length; i++) {
				if (arrQueryString[i].indexOf(strParamName + "=") > -1) {
					var arrParam = arrQueryString[i].split("=");
					strParam = arrParam[1];
					break;
				}
			}
	}
	return unescape(strParam);
}
