function wopen ( url, popupname, attributes ) {
    // oeffnet ein neues fenster mit den uebergebenen
    // eigenschaften. alle fester werden im window
    // objekt gespeichert. Dies erlaubt eine spaetere
    // Manipulation der Fenster per Javascript
  window[popupname] = window.open ( url, popupname, attributes )
  window[popupname].focus()
}

function setImg ( obj, img ) {
    // erfordert ein img objekt in der html seite im stil von
    // var myImg     = new Image();
    //     myImg.src = "/global/media/pic/pic_black.gif";
    //
    // anwendung wie folgt:
    // onmouseover = "Javascript:setImg(this,myImg1);"
    // onmouseout  = "Javascript:setImg(this,myImg2);"

    i       = obj.src;
    obj.src = img.src
    img.src = i;
}

function Browser() {
	var  b = navigator.appName;
	if      ( b == "Netscape"                    ) this.b = "ns";
	else if ( b == "Microsoft Internet Explorer" ) this.b = "ie";
	else this.b = b;
	this.version = navigator.appVersion;
	this.v = parseInt ( this.version );
	this.ns   = ( this.b == "ns" && this.v >= 4 );
	this.ns4  = ( this.b == "ns" && this.v == 4 );
	this.ns5  = ( this.b == "ns" && this.v == 5 );
	this.ie   = ( this.b == "ie" && this.v >= 4 );
	this.ie4  = ( this.version.indexOf ( 'MSIE 4'   ) > 0 );
	this.ie5  = ( this.version.indexOf ( 'MSIE 5'   ) > 0 );
	this.ie55 = ( this.version.indexOf ( 'MSIE 5.5' ) > 0 );
	this.ie6  = ( this.version.indexOf ( 'MSIE 6'   ) > 0 );
	this.dom  = ( ( document.createRange&& ( document.createRange().createContextualFragment ) ) ? true : false );
	this.min  = ( this.ns||this.ie);
	var ua=navigator.userAgent.toLowerCase();
	if      ( ua.indexOf ( "win" ) >-1 ) this.platform = "win32";
	else if ( ua.indexOf ( "mac" ) >-1 ) this.platform = "mac";
	else this.platform = "other";
}

function resizeWindow ( thisW, thisH ) {
    // Nimmt ein Window und aendert seine groesse. Wird fuer die Popups benutzt
    // um, so weit moeglich, scrollen zu verhindern.
    // Das Fenster wird auf einem Drittel hoehe der Desktop Groesse platziert und
    // horizontal zentriert.
    
    // pruefen ob eine Groessenangabe nicht passt.
    if ( thisW > screen.availWidth  ) thisW = screen.availWidth;
    if ( thisH > screen.availHeight ) thisH = screen.availHeight;


    // position Festlegen
    // Left
    thisL = ( screen.availWidth - thisW ) / 2

    // Top
    if      ( thisH == screen.availHeight                                       ) thisT = 0;
    else if ( thisH <  screen.availHeight && thisH > screen.availHeight * 3 / 4 ) thisT = screen.availHeight - thisH;
    else if ( thisH <  screen.availHeight * 3 / 4                               ) thisT = screen.availHeight / 4;

    // Browserabhaengige Groessenanpassungen
    is = new Browser();
    if ( is.ns5 ) {
        thisW -= 15;
    }

    // Groesse und Position zuweisen
    window.resizeTo ( thisW, thisH );
    window.moveTo   ( thisL, thisT );
}

function editOnFocus ( theField ) {
	theField.value = "";
	theField.focus();
}

