<!--
var myPopupWins = new Array();
var myHandlingOnFocus = false;
var myDontCloseWindow = false;

function myEncodeURI ( uri )
{
	var returnValue = uri;

	returnValue = returnValue.replace( '%', '%25' );
	returnValue = returnValue.replace( 'ä', '%E4' );
	returnValue = returnValue.replace( 'ö', '%F6' );
	returnValue = returnValue.replace( 'ü', '%FC' );
	returnValue = returnValue.replace( 'Ä', '%C4' );
	returnValue = returnValue.replace( 'Ö', '%D6' );
	returnValue = returnValue.replace( 'Ü', '%DC' );
	returnValue = returnValue.replace( 'é', '%E9' );
	returnValue = returnValue.replace( 'è', '%E8' );
	returnValue = returnValue.replace( 'ê', '%EA' );
	returnValue = returnValue.replace( 'à', '%E0' );
	returnValue = returnValue.replace( 'â', '%E2' );
	returnValue = returnValue.replace( 'î', '%EE' );

	return returnValue;
}

function myRegisterOpenPopupWindow ( popupWindowRef )
{
    var index = myGetPopupWindowIndexByName( popupWindowRef.name );
    
    if ( index == -1 )
    {
        myPopupWins[myPopupWins.length] = popupWindowRef;
    }
}

function myGetPopupWindowIndexByName ( popupWindowName )
{
    var returnValue = -1;
    
    if ( popupWindowName )
    {
        for ( var i = 0; i < myPopupWins.length; i++ )
        {
            if ( myPopupWins[i] != null && !myPopupWins[i].closed && myPopupWins[i].name == popupWindowName )
            {
                returnValue = i;
                break;
            }
        }
    }
    
    return returnValue;
}

function myOpenTargetWindow ( url, target )
{
    window.open( url, target );
}

function myNewWindow ( url )
{
    window.open( url, "_blank" );
}

function myPopupWindow ( url, popupName, w, h, scrollbars, resizable, dependent, marginleft, margintop, noEncodeURL, showMenu, showToolbar, doCloseIfOpen )
{
    var tmp = new Array();
    for ( var i = 0; i < myPopupWins.length; i++ )
    {
        if ( !myPopupWins[i].closed )
        {
            tmp[tmp.length] = myPopupWins[i];
        }
    }
    myPopupWins = tmp;
    
    var index = myGetPopupWindowIndexByName( popupName );
    
    if ( myHandlingOnFocus ) 
    {
        myDontCloseWindow = true;
    }

    if ( myPopupWindow.arguments.length < 13 )
    {
        doCloseIfOpen = true;
    }
    
    if ( doCloseIfOpen && index >= 0 && !myPopupWins[index].closed && myPopupWins[index].close )
    {
        myPopupWins[index].close();
    }
       
    if ( index == -1 || doCloseIfOpen )
    {
        if ( noEncodeURL == null && !noEncodeURL )
        {
            url = myEncodeURI ( url );
        }
        
        scrollbars = ( scrollbars ) ? '1' : '0';
        resizable = ( resizable ) ? '1' : '0';
        dependent = ( dependent ) ? 'yes' : 'no';
        showMenu = ( showMenu ) ? '1' : '0';
        showToolbar = ( showToolbar ) ? '1' : '0';
        if ( popupName == null )
        {
            popupName = "myPopup";
        }
        leftPos = ( screen.availWidth ) ? Math.floor( ( screen.availWidth - w ) / 2 ) : 0;
        topPos = ( screen.availHeight ) ? Math.floor( ( screen.availHeight - h ) / 4 ) : 0;
        
        if ( !isNaN( marginleft ) && marginleft != 0 )
        {
            leftPos = marginleft;
        }
        if ( !isNaN( margintop ) && margintop != 0 )
        {
            topPos = margintop;
        }
        
        var myPopupWin = window.open( url, popupName, 'toolbar=' + showToolbar + ',location=0,directories=0,status=0,menubar=' + showMenu + ',scrollbars=' +
                                  scrollbars + ',resizable=' + resizable + ',width=' +
                                  w + ',height=' + h + ',left=' + leftPos + ',top=' + topPos + ',dependent=' + dependent );
        if ( myPopupWin.focus )
        {
            myPopupWin.focus();
        }

        if ( index == -1 )
        {
            myPopupWins[myPopupWins.length] = myPopupWin;
        }
        else
        {
            myPopupWins[index] = myPopupWin;
        }
        
    }
    else
    {
        if ( myPopupWins[index].focus )
        {
            myPopupWins[index].focus();
        }
    }    
}

function myPopupWindowIfNotOpen (url, windowName, w, h )
{
    myPopupWindow( url, windowName, w, h, 0, 0, false, 0, 0, false, false, false, false );
}

function myBlankWindow (url, windowName, w, h )
{
    myPopupWindow( url, windowName, w, h, 1, 1, false, 0, 0, false, true, true );
}

function myPopupWindowNoEncoding (url, popupName, w, h, scrollbars, resizable, dependent, marginleft, margintop )
{
	myPopupWindow (url, popupName, w, h, scrollbars, resizable, dependent, marginleft, margintop, true );
}

function myRealClosePopupWindow ( popupName )
{
    var index = -1;
    
    myHandlingOnFocus = false;
    if ( !myDontCloseWindow )
    {
        if ( popupName )
        {
            index = myGetPopupWindowIndexByName( popupName );
        }
        else
        {
            if ( myPopupWins.length > 0 && myPopupWins[0] != null )
            {
                index = 0;
            }
        }
        
        if ( index >= 0 && myPopupWins[index] != null )
        {
            if ( !myPopupWins[index].closed && myPopupWins[index].close )
            {
                if ( myPopupWins[index].myRealClosePopupWindow )
                {
                    if ( popupName )
                    {
                        myPopupWins[index].myRealClosePopupWindow( popupName );
                    }
                    else
                    {
                        myPopupWins[index].myRealClosePopupWindow();
                    }
                }
                myPopupWins[index].close();
            }
            
            var tmp = new Array();
            for ( var i = 0; i < myPopupWins.length; i++ )
            {
                if ( i != index )
                {
                    tmp[tmp.length] = myPopupWins[i];
                }
            }
            myPopupWins = tmp;
        }
    }
    else
    {
        myDontCloseWindow = false;
    }
}

function myRealCloseAllPopupWindows ()
{
    for ( var index = 0; index < myPopupWins.length; index++ )
    {    
        if ( myPopupWins[index] != null && !myPopupWins[index].closed && myPopupWins[index].close )
        {
            if ( myPopupWins[index].myRealCloseAllPopupWindows )
            {
                myPopupWins[index].myRealCloseAllPopupWindows();
            }
            myPopupWins[index].close();
        }
    }
}

function myClosePopupWindow ( popupName )
{
	if ( popupName )
	{
    	setTimeout("myRealClosePopupWindow( popupName );", 500);
	}
	else
	{
    	setTimeout("myRealClosePopupWindow();", 500);
	}
}

function myCloseAllPopupWindows ()
{
    setTimeout("myRealCloseAllPopupWindows();", 500);
}

function myHandleOnFocus ( event )
{
    myHandlingOnFocus = true;
    myClosePopupWindow();
}

function myClosePopupOnFocus ()
{
	window.onfocus = myHandleOnFocus;
}

function myPopupWindowAndPostFormData ( url, urlForEmptyWindow, popupName, w, h, formName, normalFormAction, scrollbars, resizable )
{
    myPopupWindow( urlForEmptyWindow, popupName, w, h, scrollbars, resizable );
    formObj = myGetObj( formName );
    if ( formObj != null )
    {
        formObj.action = url;
        formObj.target = popupName;
        formObj.submit();
        // because of NS4.7
        setTimeout( 'formObj.action = \'' + normalFormAction + '\';', 500 );
        setTimeout( 'formObj.target = "";', 500 );
    }
}

function myReloadOpener()
{
    opener.location.reload();
}

function mySubmitDefaultOpenerForm()
{
    opener.document.defaultform.submit();
}
//-->
