// Making it clean

(function(global,$) {

  /**** New Window Function 
  + Opens tagged links in a new window */

  function newWindow() {
    $('a.view').click(function(){
      window.open(this.href);
      return false;
    });
  }


  /**** Width Function 
  + Font resize based on browser window width */

  function fontScale() {
    var winWidth = $(window).width();
    var fontVal = winWidth / 100;
    var fontMin = 13;
    var fontMax = 23;
    if(fontVal > fontMin && fontVal < fontMax) {
      $('body').css('font-size', fontVal);
    } else if (fontVal < fontMin) {
      $('body').css('font-size', fontMin);
    } else if (fontVal > fontMax) {
      $('body').css('font-size', fontMax);
    }
  }

  function addResize() {
    $(window).resize(function() {
      $(fontScale);
    });
  }


  /**** Usupported Browser Function 
  + Dealing with people who continue to use IE6 and below */

  function notSupported(){
    if($.browser.msie && parseInt($.browser.version) <= 6){ return true; }
    return false;
  }

  if(notSupported()){
    $(function(){
      $("<dl id='upsupported'><dt>Seriously... you're still using IE6?</dt><dd>No, I will not support IE6 (for this site) because it's just plain stupid to continue to care about it.  Granted, I build hack-free sites for clients that will support the monster, but that goes against my personal recommendation. In summary, get a real browser and come back.</dd></dl> ")
      .prependTo("body");
      $('#container').css('display', 'none');
    });	
  }


  /**** Main Thingy 
  + Ya know... just making it a little easier to see what of the above I'm actually using */
  
  function main() {
    fontScale();
    addResize();
    newWindow();
  }

$(main);

})(window,jQuery);
