//Javascript file for the Boyd Law Firm, P.C. home page
//written by Daniel Boyd

// Change these to control colors in the menus:
mb = "#033983"; // menu background
mt = "#FFFFCC"; // menu text
ab = "#457CC7"; // active menu background
at = "#FFFFFF"; // active menu text  


//***BROWSER SNIFFING***

  var agt=navigator.userAgent.toLowerCase();
  var is_major = parseInt(navigator.appVersion); 
  var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
            && (agt.indexOf('webtv')==-1)); 
  var is_nav5up = (is_nav && (is_major >= 5)); 
  var is_opera = (agt.indexOf('opera')!=-1);
  var is_ie = ((agt.indexOf('msie')!=-1) && (!is_opera));
  var is_ie5up = ((is_ie) && ((agt.indexOf('msie 5')!=-1) || (agt.indexOf('msie 6')!=-1)));
  
  var is_nav6old = (is_nav && ((agt.indexOf('/6.1')!=-1) || (agt.indexOf('/6.0')!=-1)));
  var is_gecko = (agt.indexOf('gecko')!=-1);
  var is_nav6up = is_gecko && (agt.indexOf('netscape')!=-1);
  var is_nav7 = is_nav6up && (agt.indexOf('/7')!=-1);
  var is_nav62 = is_nav6up && (agt.indexOf('/6.2')!=-1);
  var is_mozilla = is_gecko && !is_nav6up;
  var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
  var is_mac = (agt.indexOf('mac')!=-1);
  var is_linux = (agt.indexOf('linux')!=-1);
  var is_macie = (is_mac && is_ie);
  var is_winie = ((is_ie) && (is_win));
  var is_safari = (agt.indexOf('safari')!=-1);
  var is_konqueror = (agt.indexOf('konqueror')!=-1);
  var is_camino = (agt.indexOf('camino')!=-1);  // chimera project changed name to camino on 3-3-03
  var is_chimera = (agt.indexOf('chimera')!=-1) || is_camino;
  
  //browsers in which menus are disabled:

  //versions of opera prior to 7 do not display menus correctly
  var is_old_opera = ((agt.indexOf('opera')!=-1) && (agt.indexOf('opera 7')==-1));

  //Internet Explorer <= 4.x don't support menus
  var is_old_ie = (is_ie && !is_ie5up);
  
  //Netscape 4.x and lower should stay far away from the menus
  var is_old_netscape = (is_nav && !is_nav5up);

  //OmniWeb has trouble with layers, it seems
  var is_omniweb = (agt.indexOf('omniweb')!= -1);

  //iCab just ignores the layers...
  var is_icab = (agt.indexOf('icab')!= -1);

//disable menus for unsupported browsers
function supported_browser() {
  return !(is_old_opera || is_old_netscape || is_icab || is_omniweb || is_old_ie);
}

 /* function or opening a popup window */
function createWindow(cUrl,cName,cFeatures) {
        var xWin = window.open(cUrl,cName,cFeatures);
        xWin.focus();
}

// open upgrade window if using old versions of IE or Netscape
  var loc=window.location+"";
  if (loc.length < 35) {
  if ((is_nav && !is_nav5up) || (is_ie && !is_ie5up) || (is_icab) || (is_nav6old)) {
  if (is_mac) {
    createWindow("upgrade.html","upgrade_me","statusbar,height=260,width=516,resizable");
	}
  else {
    createWindow("upgrade.html","upgrade_me","statusbar,height=310,width=516,resizable");
  }
  }
  }

//switch colors of the buttons on top of page
function switch_colors(cell,text,switched) {
  var nb,nt;
  var textelm = document.getElementById(text);
  
    if (switched) {nb=mb; nt=mt;}
  else {nb=ab; nt=at;}
  cell.bgColor = nb;
  }

//determines length of window for the shadow image
function shadow_length(gif) {
  //var cell_height = gif.offsetParent.offsetParent.offsetParent.offsetHeight;
  var cell_height = document.getElementById('right_cell').offsetHeight;
  gif.style.height=  cell_height-14;
}

  //redirects browser to 'page'
  function redirect(page) {
    pageText = document.getElementById(page).href;
    window.location=pageText;
  }

