  $(document).ready(function(){
             // Reset Font Size
              var originalFontSize = $("html").css("font-size");
                $("#resetFont").click(function(){
                $("html").css("font-size", originalFontSize);
              });
              // Increase Font Size
              $("#fontBigger").click(function(){
                var checksize = $("#fontsize").attr("href");
                
                if(checksize.indexOf("sizeB.css") > 1)
                {
                 $("#fontsize").attr("href","/lib/css/sizeBB.css");
                }
                  if(checksize.indexOf("sizeBB.css") > 1)
                {
                $("#fontsize").attr("href","/lib/css/sizeBBB.css");
                }
                 if(checksize.indexOf("sizeBBB.css") > 1)
                {
                $("#fontsize").attr("href","/lib/css/sizeBBB.css");
                }
                
                /*  
                var currentFontSize = $("html").css("font-size");
                var currentFontSizeNum = parseFloat(currentFontSize, 10);
                var newFontSize = currentFontSizeNum*1.2;
                $("html").css("font-size", newFontSize);
                */
                return false;
              });
              // Decrease Font Size
              $("#fontSmaller").click(function(){
                var checksize = $("#fontsize").attr("href");
                if(checksize.indexOf("sizeB.css") > 1)
                {
                 $("#fontsize").attr("href","/lib/css/sizeB.css");
                }
                  if(checksize.indexOf("sizeBB.css") > 1)
                {
                 $("#fontsize").attr("href","/lib/css/sizeB.css");
                }
                 if(checksize.indexOf("sizeBBB.css") > 1)
                {
                 $("#fontsize").attr("href","/lib/css/sizeBB.css");
                }
               
               /*
                var currentFontSize = $("html").css("font-size");
                var currentFontSizeNum = parseFloat(currentFontSize, 10);
                var newFontSize = currentFontSizeNum*0.8;
                $("html").css("font-size", newFontSize);
                */
                return false;
              });
              
              
                 $("#definitionlist .showdefinition").click(function(){
                    $(this).next(".definition").toggle();
                    return false;
                 });
              
              $("#norwegianlink").click(function() {
                    var completeURL = location.href;
                    var hostname = location.hostname;
                    var host_no = "www.miljostatus.no";
                    var fixedURLtmp = completeURL.replace(hostname,host_no);
                    var fixedURLtmpp = fixedURLtmp.replace("/en/","/no/");
                    var fixedURL = fixedURLtmpp.replace("spraak=EN","spraak=NO");
                    location.href = fixedURL;
                 });
              
                $("#englishlink").click(function() {
                   var completeURL = location.href;
                   var hostname = location.hostname;
                   var host_en = "www.environment.no";
                   var fixedURLtmp = completeURL.replace(hostname,host_en);
                   var fixedURLtmpp = fixedURLtmp.replace("/no/","/en/");
                   var fixedURLtmppp = fixedURLtmpp.replace("spraak=NO","spraak=EN");
                   var fixedURL = fixedURLtmppp.replace("nn=true","n=n");
                   location.href = fixedURL;
              });
            
              
              $("#loadHelp").click(function() {
                 var helppage = $("#loadHelp").attr("href");
                 $("#displayHelp").load(helppage);
                 return false;
              });
              
              $("#toggleFacta").click(function() {
              
             
                if ($("#FaktaBody").css("display") == "block") {
                    $("#FaktaBody").fadeOut();
                }
                else {
                  $("#FaktaBody").fadeIn();
                }
                //$("#FaktaBody").toggle();
                 return false;
              });
              
              
              
              $(".flash").media();
              $(".movie").media();
              
              /*skjuler temamodulen dersom det vises temaoverskrift men ingen linker under. oppstår knyttet til manglende oversatte engelske sider*/
              var temacontainer =  $("#temacontainer li").length;
              if (temacontainer == 0) {
                $("#temacontainer").hide();
              };
              
              
            
              var pageURL = $("#pageURL").attr("href");
              if(pageURL) {
               /* $("#share").html("<a target='_blank' title='Facebook: Del p&aring; facebook' style='padding-top:0px;padding-left:23px;' href='http://www.facebook.com/share.php?u=http://www.miljostatus.no" +pageURL+"'><img style='vertical-align:bottom;' src='/lib/img/facebook_share_icon.gif' border='0'></a>");*/
              }
               
              //tipafriend 
                $(".tipAFriendLink").click(function() {
                    $(".tipBox").toggle();
                    return false;
                });
			});



function show_fylke(selected)
{ 
	window.open(selected.value,"","", "");
}
// Opens a pop-up window. 
 var my_popup;
   function MM_openBrWindow(theURL,winName,features) {
      if (my_popup) {
         if (my_popup.closed){
         }
         else {
            my_popup.close();
         }
      }
      my_popup = window.open(theURL,winName,features);
   } 

