/**
* @author	André Dietisheim (dietisheim@sphere.ch)
* @version 2.5.2, 2005-01-18 (created on 2002-04-22)
* Copyright (c) 2001-2005 André Dietisheim
*/

function WinTarget( sSrc )
{
	this.sSrc = sSrc;
}

WinTarget.prototype.createHref = function( sSrc, sText, sNavigationName, sNavigation ) 
{
	if ( sSrc == "#" )
	{ // create link to same page poping up current menu-entry
		sSrc = location + ""; // window.document.URL
		sSrc = sSrc.replace( new RegExp( sNavigationName + "=[^&]*", "" ), sNavigationName + "=" + escape( sText ) );
		if ( sSrc.indexOf( sNavigationName + "=" ) < 0 )
			sSrc = sSrc + "?" + sNavigationName + "=" + escape( sText );
	}
	return sSrc;
}

WinTarget.prototype.open = function( sText, sNavigationName, sNavigation )
{
	window.location = this.createHref( this.sSrc, sText, sNavigationName, sNavigation );
}

function NewWinTarget( sSrc, iX, iY, iWidth, iHeight )
{
	this.win = null;
	this.sSrc = sSrc;
	this.iX = iX;
	this.iY = iY;
	this.iWidth = iWidth;
	this.iHeight = iHeight;
}

NewWinTarget.prototype.open = function()
{
	var sOpts = "toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes,scrollbars=yes";

	if ( document.body && document.body.offsetWidth )
		sOpts += ",width=" + this.iWidth;
	else if ( window.innerWidth )
		sOpts += ",innerWidth=" + this.iWidth + ",";

	if ( document.body && document.body.offsetHeight )
		sOpts += ",height=" + this.iHeight
	else if ( window.innerHeight )
		sOpts += ",innerHeight=" + this.iHeight

	sOpts +=",top=" + this.iY;
	sOpts += ",left=" + this.iX;

	this.win = top.open( this.sSrc, "", sOpts );
}

function FrameTarget( sSrc, sId )
{
	this.sSrc = sSrc;
	this.sId = sId;
}

FrameTarget.prototype.open = function()
{
	var target = top.frames[ this.sId ];
	target = this.findFrame( this.sId, top.frames );
	if ( target )
	{
		target.document.location.href = this.sSrc;
	}
}

FrameTarget.prototype.findFrame = function( sId, frameArray )
{
	if ( frameArray[ sId ] )
	{
		return frameArray[ sId ];
	}
	for ( i = 0; i < frameArray.length; i++ )
	{
		return this.findFrame( sId, frameArray[ i ] );
	}
	return null; // fix nn4.0: necessar inutile return value
}

function FunctionTarget( func )
{
	this.func = func;
}

FunctionTarget.prototype.open = function()
{
	if ( this.func )
	{
		this.func();
	}
}
