// dlg.js - generiert das Seitenlayout für DialogBox Seiten (C) Walter Bislin, Januar 2003

function w( aText ) { document.write(aText); }
function wl( aText ) { document.writeln(aText); }

function CLayout( aLevel )
{
  this.Level = aLevel;
  this.Up = '';
  for (i = aLevel; i > 0; i--) this.Up = this.Up + '../';
  this.Root = this.Up; 
  this.Home = this.Root + 'index.html';
  this.Stuff = this.Root + 'stuff/';
  this.Pixel = this.Stuff + 'pixel.gif';
  this.Pixel1 = '<img src="'+this.Pixel+'" width="1" height="1" alt="" border="0">';
  this.PixelWH = CPixelWH;
  this.Img = 'qm.gif';
  this.ImgW = 80;
  this.ImgH = 62;
  this.Width = '90%';

  // Browser-Version
  var b = navigator.appName
  if (b=='Netscape') this.Browser = 'ns'
  else if (b=='Microsoft Internet Explorer') this.Browser = 'ie'
  else this.Browser = b;
  var v = parseInt(navigator.appVersion);
  this.FormCSS  = !((this.Browser=='ns' && v<5) || (this.Browser=='ie' && v<4)); 

  this.BeginDlg = CBeginDlg;
  this.EndDlg = CEndDlg;
  this.Button = CButton;
}

function CPixelWH( w, h )
{
  return( '<img src="'+this.Pixel+'" width="'+w+'" height="'+h+'" alt="" border="0">' );
}

function CBeginDlg( aTitle )
{
  var a = CBeginDlg.arguments;
  var w = this.Width;
  if (a.length > 1) {
    this.Img = a[1];
    this.ImgW = a[2];
    this.ImgH = a[3];
  }
  if (w != '') w = 'width="'+w+'"';
  wl('<table width="100%" height="100%" border="0" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0"><tr><td width="100%" align="center" valign="middle">');
  wl('<table '+w+' border="0" cellpadding="0" cellspacing="0" bgcolor="#4060FF">');
  wl('<tr>');
  wl('  <td>'+this.Pixel1+'</td>');
  wl('  <td>'+this.PixelWH(8,1)+'</td>');
  wl('  <td>'+this.Pixel1+'</td>');
  wl('  <td>'+this.PixelWH(8,1)+'</td>');
  wl('  <td>'+this.Pixel1+'</td>');
  wl('</tr>');
  wl('<tr><td colspan="5" bgcolor="#4060FF" background="'+this.Stuff+'dlgfd1.gif" align="left">'+this.PixelWH(1,3)+'</td></tr>');
  wl('<tr>');
  wl('  <td bgcolor="#0020BF">&nbsp;</td>');
  wl('  <td bgcolor="#0020BF">'+this.PixelWH(8,1)+'</td>');
  wl('  <td bgcolor="#0020BF" align="left" valign="middle" class="title">'+aTitle+'</td>');
  wl('  <td bgcolor="#0020BF">'+this.PixelWH(8,1)+'</td>');
  wl('  <td bgcolor="#0020BF" align="right"><img src="'+this.Stuff+'dlgfd3.gif" width="143" height="28" border="0" alt=""></td>');
  wl('</tr>');
  wl('<tr>');
  wl('  <td bgcolor="#4060FF" align="left" valign="top"><img src="'+this.Stuff+'dlgfd2a.gif" width="132" height="8" border="0" alt=""></td>');
  wl('  <td bgcolor="#6077FF">'+this.PixelWH(8,1)+'</td>');
  wl('  <td bgcolor="#6077FF">'+this.PixelWH(1,8)+'</td>');
  wl('  <td bgcolor="#6077FF">'+this.PixelWH(8,1)+'</td>');
  wl('  <td bgcolor="#4060FF">'+this.Pixel1+'</td>');
  wl('</tr>');
  wl('<tr>');
  wl('  <td bgcolor="#4060FF" align="left" valign="top"><img src="'+this.Stuff+'dlgfd2.gif" width="132" height="121" border="0" alt=""></td>');
  wl('  <td bgcolor="#6077FF">'+this.Pixel1+'</td>');
  wl('  <td bgcolor="#6077FF" align="left" valign="middle">');                            
}

function CEndDlg()
{
  wl('  </td>');
  wl('  <td bgcolor="#6077FF">'+this.Pixel1+'</td>');
  wl('  <td bgcolor="#4060FF" align="center" valign="top"><img src="'+this.Stuff+this.Img+'" width="'+this.ImgW+'" height="'+this.ImgH+'" border="0" alt=""></td>');
  wl('</tr>');
  wl('<tr>');
  wl('  <td bgcolor="#4060FF">'+this.Pixel1+'</td>');
  wl('  <td bgcolor="#6077FF">'+this.Pixel1+'</td>');
  wl('  <td bgcolor="#6077FF">'+this.PixelWH(1,8)+'</td>');
  wl('  <td bgcolor="#6077FF">'+this.Pixel1+'</td>');
  wl('  <td bgcolor="#4060FF">'+this.Pixel1+'</td>');
  wl('</tr>');
  wl('<tr><td colspan="5" bgcolor="#0020BF">'+this.PixelWH(1,3)+'</td></tr>');
  wl('</table>');
  wl('</td></tr></table>');
}

function CButton( aType, aName, aCaption, aAction, aWidth ) // returns string
{
  var nm = '', wd = '', ac = '';
  var tp = 'type="'+aType+'" ';
  var cp = 'value="'+aCaption+'" ';
  if (aName != '') nm = 'name="'+aName+'" ';
  if (aAction != '') ac = 'onClick="'+aAction+'" ';
  if (aWidth > 0) wd = 'style="width:'+aWidth+'px;" ';
  if (this.FormCSS) {
    return('<input class="button" '+tp+nm+cp+wd+ac+'>');
  } else {
    return('<input '+tp+nm+cp+ac+'>');
  }
}

