  var screenWidth = screen.availWidth;
  var screenHeight = screen.availHeight;
// base variables for browser detection...

    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();
    var appVer = navigator.appVersion.toLowerCase();

    // *** BROWSER VERSION ***

    var is_minor = parseFloat(appVer);
    var is_major = parseInt(is_minor,10);

    var is_opera = (agt.indexOf("opera") != -1);

    // Note: On IE, start of appVersion return 3 or 4
    // which supposedly is the version of Netscape it is compatible with.
    // So we look for the real version further on in the string

    var iePos  = appVer.indexOf('msie');
    if (iePos !=-1) {
       is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
       is_major = parseInt(is_minor,10);
    }

    // ditto Konqueror
                                      
    var is_konq = false;
    var kqPos   = agt.indexOf('konqueror');
    if (kqPos !=-1) {                 
       is_konq  = true;
       is_minor = parseFloat(agt.substring(kqPos+10,agt.indexOf(';',kqPos)));
       is_major = parseInt(is_minor,10);
    }                                 

    var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
    var is_khtml  = (is_safari || is_konq);

    var is_gecko = ((!is_khtml)&&(navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false;
    var is_gver  = 0;
    if (is_gecko) {is_gver=navigator.productSub;}

    var is_moz   = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                    (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                    (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                    (is_gecko) && 
                    ((navigator.vendor==="")||(navigator.vendor=="Mozilla")));
    var is_fb = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                 (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                 (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                 (is_gecko) && (navigator.vendor=="Firebird"));
    var is_fx = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                 (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                 (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                 (is_gecko) && (navigator.vendor=="Firefox"));
    if ((is_moz)||(is_fb)||(is_fx)) {  // 032504 - dmr
       var is_moz_ver = (navigator.vendorSub)?navigator.vendorSub:0;
       if(!(is_moz_ver)) {
           is_moz_ver = agt.indexOf('rv:');
           is_moz_ver = agt.substring(is_moz_ver+3);
           var is_paren   = is_moz_ver.indexOf(')');
           is_moz_ver = is_moz_ver.substring(0,is_paren);
       }
       is_minor = is_moz_ver;
       is_major = parseInt(is_moz_ver,10);
    }
   var is_fb_ver = is_moz_ver;
   var is_fx_ver = is_moz_ver;

    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)  && 
				(agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)  && 
				(agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)  && 
				(!is_khtml) && (!(is_moz)) && (!is_fb) && (!is_fx));

    var is_ie   = ((iePos!=-1) && (!is_opera) && (!is_khtml));

// KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
    // or if this is the first browser window opened.  Thus the
    // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.

    var is_aol   = (agt.indexOf("aol") != -1);

    var is_webtv = (agt.indexOf("webtv") != -1);
    
    // new 020128 - abk
    
    var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
    var is_AOLTV = is_TVNavigator;



//  NS =  (document.layers) ? 1 : 0;
//  IE =  (document.all) ? 1 : 0;
  var MOZILLA = is_moz || is_fx || is_fx;
  var NS = (is_nav || is_moz);
  var IE = is_ie;
  var DOM = (document.getElementById) ? 1:0;
  var OPERA = is_opera;
  
  
function GT_findObj(n, d) { //v3.0
  var p,i,x;  
  if(!d) {d=document;}
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) {x=d.all[n]; }
  for (i=0;!x&&i<d.forms.length;i++) {x=d.forms[i][n];}
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) {x=GT_findObj(n,d.layers[i].document);}
  return x;
}

function GT_findObj_v4(n, d) { //v4.0
  var x;
  if (!d) {d=document;}
  if (d.getElementById) {
    x = d.getElementById(n); } 
  return x;
}

function GT_FindObject(objName,  parentObj) {
  var i,tempObj="",found=false,curObj = "";
  if (IE) {curObj = document.all[objName];}
  if (!curObj && DOM) {curObj = document.getElementById(objName);}
  if (!curObj && NS) {
    parentObj = (parentObj !== null)? parentObj.document : document;
    if (parentObj[objName] !== null) {curObj = parentObj[objName];} //at top level
    else { //if in form
      if (parentObj.forms) for (i=0; i<parentObj.forms.length; i++) {  //search level for form object
        if (parentObj.forms[i][objName]) {
          curObj = parentObj.forms[i][objName];
          found = true; break;
      } }
      if (!found && NS && parentObj.layers && parentObj.layers.length > 0) {
        parentObj = parentObj.layers;
        for (i=0; i<parentObj.length; i++) { //else search for child layers
          tempObj = MM_intFindObject(objName,parentObj[i]); //recurse
          if (tempObj) { curObj = tempObj; break;} //if found, done
  } } } }
  return curObj;
}


function GT_Show(objName) {
  var obj = GT_findObj_v4(objName);
  if (obj.style.visibility != 'visible'){
	obj.style.visibility = 'visible';
	obj.style.display = 'inline';}
  else{
	obj.style.visibility = 'hidden';
	obj.style.display = 'none';}	
}

function GT_Hide(objName) {
  var obj = GT_findObject(objName);
  if (NS || MOZILLA) {
    obj.visibility = 'hide';
  } else {
    obj.style.visibility = 'hidden';
    obj.style.display = 'none';
  }
}

function clearRadios(objName) {
  var obj = GT_findObj(objName);
    var i;
    if (NS || MOZILLA) {

    } else {
      for (i=0;i<obj.length;i++) {
        obj[i].checked = false;
      }
    }
}


function toggleAll(element, formName, startingWith)
{
  var formElement = GT_findObj(formName);
  var elementCnt = formElement.elements.length;
  for (var i=0; i<elementCnt; i++)
  {
     var thisElement = formElement.elements[i];
     if (thisElement.name.indexOf(startingWith) === 0){
       thisElement.checked = element.checked;}
  }
}

function GT_min(value1, value2) {
  if (value1 < value2) {return value1}
  else {return value2;}
}

function GT_max(value1, value2) {
  if (value1 > value2) {return value2}
  else {return value1;}
}

// resizes a window to the specified size and optionally centers it on
// the screen
function GT_resizeWindow(theWindow, newWidth, newHeight, doCenter) {
  var theWidth = GT_min(newWidth, screenWidth);
  var theHeight = GT_min(newHeight, screenHeight);
  var leftPos = (screenWidth-theWidth)/2;
  var topPos = (screenHeight-theHeight)/2;

  if (NS || MOZILLA) {
    theWindow.innerHeight = newHeight;
    theWindow.innerWidth = newWidth;

  } else {
    theWindow.resizeTo(theWidth, theHeight);
    if (doCenter){
      theWindow.moveTo(leftPos, topPos);}
  }
}

// opens a popup window with the specified width and height
function GT_openPopupWindow(name, newWidth, newHeight) {
  var theWidth = GT_min(newWidth, screenWidth);
  var theHeight = GT_min(newHeight, screenHeight);
  var leftPos = (screenWidth-theWidth)/2;
  var topPos = (screenHeight-theHeight)/2;
  var newWindow;

  if (OPERA){
    newWindow = window.open("", name, "resizable=yes,scrollbars=yes,height=" + theHeight + ",width=" + theWidth);}
  else{
    newWindow = window.open("", name, "resizable=yes,scrollbars=yes,height=" + theHeight + ",width=" + theWidth + ",left=" + leftPos + ",top=" + topPos, "");}
    
  return newWindow;
}

function cssText(sourceElement) {
  var cs; 
  if (IE) {cs = sourceElement.currentStyle;}
  var s='';
  if (cs) {
    s = 'style="font-family:' + cs.fontFamily + 
        '; font-size:' + cs.fontSize + 
        '; font-style:' + cs.fontStyle + 
        '; color:' + cs.color +
        '; line-height:' + cs.lineHeight + 
        '"';       
  }
  return s;
}

function wait(msecs)
{
	var start = new Date().getTime();
	var cur = start;
	while(cur - start < msecs)
	{cur = new Date().getTime();}
} 

// writes the contents of the specified element to the output window,
// sets the window title and copies the stylesheet from the current document
function GT_copyToWindow(sourceElement, outputWindow, windowTitle) {  
  outputWindow.document.open();
  outputWindow.document.writeln("<html><head>");
  outputWindow.document.writeln("<title>" + windowTitle + "</title>");
  // outputWindow.document.writeln('<SCRIPT language=Javascript src="/js/slideshowClass.js"></SCRIPT>');
  // write the stylesheets, too
  if (IE) {
    for (var i=0;i<document.styleSheets.length; i++) {
      outputWindow.document.writeln('<link rel="stylesheet" href="' + document.styleSheets.item(i).href + '" type="text/css">');
    }
  }  
  outputWindow.document.writeln("<script language='Javascript'>var IE=(navigator.appName=='Microsoft Internet Explorer');</script></head><body>");
  outputWindow.document.writeln("</head><body><div id='DirectEditWrapper' contentEditable='false' />");  
  outputWindow.document.writeln('<div id="copydiv" style="position:absolute;" ' + cssText(sourceElement) + '>'); 
  outputWindow.document.writeln(sourceElement.innerHTML);
  outputWindow.document.writeln('</div>');
//  outputWindow.document.writeln('<script language=Javascript src="/js/ieupdate.js" /> <script> ReloadObjects(); </script>');
  outputWindow.document.writeln("</body></html>");
  wait(100);
  outputWindow.document.close();  
}

// creates a new popup window, sized to fit the content of theBlock, and
// writes the content of theBlock to the window, and centers it on the screen.
function GT_showBlockInWindow(theBlock, theWindow, windowName, windowTitle) {
  var e = window.event;
  if ((e)&&(e.type=='click')){
    e.cancelBubble = true;}

  if ((theWindow) && (theWindow.close)){
    theWindow.close();}
  
  // var resultWindow = GT_openPopupWindow(windowName, 300, 10);
  var resultWindow; 

  // accept either the object id, or the object itself...
  var showBlock = null;
  if (!theBlock.substr){
    showBlock = theBlock;}
  else{
    showBlock = GT_findObj_v4(theBlock);}

  /* 
  if ((showBlock.style.width) && (showBlock.style.height)) 
  {
    var winwidth = showBlock.style.width;
    var winheight = showBlock.style.height;
    winwidth = winwidth.replace("px", "");
    winheight = winheight.replace("px", "");
    resultWindow = GT_openPopupWindow(windowName, winwidth, winheight);
  }
  else
    resultWindow = GT_openPopupWindow(windowName, 300, 10);
  */
  resultWindow = GT_openPopupWindow("", 300, 10);
  
  GT_copyToWindow(showBlock, resultWindow, windowTitle);
  
  //if (resultWindow.document.body)
  //  GT_resizeWindow(resultWindow, resultWindow.document.body.scrollWidth + 40, resultWindow.document.body.scrollHeight + 35, true);  


  if (resultWindow.document.getElementById("copydiv"))
  {
    resultWindow.moveTo((screen.width - resultWindow.document.getElementById("copydiv").clientWidth)/2, (screen.height - resultWindow.document.getElementById("copydiv").clientHeight)/2);
    resultWindow.resizeTo(resultWindow.document.getElementById("copydiv").clientWidth + 40, resultWindow.document.getElementById("copydiv").clientHeight + 135);
  }
  
  resultWindow.focus();

  return resultWindow;
}

function GT_showBlockInLayer(theBlock, /*  Maybe a event object or a boolean value */event, /*  Maybe a event object or a boolean value */ doShow) {
  
  var layerNode = GT_findObj_v4(theBlock+"_display");
  var showBlock = GT_findObj_v4(theBlock);
  var e;
  var x = typeof event; 
 
  if (x == "object")
  { 
    if (NS || MOZILLA){ e = event;}
	else { e = window.event;}
  }
  else // x == "boolean"
  {
	e = null;
//	doShow = false;
  }

  if ((e)&&(e.type=='click')){
    e.cancelBubble = true;}

   // If doShow is a event object, it still return true because it's not null. It means need to show the layer	
   if (doShow) {
    if (!layerNode) {
      layerNode = document.createElement("DIV");
      layerNode.id = theBlock + "_display";   
      document.body.appendChild(layerNode);
    }
  
    layerNode.style.position = "absolute"; 
    if (showBlock) {
    	layerNode.style.width = showBlock.style.width;
    	layerNode.style.height = showBlock.style.height;
		if (!layerNode.style.width) {
		  layerNode.style.width = "auto";}
		if (!layerNode.style.height) {
		  layerNode.style.height = "auto";	}
    }
    
    if (e) {	
    	if (NS || MOZILLA){    		
    		// layerNode.style.left = e.pageX + document.body.scrollLeft;    		
			layerNode.style.left = e.pageX ;
    		layerNode.style.top = e.pageY;    		
    	}
    	else{
    		layerNode.style.posLeft = e.clientX + document.body.scrollLeft;
    		layerNode.style.posTop = e.clientY + document.body.scrollTop;
    	}    	
    }
    layerNode.style.visibility = "visible";
    layerNode.style.backgroundColor = "#EEEEEE"; 
  
    layerNode.innerHTML = showBlock.innerHTML;
  
    return layerNode;
  } else {
    if (layerNode) {
      layerNode.style.visibility = "hidden";
      layerNode.removeNode(true);
    } 
    return null;
  }
}

/*
function getFlashVersion(latestFlashVersion) {
	var agent = navigator.userAgent.toLowerCase();
	var flashVersion;
	
	// NS3 needs flashVersion to be a local variable
	if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
		flashVersion = 0;
	}

	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins !== null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') {
			for (var i = latestFlashVersion; i >= 3; i--) {
				if (flashPlugin.description.indexOf(i + '.') != -1) {
					flashVersion = i;
					break;
				}
			}
		}
	}
	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
//	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion,10) >= 4 && agent.indexOf("win")!=-1) {
		document.writeln('<script language="VBScript" type="text/vbscript">');
		document.writeln('On Error Resume Next');
		document.writeln('Dim obFlash');
		document.writeln('For i = ' + latestFlashVersion + ' To 3 Step -1');
		document.writeln('	Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i)');
		document.writeln('	If IsObject(obFlash) Then');
		document.writeln('		flashVersion = i');
		document.writeln('		Exit For');
		document.writeln('	End If');
		document.writeln('Next');
		document.writeln('</script>');
	}
	return flashVersion;
}
*/
