/**
 * news.js
 *
 * @author Paul Horton <phorton@doc-net.com>
 * @author Phil Wastell <pwastell@docnet.nu>
 * @copyright Doctor Net Limited &copy; 2011
 * @package WebSite.WebSite
 */

$(document).ready(function() {
   /**
    * Resize the day height on window resize
    */
   $(window).resize(function() {
      if ($(window).width() < 1100) {
         $('#rel-nws').css({width: "100%"});
         $('#rec-nws').css({width: "100%"});
         $('.window-resize').hide();
         $('.newsArticleImage').css({width: "145px"});
         $('.related_product_image').attr("width", "70");
      } else {
         $('#rel-nws').css({width: "50%"});
         $('#rec-nws').css({width: "50%"});
         $('.window-resize').show();
         $('.newsArticleImage').css({width: "200px"});
         $('.related_product_image').attr("width", "100");
      }
   });
   // Force resize on load
   $(window).resize();
});

function go_to_news_category() {
   obj_selector = document.getElementById('int_news_category_id');
   str_selected_value = obj_selector.options[obj_selector.selectedIndex].value;

   if (str_selected_value != "") {
      window.location = str_selected_value;
   }
}

function go_to_news_archive() {
   obj_selector = document.getElementById('str_news_period');
   str_selected_value = obj_selector.options[obj_selector.selectedIndex].value;

   if (str_selected_value != "") {
      window.location = str_selected_value;
   }
}
