var general = general || {};

general = {

    vars: {},
    init: function () {
        general.eraseInput.init();
        general.print.init();
        general.collapsible.init();
    },
    eraseInput: {
        init: function () {

            $('#search >  input').focus(function () {
                if ($(this).val() === $(this).attr('title')) {
                    $(this).val("");
                }
            }).blur(function () {
                if ($(this).val() === "") {
                    $(this).val($(this).attr('title'));
                }
            });
            $("form").submit(function () {
                if ($('#search > input').val() == $('#search > input').attr('title')) {
                    $('#search > input').val("");

                }
            });
        }
    },
    print: {
        init: function () {
            $('.print').show().click(function () {
                window.print();
                return false;
            });
        }
    },
    collapsible: {
        init: function () {
            // Bind the link to toggle the slide.
            $(".collapseHeading").click(
            function (e) {
                e.preventDefault();
                if (!$(this).hasClass('active')) { // not expanded, so expand it
                    $(".collapseContainer").slideDown(200).prev('.collapseHeading').addClass('active');
                    $(this).addClass('active').html('Visa mindre');
                } else { // expanded, collapse it
                    $(".collapseContainer").slideUp(200).prev('.collapseHeading').removeClass('active');
                    $(this).removeClass('active').html('L&auml;s mer');
                }
            }
            );
        }
    }


}
 $(document).ready(function() {
   general.init();
  
  });
 
