// 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; 

// rollover functions
var rOvers = new Array;

function preloadImage (ref,image) {
  rOvers[ref]           = new Image;
  rOvers[ref].src       = image + ".gif";
  rOvers[ref + "2"]     = new Image;
  rOvers[ref + "2"].src = image + "2.gif";
}

function rollOver (ref) {
  document.images[ref].src = rOvers[ref + "2"].src;
}

function rollOut (ref) {
  document.images[ref].src = rOvers[ref].src;
}


// submit link
function swapSubmit(name) {
  document.getElementById(name + '_submit_link').innerHTML   = 'Submitted...';
  document.getElementById(name + '_submit_link').style.color = '#99BBFF';
}


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


// bookmark site
function bookmark_site() {
  var bookmarkurl   = "http://www.pellys.co.uk";
  var bookmarktitle = "Pellys Solicitors";
  if (isIE || isNetscape6) {
    window.external.AddFavorite(bookmarkurl,bookmarktitle);
  }
}

// change page from drop menu
function changePage (menu) {
  var url = menu.options[menu.selectedIndex].value;

  if (url) {
    document.location.href = url;
  }
}