// JavaScript Document
function findObj( n, d ) {
  var p;
  var i;
  var 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 = findObj( n, d.layers[ i ].document );
  }
  if ( !x && d.getElementById ) {
    x = d.getElementById( n );
  }
  return x;
}

function postForm( selectNo ) {
  findObj('which_submit').value = selectNo;
  findObj('inseart_my_form').submit();
}

function deleteImage( selectNo, imageNo ) {
  findObj('which_submit').value = selectNo;
  findObj('which_image').value = imageNo;
  findObj('inseart_my_form').submit();
}

function BrowserInfo( ) {
  var ua = navigator.userAgent.toLowerCase();
  this.isXp = ( ( ua.indexOf( 'xp' ) != -1 || ua.indexOf( 'nt 5.1' ) != -1 ) ? "yes" : "no" );
  this.name = navigator.appName;
  this.codename = navigator.appCodeName;
  this.version = navigator.appVersion.substring(0,4);
  this.platform = navigator.platform;
  this.javaEnabled = navigator.javaEnabled();
  this.screenWidth = screen.width;
  this.screenHeight = screen.height;
}
browser = new BrowserInfo();

var win = null;

function NewWindow( mypage, myname, w, h, scrollbars, titlebar, resizable, status, directories, dependent, hidde ) { // Zentriertes Popupfenster
  if ( win != null ) {
    win.close( );
  }
  if ( !scrollbars ) { scrollbars = "yes"; }
  if ( !titlebar ) { titlebar = "no"; }
  if ( !resizable ) { resizable = "no"; }
  if ( !status ) { status = "yes"; }
  if ( !location ) { location = "no"; }
  if ( !directories ) { directories = "no"; }
  if ( !dependent ) { dependent = "yes"; }
  if ( !hidde ) { hidde = "no"; }
  if ( browser.name == "Netscape" ) {
    if ( browser.isXp == "yes" ) {
      plusX = 4;
      plusY = 13;
    } else {
      plusX = 4;
      plusY = 4;
    }
  } else {
    plusX = 0;
    if ( browser.isXp == "yes" ) {
      plusY = 9;
    } else {
      plusY = 0;
    }
  }
  WinWidth = ( w + plusX );
  WinHeight = ( h + plusY );
  LeftPosition = ( hidde == "no" ? ( ( screen.width ) ? ( screen.width - w ) / 2 : 0 ) : ( ( screen.width ) + 20 + WinWidth ) );
  TopPosition = ( hidde == "no" ? ( ( screen.height ) ? ( screen.height - h ) / 2 : 0 ) : ( ( screen.height ) + 20 + WinHeight ) );
  if ( !w && !h ) { 
    win = window.open( mypage, myname );
  } else {
    win = window.open( mypage, myname, "height=" + WinHeight + ",width=" + WinWidth + ",top=" + TopPosition + ",left=" + LeftPosition + ",titlebar=" + titlebar + ",resizable=" + resizable + ",status=" + status + ",scrollbars=" + scrollbars + ",location=" + location + ",directories=" + directories + ",dependent=" + dependent );
  }
  if ( win.window.focus ) {
    win.window.focus( );
  }
}
