﻿$(document).ready(function(){
  // Menu animation
   $(document).ready(function(){
         $('#nav_sub').css('min-height',$('#level2').height());
        // var bg = $('.bi').css('background-image');
        //$('.bi').css('background-image','none');
        $('#nav_sub').css('float','none');//.hide();
        $('#nav_sub ul').css('display', 'block');      
        $('#level3').hide();
        $('#level4').hide();
        $('#level2 li').css('display', 'block').show();
        //$('.bi').css('background-image',bg);
        $('#nav_sub').show("slide",{ direction: "left" }, 1000).children("#level3").fadeTo(1500, 1).show("slide",{ direction: "left" }, 1000).siblings("#level4").fadeTo(2250, 1).show("slide",{ direction: "left" }, 1000);
  	    return false;
  });
  
    // Reset Font Size
    var originalFontSize = $('html').css('font-size');               
    $("p.textstorlek").click(function(){
        $('html').css('font-size', originalFontSize);
    });
    // Increase Font Size
    $("a.plus").click(function(){
        var currentFontSize = $('html').css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum*1.1;
        $('html').css('font-size', newFontSize);
        return false;
    });
    // Decrease Font Size
    $("a.minus").click(function(){
        var currentFontSize = $('html').css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum*0.95;
        $('html').css('font-size', newFontSize);
        return false;
    });
    //Print page
    $("#contentfooter li a.printpage").click(function(){
        window.print();
        return false;
    });
    //Show/Hide Contact form
     $('#contentfooterfunctions table tr:first-child td:last-child').remove();
    $('#contentfooterfunctions table tr:first-child td:first-child').attr("colSpan","2");
    $('#contentfooterfunctions').hide(); // Hide even though it's already hidden
    $('#contentfooter li a.sharepage').click(function() {
          $(this).toggleClass("open");
          $('#contentfooterfunctions').slideToggle("slow"); // First click should toggle to 'show'
          return false;
       });
    //Show/Hide Footer links
    $('#sitefooterfunctions').hide(); 
    $('a#footerbutton').click(function() {
          $(this).toggleClass("open");
          $('#sitefooterfunctions').slideToggle("fast"); 
          return false;
       });
       var stext = $('.search p input').val();
       $('.search p input').focus(function() {
          $(this).val("");
          return false;
       }); 
       $('.search p input').blur(function() {
            if($(this).val() == "")
            {
              $(this).val(stext);
             }
          return false;
       }); 
        
       
});