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 getURLVar(urlVarName) {
	//divide the URL in half at the '?'
	var urlHalves = String(document.location).toLowerCase().split('?');
	var urlVarValue = '';
	if(urlHalves[1]){
		//load all the name/value pairs into an array
		var urlVars = urlHalves[1].split('&');
		//loop over the list, and find the specified url variable
		for(i=0; i<=(urlVars.length); i++){
			if(urlVars[i]){
				//load the name/value pair into an array
				var urlVarPair = urlVars[i].split('=');
				if (urlVarPair[0] && urlVarPair[0] == urlVarName) {
				//I found a variable that matches, load it's value into the return variable
				urlVarValue = urlVarPair[1];
				}
			}
		}
	}
	return urlVarValue;   
}

function highlightTabs(imagePath) {

	currenttag= getURLVar('tag');
	currentdisplay= getURLVar('blog');
	currentpage= getURLVar('page_id');
	currentpath=location.pathname;
	
	if (currenttag == 'lifestyle') {
	  level1button = 'lifestyle';	  
	}
	else if (currentpage == '317') {
	  level1button = 'galleries';	  
	}
	else if (currenttag == 'video') {
	  level1button = 'video';	  
	}	
	else if (currentdisplay == 'true'){
		level1button ='blog'; //set color bar as well
	}
	else if (currentpath.indexOf('/') != -1){
		level1button ='home'; //set color bar as well
	}


	//alert(imagePath);
	// replace color bar 
	// replace level1buttondown and over state images
	if(level1button)
	{
		document.images['button_'+level1button].src = imagePath+'/images/button_'+level1button+'_selected.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></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 QTWindow2(url) {
    //newwin = window.open('', imgn, 'height='+(h+80)+',width='+(w+30)+',resizable=yes,scrollbars=no');
    newwin = window.open('', 'QTWin2','toolbar=0,location=0,directories=0,stat        us=0,menubar=0,scrollbars=0,resizable=0,width=350,height=290');
newwin.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <title>XHTML Quicktime Object</title> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /> <style type=\"text/css\"> <!-- /* object stuff here */ /* hides the second object from all versions of IE */ * html object.mov { display: none; } /* displays the second object in all versions of IE apart from 5 on PC */ * html object.mov/**/ { display: inline; } /* hides the second object from all versions of IE >= 5.5 */ * html object.mov { display/**/: none; } --> </style> </head> <body><p align=\"center\"><object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" width=\"320\" height=\"260\"> <param name=\"src\" value=\""+url+"\" /> <param name=\"controller\" value=\"true\" /> <object type=\"video/quicktime\" data=\""+url+"\" width=\"320\" height=\"260\" class=\"mov\"> <param name=\"controller\" value=\"true\" /> Error text.  </object> </object></p> </body> </html>");
    newwin.focus();
}   // end function QTWindow2()

function PopWindow(url,w,h)
{
    var features = 
        'width='        + w +
        ',height='      + h +
        ',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=yes';
	//whatsnewwin = window.open(url,'WhatsNewWin','features');
	//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 = window.open(url,'WhatsNewWin',"toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,width="+w+",height="+h+",scrollbars=yes");
	whatsnewwin.focus();	
}

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

