﻿$(document).ready(function() {
  var screenwidth = 0;
  if (document.documentElement) {
    screenwidth = document.documentElement.offsetWidth;
    //dimensions.width = document.documentElement.offsetWidth;
    //dimensions.height = document.documentElement.offsetHeight;
  } else if (window.innerWidth && window.innerHeight) {
    screenwidth = window.innerWidth;
    //dimensions.width = window.innerWidth;
    //dimensions.height = window.innerHeight;
  }

  if (screenwidth > 1600) {
    $('form').prepend('<div class="bigguy"></div><div class="biggirl"></div>');
  }

  $('.topnav').superfish();

  $('.masthead .topright ul li .yarrows').hover(function() {
    $(this).parents('li').addClass('on');
  }, function() {
    $(this).parents('li').removeClass('on');
  });

  $('.masthead .topright .signin a').removeAttr('href').click(function() {
    $('#loginTarget').npModal({
      enableOverlayClose: true,
      width: '500px'
    });
    $('input.login-username').focus();
  });

  $('.masthead .topright .cheese').hover(function() {
    $(this).siblings('.cheesebubble').show();
  }, function() {
    $(this).siblings('.cheesebubble').hide();
  });

  $('.masthead .topnav h4 a').hover(function() {
    $(this).parents('h4').addClass('on');
  }, function() {
    $(this).parents('h4').removeClass('on');
  });

  //  $('.sidenav li').mouseover(function(){
  //    $('.sidenav > li').removeClass('on');
  //    $(this).addClass('on');
  //    $(this).find('.subnav:first').show();
  //  }).mouseout(function(){
  //    $(this).removeClass('on');
  //    $(this).find('li').removeClass('on');
  //  });

  $('.sidenav li:has(.subnav)').click(function() {
    $('.sidenav li').removeClass('on');
    $(this).addClass('on');
    $(this).find('.subnav:first').show();
  });

});

//-- sIFR --//
if(typeof sIFR == "function"){
  sIFR.bHideBrowserText = true;
  sIFR.setup();
};