//--- WindowHandler kann ein objWindow zum open bewegen
//--- Cookie Methoden haben hier eigentlich nix verloren - könnte man noch besser kapseln -> Zeitproblem
function cWindowOpenHandler( objWindow )
{
	this.objWindow 		= objWindow;
	this.boolOpenOnce 	= false;
	this.strCookieName 	= "";
	this.activeWindow 	= null
}

cWindowOpenHandler.prototype = {
	setOpenOnce : function( strCookieName )
	{
		this.strCookieName = strCookieName;
		this.boolOpenOnce = true;
		return this;
	},
	
	_checkCookie : function()
	{
		var strCookieValue = document.cookie;					
		var strPattern = eval('/' + this.strCookieName + '=true/i');
		if(strCookieValue.match(strPattern)) 
		{
			return false;
		} 
		return true;
	},
	
	setCookie : function()
	{
		var objDate = new Date();
		objDate = new Date(objDate.getTime() + 1000 * 60 * 60); // Reload block for 1 hour
		document.cookie = this.strCookieName + '=true; expires=' + objDate.toGMTString() + ';';
		return this;
	},
	
	open : function()
	{
		if( !this.boolOpenOnce || this._checkCookie())
		{
			this.activeWindow = window.open( this.objWindow.getUrl(),this.objWindow.getWindowName(), this.objWindow.getParameter() )
			if(this.boolOpenOnce)
			{
				this.setCookie();
			}
		}
		return this.activeWindow;
	}				
}
