IsNavIE = (navigator.appName == "Microsoft Internet Explorer");
IsNavNetscape = (navigator.appName == "Netscape");

HRhover = 
  ((IsNavNetscape && (parseInt(navigator.appVersion) >= 3 )) || 
   (IsNavIE && (parseInt(navigator.appVersion) >= 4 ))); 

function preloadimg(img) 
{
  var a=new Image(); a.src=img; return a; 
}

var pload1 = preloadimg("image/bHome1.gif");
var pload2 = preloadimg("image/bKatalog1.gif");
var pload3 = preloadimg("image/bAbout1.gif");

function ButtonStatus( name,stext )
{
 this.Name = name;
 this.Status = stext;
}

var MaxButton = 3;
var ButtonTab = new Array(MaxButton);
ButtonTab[0] = new ButtonStatus( "Home","zur Home-Page von Hofmann + Ruppertz" );
ButtonTab[1] = new ButtonStatus( "About","Wir über uns" );
ButtonTab[2] = new ButtonStatus( "Katalog","zum Musterkatalog" );

function OverButton(bname)
{
  if (HRhover) 
  {
    grsrc = 'image/b'+bname+'1.gif';
    document[bname].src=grsrc; 
  }
  ba = 0;
  while ((ba < MaxButton) && (bname != ButtonTab[ba].Name))
	ba++;
  if (ba < MaxButton)
    window.status = ButtonTab[ba].Status;
  return true;
}

function OutButton(bname)
{
  if (HRhover) 
  {
    grsrc = 'image/b'+bname+'0.gif';
    document[bname].src=grsrc; 
  }
  window.status = window.defaultStatus;
  return true;
}

function ShowKatalog( fname )
{
    nf=window.open('muster_frame.htm?'+fname,'Katalog',"directories=no,resizable=yes,scrollbars=yes,toolbar=no,location=no,status=yes,menubar=yes" ); 
    nf.focus();
    return false;
}

function OverOut()
{
  window.status = window.defaultStatus
  return true;
}

function UrlWithoutHash( urltxt )
{
//alert("UrlWithoutHash")
  lang = urltxt.indexOf("#");
  if (lang > 0)
	urltxt = urltxt.substring( 0,lang );
  lang = urltxt.indexOf("?");
  if (lang < 0)
	return urltxt;
  return urltxt.substring( 0,lang );
}

function UrlFileName( urltxt )
{
//alert("UrlWithoutHash")
  lang = urltxt.lastIndexOf("/");
  if (lang > 0)
	urltxt = urltxt.substring( lang+1 );
  return urltxt;
}

function BackFocus( fname,urltxt ) 
{ 
//alert("BackFocus1: "+fname+" Url: "+urltxt )
  nf=window.open('',fname ); 
  urlnf = UrlWithoutHash( nf.document.location+"" );

//alert("BackFocus2: "+fname+" Url: "+urltxt+" NF: "+urlnf )
  if (urlnf != urltxt) 
  {
    nf.close();
    window.focus();
  }
  else
  {
    nf.focus(); 
    top.close();
  }
  return false; 
}

function SetMaterialForm(fname,selnr,matnr)
{
  nf=window.open('',fname ); 
  urlnf = UrlWithoutHash( nf.document.location+'' );
  if (urlnf == 'about:blank') 
  {
    nf.close();
    window.focus();
  }
  else
  {  
	nf.AllgFrame.document.form1.Material.options.selectedIndex = selnr
    if (HRhover) 
    {
      grsrc = 'image/m100_'+matnr+'.jpg';
      nf.AllgFrame.document['HRGrafik'].src=grsrc; 
    }
    nf.focus();
	top.close();
  }
  return false; 
}

function Fensterweite()
{
 if (window.innerWidth) return window.innerWidth;
 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
 else return 0;
}

function Fensterhoehe()
{
 if (window.innerHeight) return window.innerWidth;
 else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
 else return 0;
}

function OverCell( cell,text ) 
{
  document.getElementById( cell ).setAttribute("bgColor", "#777777")
  window.status = text;
  return true;
}
function OverCellOut( cell ) 
{
  document.getElementById( cell ).setAttribute("bgColor", "#C5C5C5")
  window.status = window.defaultStatus
  return true;
}
function ClickCell( link ) 
{
  top.window.location.href = link;
}
function ClickCellHash( link ) 
{
  window.location.hash = link;
}

