function changeYearArchive() {
    window.location.href = '/Arkiv.aspx?year=' + document.getElementById('year').value;
}
function changeTemaer() {
    window.location.href = '/Temaer.aspx?year=' + document.getElementById('yearTemaer').value+'&sort='+document.getElementById('sortTemaer').value;
}

function searchNews() {
    window.location.href = '/nyt.aspx?year=' + document.getElementById('year').value + '&month=' + document.getElementById('month').value+'&nrofsearch=100';
}
jQuery(document).ready(function(){
    jQuery("#topSearchTxt, #btnTopSearchSubmit, #articleSearchSubmit").hover(function(search_hover){
        jQuery(this).toggleClass("pushed");
    },
    function(search_remove_class) {
        jQuery(this).removeClass("pushed");
        }
    );
    jQuery('#topSearchTxt').each(function() {
    var default_value = this.value;
    jQuery(this).addClass("search_passive");
    jQuery(this).focus(function() {
        if(this.value == default_value) {
            this.value = '';
            jQuery(this).removeClass("search_passive");
        }
    });
    jQuery(this).blur(function() {
        if(this.value == '') {
            jQuery(this).addClass("search_passive");
            this.value = default_value;
        }
    });
  });

//jQuery.Tabs (Main page)
  jQuery(function() {
    jQuery('#tabs').tabs();
  });

// Clear form (Emner page)
  $.fn.clearForm = function() {
    return this.each(function() {
   var type = this.type, tag = this.tagName.toLowerCase();
   if (tag == 'form')
     return jQuery(':input',this).clearForm();
   if (type == 'text' || type == 'password' || tag == 'textarea')
     this.value = '';
   else if (type == 'checkbox' || type == 'radio')
     this.checked = false;
   else if (tag == 'select')
     this.selectedIndex = -1;
    });
  };

  jQuery("#formEmnerResset").click(function(){
    jQuery("#formEmner input").clearForm();
  });

// Expand all checkboxes (Emner page)
  jQuery("#showAllCheckboxes").toggle(
    function(){
      jQuery(this).toggleClass("expanded");
      jQuery("div.lowPriority").toggleClass("showAllCheckboxes");
    },
    function () {
      jQuery(this).removeClass("expanded");
      jQuery("div.lowPriority").removeClass("showAllCheckboxes");
    }
  );

// Article description [related items block]
  jQuery(".articleInternal .articleRelated .itemDescription").hover(function(){
    jQuery(this).addClass("hover");
  },
  function(){
    jQuery(this).removeClass("hover");
  }
  );

});