$(document).ready(function() {
  
  // NAVIGATION :: LINKS :: makes the entire li element (red background) a clickable object
  $('.nav_li_link').click(function()
  {
    var link = $(this).html();
    link = link.split('"');
    link = link[1];
    
    window.location = link;
  });
  
  // TAB SWITCHER ON WEAPONS PAGES
  $('.fac_tab').click(function()
  {
    if ($(this).get(0) != $('.fac_tab_active').get(0)) 
    {
      // build string for currently selected box so we can hide it
      var cur_box = $('.fac_tab_active').attr('id');
      cur_box = cur_box.substr(0,4) + '_box';
      
      // build string for clicked box so we can show it
      var box = $(this).attr('id');
      box = box.substr(0,4) + '_box';
      
      // change the tab to reflect the newly selected box
      $('.fac_tab_active').removeClass('fac_tab_active');
      $(this).addClass('fac_tab_active');
      
      // hide the current box and show the newly selected box
      $('#'+cur_box).addClass('display_none');
      $('#'+box).removeClass('display_none');
      
      // add flexcroll scrollbars
      fleXenv.initByClass("flexcroll");
      }
  });
  
  $('.pro_tab').click(function()
  {
    if ($(this).get(0) != $('.pro_tab_active').get(0)) 
    {
      // build string for currently selected box so we can hide it
      var cur_box = $('.pro_tab_active').attr('id');
      cur_box = cur_box.substr(0,4) + '_box';
      
      // build string for clicked box so we can show it
      var box = $(this).attr('id');
      box = box.substr(0,4) + '_box';
      
      // change the tab to reflect the newly selected box
      $('.pro_tab_active').removeClass('pro_tab_active');
      $(this).addClass('pro_tab_active');
      
      // hide the current box and show the newly selected box
      $('#'+cur_box).addClass('display_none');
      $('#'+box).removeClass('display_none');
      
      // add flexcroll scrollbars
      fleXenv.initByClass("flexcroll");
      }
  });
  
  $('.fin_tab').click(function()
  {
    if ($(this).get(0) != $('.fin_tab_active').get(0)) 
    {
      // build string for currently selected box so we can hide it
      var cur_box = $('.fin_tab_active').attr('id');
      cur_box = cur_box.substr(0,4) + '_box';
      
      // build string for clicked box so we can show it
      var box = $(this).attr('id');
      box = box.substr(0,4) + '_box';
      
      // change the tab to reflect the newly selected box
      $('.fin_tab_active').removeClass('fin_tab_active');
      $(this).addClass('fin_tab_active');
      
      // hide the current box and show the newly selected box
      $('#'+cur_box).addClass('display_none');
      $('#'+box).removeClass('display_none');
      
      // add flexcroll scrollbars
      fleXenv.initByClass("flexcroll");
      }
  });
  
  
  
  $('.specs_link').mouseenter(function()
  {
    $('#specs_box').fadeIn(200);
  });
  $('.specs_link').mouseleave(function()
  {
    $('#specs_box').fadeOut(600);
  });
  // DOWNLOADS SWITCHER ON DATASHEETS/MANUALS/CATALOGS PAGES
  $('.active_text').click(function()
  {
    // only execute if user clicked an 'inactive' link
    if(!$(this).is('.active_selected'))
    {
      // find the id of the link and box that are currently selected
      var link_rmv = $('.active_selected').attr('id');
      var box_rmv =  $('.active_box').attr('id');
      
      // get the id of the link and box that are about to become the active ones
      var link_add = $(this).attr('id');
      var box_add = link_add + '_downloads';
      
      $('#'+link_rmv).removeClass('active_selected');
      $('#'+box_rmv).removeClass('active_box').addClass('inactive_box');
      
      $('#'+link_add).addClass('active_selected');
      $('#'+box_add).addClass('active_box').removeClass('inactive_box');
    }
  });
  
});

$(document).ready(function() {

    $("#sizeUp").click(function() {

        $("body").css("font-size","150%");

    });

    $("#normal").click(function() {

        $("body").css("font-size","100%");

    })

    $("#sizeMup").click(function() {

        $("body").css("font-size","180%");

    })
});
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
