function CostumWindow(openDivId,closeDivId, contentFrameDiv, fullPageDiv, effects) {
	
	//public methods 
	this.closeWindow = function (event) {
		if(self.effects.background == true)
		{
			$(bgFrame).fade({ duration: 0.3, from: self.effects.backgroundOpacy});    
		}

		$(self.contentFrameDiv).hide();
		
		//Project spezifisch
		self.onWindowClose(event);
		
		
		return false;
	};
	
	this.openWindow = function (event) {
		self.unlocked = false;
		if(self.effects.background == true)
		{
			$(bgFrame).appear({ duration: 0.3, to: self.effects.backgroundOpacy});    
		}
		$(self.contentFrameDiv).show();

		
		//Project spezifisch
		self.onWindowOpen(event);
		
		return false;	
	}
	
	this.onWindowOpen = function(event) {};
	this.onWindowClose = function(event) {};
	
	var self = this;
	this.effects = new Object;
	
	this.unlocked = false;
	
	//on click there is a dark frame behind the content frame
	//to focus the view of the user to that frame
	this.effects.background = true;
	
	//the opacy of the background frame
	this.effects.backgroundOpacy = 0.5;
	
	//the color of the background frame
	this.effects.backgroundColor = '#000';
	
	//the alignment of the frame
	this.align = 'center';
	
	if(openDivId != '')	this.openDivId = document.getElementById(openDivId);
	this.closeDivId = document.getElementById(closeDivId);
	this.contentFrameDiv = document.getElementById(contentFrameDiv);
	if(effects)	checkEffects(effects);
	
	//set events
	if(openDivId != '') this.openDivId.onclick = this.openWindow;
	this.closeDivId.onclick = this.closeWindow;
	
	
	//prepare
	if(this.effects.background == true)	createBackgroundDiv();
	createZindex();
	setContentAlignment();
	
	function checkEffects(e) {
		if(e.background) self.effects.background = e.background;
		if(e.backgroundTargetOpacy) self.effects.backgroundTargetOpacy = e.backgroundTargetOpacy;
		if(e.align) self.effects.align = e.align;
	};
	
	function createBackgroundDiv() {
		bgFrame = document.createElement("div");
		bgFrame.setAttribute("id","costumWindow_bg");
		var pageSize = getPageSize();
		//Projekt spezifische Settings
		bgFrame.style.height = $(fullPageDiv).getHeight() + 'px';
		bgFrame.style.width = pageSize.width + 'px';
		bgFrame.style.backgroundColor = self.effects.backgroundColor;
		bgFrame.style.position = 'absolute';
		bgFrame.style.display = 'none';
		document.body.insertBefore(bgFrame, document.body.firstChild);
	}
	
	function getPageSize() {
		  var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    myWidth = window.innerWidth-17;
		    myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		    //IE 6+ in 'standards compliant mode'
		    myWidth = document.documentElement.clientWidth;
		    myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		    //IE 4 compatible
		    myWidth = document.body.clientWidth;
		    myHeight = document.body.clientHeight;
		  }
		return {'height' : myHeight, 'width' : (myWidth)};
	}
	
	function getScrollPositions() {
	    var scrOfX = 0, scrOfY = 0;
	 
	    if( typeof( window.pageYOffset ) == 'number' ) {
	        //Netscape compliant
	        scrOfY = window.pageYOffset;
	        scrOfX = window.pageXOffset;
	    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	        //DOM compliant
	        scrOfY = document.body.scrollTop;
	        scrOfX = document.body.scrollLeft;
	    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
	        scrOfX = document.documentElement.scrollLeft;
	    }
	    return { 'x': scrOfX, 'y':scrOfY };
	}
	
	function createZindex() {
		if(self.effects.background == true)	bgFrame.style.zIndex = '1000';
		self.contentFrameDiv.style.zIndex = '1001';
	}
	
	function scrollEffects(e) {
		//var pos = getScrollPositions();
		//bgFrame.style.marginTop = pos.y + 'px';
		//self.openDivId.style.marginTop = (openDivMarginTop + pos.y) + 'px';
		//self.contentFrameDiv.style.marginTop = (pos.y + self.contentDivMarginTop )+ 'px';
	}
	
	function resizeEffects(e) {
		var pageSize = getPageSize();
		bgFrame.style.height = $(fullPageDiv).getHeight() + 'px';
		bgFrame.style.width = pageSize.width + 'px';
		
	}
	
	function getScrollWidth()
	{
	   var w = window.pageXOffset ||
	           document.body.scrollLeft ||
	           document.documentElement.scrollLeft;
	           
	   return w ? w : 0;
	}

	function getScrollHeight()
	{
	   var h = window.pageYOffset ||
	           document.body.scrollTop ||
	           document.documentElement.scrollTop;
	           
	   return h ? h : 0;
	}
	
	function setContentAlignment() {
		self.contentFrameDiv.style.top = '50%';
		self.contentFrameDiv.style.left = '50%';
		self.contentFrameDiv.style.marginTop = '-'+($(self.contentFrameDiv).getHeight()/2) +'px' ;
		self.contentFrameDiv.style.marginLeft = '-'+($(self.contentFrameDiv).getWidth()/2) +'px' ;		
		self.contentDivMarginTop = parseInt(self.contentFrameDiv.style.marginTop);
		
	}
	
}