var opSys;
var MacNS = false;

var level1button = '';
var level2button = '';

opSys = checkOS();
if ((opSys.indexOf('Mac') != -1) && (navigator.appName.indexOf('Netscape') != -1))
  MacNS = true;
//if (opSys.indexOf('Irix') != -1)
//  document.write('<link rel="stylesheet" href="/randh_format_sgi.css" type="text/css">');

function checkOS() {
  if(navigator.userAgent.indexOf('IRIX') != -1)
    { var op = "Irix"; }
  else if(navigator.userAgent.indexOf('Win') != -1)
    { var op = "Win"; }
  else if(navigator.userAgent.indexOf('Mac') != -1)
    { var op = "Mac"; }
  else { var op = "other"; }
  return op;
}

function highlightTabs() {

currentpath=location.pathname;

if (currentpath.indexOf('/inside_randh/') != -1) {
  level1button = 'd';
  colorBar = 'b1_5';
  if (currentpath.indexOf('company_') != -1) level2button= 'a';
  else if (currentpath.indexOf('opportunities_') != -1) level2button= 'b';
  else if (currentpath.indexOf('press_') != -1) level2button= 'c';
  else if (currentpath.indexOf('outreach_') != -1) level2button= 'd';
  else if (currentpath.indexOf('facilities_') != -1) level2button= 'e';
  else level2button = 'a';
  }
else 
if (currentpath.indexOf('/film/') != -1) {
  level1button = 'e';
  colorBar = 'b1_6';
  if (currentpath.indexOf('main_') != -1) level2button= 'a';
  else if (currentpath.indexOf('credits_') != -1) level2button= 'b';
  else if (currentpath.indexOf('execs_') != -1) level2button= 'c';
  else if (currentpath.indexOf('vfx_') != -1) level2button= 'd';
  else if (currentpath.indexOf('scanning_') != -1) level2button= 'e';
  else if (currentpath.indexOf('theme_') != -1) level2button= 'f';
  else level2button = 'a';
  }
else 
if (currentpath.indexOf('/directors/') != -1) {
  level1button = 'f';
  colorBar = 'b1_7';
  }
else 
if (currentpath.indexOf('/commercials/') != -1) {
  level1button = 'g';
  colorBar = 'b1_8';
  if (currentpath.indexOf('main_') != -1) level2button= 'a';
  else if (currentpath.indexOf('animation_') != -1) level2button= 'b';
  else if (currentpath.indexOf('editorial_') != -1) level2button= 'c';
  else if (currentpath.indexOf('fx_') != -1) level2button= 'd';
  else level2button = 'a';
  }
else 
if (currentpath.indexOf('/design/') != -1) {
  level1button = 'h';
  colorBar = 'b1_9';
  }

else
if (currentpath.indexOf('/contact') != -1) {
  level1button = 'c';
  colorBar = 'b1_9';
  }
else
if (currentpath.indexOf('/site_map') != -1) {
  level1button = 'b';
  colorBar = 'b1_9';
  }
else level1button ='a'; //set color bar as well

// replace color bar 
document.images['color1'+level1button].src = 'images/color1'+level1button+'-button1'+level1button+'_down.gif';

// replace level1buttondown and over state images
document.images['button1'+level1button].src = 'images/button1'+level1button+'-click.gif';

// replace level2buttondown and over state images 
if(level2button)
{
	document.images['button2'+level2button].src = 'images/button2'+level2button+'-click.gif';
}

  }  // end highlightTabs()
 //* function displayImg(imgp, imgn, w, h)                                                   */
 //*    displays an image in a new window with a black BG                                    */
 //*    imgp: path to image file, imgn: title of new window, w/h: width/heigth of image      */
  function displayImg(imgp, imgn, w, h) {
    newwin = window.open('', imgn, 'height='+(h+80)+',width='+(w+30)+',resizable=yes,scrollbars=no');
    newwin.document.write("<html><head><title>"+imgn+"</title><link rel='stylesheet' "+
      "href='/randh_format.css' type='text/css'></head><body bgcolor='#000000' "+"text='#eeeeee'"+
      "alink='#aaaaaa' vlink='#eeeeee' link='#eeeeee'><center><img src='"+imgp+
      "'border=0><br>&nbsp;<br><a href=\"Javascript:window.close()\">"+ 
      "<span class='content_body'>Close window</span></a></center><script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-439316-1";
urchinTracker();
</script></body></html>");
    newwin.focus();

    }   // end function displayImg()

function QTWindow(url)
{
	//qtwin = window.open(url,'QTWin','width=320,height=250');
	qtwin = window.open(url,'QTWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=320,height=260');
	qtwin.focus();	
}

function PopWindow(url,w,h)
{
	whatsnewwin = window.open(url,'WhatsNewWin','toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,width=300,height=400,scrollbars=yes');
        //can add 20 px if i need close window
	//whatsnewwin = window.open(url,'WhatsNewWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=500');
	whatsnewwin.focus();	
}

function updateParent(url)
{
    opener.document.location = url;
    opener.focus();
}

