// get browser
var agent       = navigator.userAgent.toLowerCase(); 
var isIE        = (navigator.appName == "Microsoft Internet Explorer") ? true : false;
var isNetscape6 = (!document.all && !document.layers && navigator.appName == "Netscape" && parseInt(navigator.appVersion) >=5) ? true : false;
var isMac       = (agent.indexOf("mac") != -1) ? true : false;
var isIE4       = (agent.indexOf("msie") != -1 && agent.indexOf("4.0;") != -1) ? true : false;
var isNetscape  = (agent.indexOf("mozilla") != -1 && agent.indexOf("4.") != -1) ? true : false;
var win2000     = ((agent.indexOf("winnt") != -1) || (agent.indexOf("windows nt 5.0") != -1)) ? true : false; 
var winXP       = ((agent.indexOf("winnt") != -1) || (agent.indexOf("windows nt 5.1") != -1)) ? true : false; 
var isWin       = (agent.indexOf("windows") != -1) ? true : false;
var isMoz       = (agent.indexOf("gecko") != -1) ? true : false;


// popup functions
function open_popup (ref, url, width, height, scroll, menu, toolbar, location, status, resize) {
  window.open(url,
              ref,
              "menubar="    + ((menu) ? 'yes' : 'no')  + ", " +
              "scrollbars=" + ((scroll) ? 'yes' : 'no')  + ", " +
              "toolbar="    + ((toolbar) ? 'yes' : 'no')  + ", " +
              "status="     + ((status) ? 'yes' : 'no')  + ", " +
              "location="   + ((location) ? 'yes' : 'no')  + ", " +
              "resizable="  + ((resize) ? 'yes' : 'no')  + ", " +
              "width=" + width + ", height=" + height
             );
}


// rollover functions
var rollovers = new Array;

function preload_image (ref, image) {
  rollovers[ref]           = new Image;
  rollovers[ref].src       = image + '.gif';
  rollovers[ref + '_over']     = new Image;
  rollovers[ref + '_over'].src = image + '_over.gif';
}

function roll_over (ref) {
  document.images[ref].src = rollovers[ref + '_over'].src;
}

function roll_out (ref) {
  document.images[ref].src = rollovers[ref].src;
}

function count_ps_text (textarea) {
  var limit = 105;

  if (textarea.value.length > limit) {
    textarea.value = textarea.value.substring(0, limit);
    alert('Your P.S. message must be 105 characters or shorter');
  }
}