lastzIndex = 1;
			 		var mWindow = new Class({
					 	initialize: function(titleText,t,l,w,h){
								this.container = new Element('div');
								if(t)
									this.container.setStyle("top",t);
								if(l)
									this.container.setStyle("left",l);
								if(w)
									this.container.setStyle("width",w);
								else
									this.container.setStyle("width",200);
								if(h)
									this.container.setStyle("height",h);
								
								// Defining title bar
								this.titleButtons = new Element('span');
								this.closeButton = new Element('img',{src: 'close.gif'});
								this.closeButton.setStyle('cursor','default');
								this.closeButton.setStyle('margin-top','2px');
								this.closeButton.setStyle('margin-right','2px');
								this.closeButton.addEvent('click', this.close.bind(this));
								this.slideButton =  new Element('img',{src: 'slide.gif'});
								this.slideButton.setStyle('cursor','default');
								this.slideButton.setStyle('margin-top','2px');
								this.slideButton.setStyle('margin-right','2px');
								this.slideButton.addEvent('click', this.slide.bind(this));
								this.slideButton.inject(this.titleButtons);
								this.closeButton.inject(this.titleButtons);
								this.title = new Element('div');
								this.title.setStyles({
									 cursor: 'move',
								   border: '1px solid #A6B6D3',
								   height: 20,
								   width: '100%',
								   color: '#000',
								   background: '#8DA2C6'
								});
								this.titleButtons.inject(this.title);
								this.titleButtons.setStyle("float","right");
								this.title.appendText(titleText);
								this.container.adopt(this.title);
								new Drag.Move(this.container,{
									handle: this.title
								});
								
								// Defining content block
								this.content = new Element('div');
								this.content.setStyles({
									 display: 'block',
								   width: '100%',
								   height: '100%',
								   border: '1px solid #A6B6D3',
								   background: '#F5FCFE',
								   overflow: 'auto'
								});
								this.container.adopt(this.content);
								
								// Defining status bar
								this.statusBar = new Element('div');
								this.statusBar.setStyles({
								   border: '1px solid #A6B6D3',
								   height: 5,
								   width: '100%',
								   color: '#000',
								   background: '#8DA2C6'
								});
								this.resizeButton = new Element('img',{src: 'resize.gif'});
								this.resizeButton.setStyle('cursor','se-resize');
								this.resizeButton.setStyle('margin-bottom','2px');
								this.resizeButton.setStyle('margin-right','2px');
								this.resizeButton.setStyle("float","right");
								
								this.statusBar.adopt(this.resizeButton);
								this.container.makeResizable({
									handle: this.resizeButton									
									});
								this.container.adopt(this.statusBar);
								
								this.container.addEvent('click',this.bringToTop.bind(this));
								
								this.container.inject($(document.body));
						 },
						 
						 setContent: function(content){
						 		this.content.setHTML(content);
						 },
						 slide: function(){
						 		if(this.content.getStyle('display')=='block')
						 			this.content.setStyle('display','none');
						 		else
						 			this.content.setStyle('display','block');
						 },
						 close: function(){
						 		this.container.setStyle('display','none');
						 },
						 show: function(){
						 		this.container.setStyle('display','block');
						 },
						 bringToTop: function(){
						 		lastzIndex++;
						 		this.container.setStyle('z-index',lastzIndex);
						 }
					 
					 });
