function ajax_window_class()
{
	var id="du_win";
	var id_m="S_du_win";
	var w_title="";
	var w_l=0;
	var w_t=0;
	var w_w=0;
	var w_h=0;
	var w_func=null;
	
	this.createFromUrl=function(url,title,l,t,w,h,func)
	{
		w_title=title;
		w_l=l;
		w_t=t;
		w_w=w;
		w_h=h;
		w_func=func;

		CJQt(url,obj_window.sWindow,"GET");
//		ajax_text("",obj_window.sWindow,url);
	}
	
	this.createFromData=function(data,title,l,t,w,h)
	{
		w_title=title;
		w_l=l;
		w_t=t;
		w_w=w;
		w_h=h;
		
		obj_window.createWindow(data,w_title,w_l,w_t,w_w,w_h);
	}
	
	this.createFromDiv=function(div,title,l,t,w,h)
	{
		w_title=title;
		w_l=l;
		w_t=t;
		w_w=w;
		w_h=h;
		var data=document.getElementById(div).innerHTML;
		obj_window.createWindow(data,w_title,w_l,w_t,w_w,w_h);
	}
	
	this.sWindow=function(q)
	{
		obj_window.createWindow(q,w_title,w_l,w_t,w_w,w_h);
	}
	
	this.createWindow=function(data,title,l,t,w,h)
	{
		this.removeWindow();
		
		var text = document.createTextNode("x");
			
		var div2=document.createElement('div');
			div2.style.width="100%";
			div2.align="right";
			div2.style.backgroundColor='#AEC0DD';
			div2.style.paddingBottom="1px";
			div2.id="t"+id;	
				
//			div2.innerHTML="<table style='font-size:10px;font-family:tahoma' width=100% cellpadding=0 celspacing=0 border=0><tr><td width=99%><B>"+title+"</B><td width=1%><b style='cursor:hand' onclick=\"obj_window.removeWindow()\">x</a></table>";
			
		var div=document.createElement('div');
			div.style.position='absolute';
			
//			if (l==-1)
//				l=(document.body.clientWidth-w)/2;
//			if (t==-1)
//				t=document.body.scrollTop+(document.body.clientHeight-h)/2;
			
			div.style.left=l;
			div.style.top=t;
			div.style.width=w;
//			div.style.height=h;
			div.style.backgroundColor='#CEE0FD';
			div.style.border='#A7BBDE solid 1';
			div.id=id;
//			div.style.overflowY="hidden";
			div.appendChild(div2);

			var div3=document.createElement('div');
				div3.style.width="100%";
//				div3.style.margin="5px 5px 5px 5px";
				div3.innerHTML=data;

			div.appendChild(div3);



		var div_m=document.createElement('div');
			div_m.style.left=0;
			div_m.style.top=0;
			div_m.style.width=document.body.scrollWidth;
			
			div_m.style.backgroundColor='#000000';
			div_m.style.position='absolute';
			div_m.style.filter="alpha(opacity=30)";
			div_m.style.opacity=0.30;
			div_m.id=id_m;
			div_m.onmousedown=function(){obj_window.removeWindow()};


		document.body.appendChild(div_m);
		document.body.appendChild(div);

		this.resizeWindow();
			
		if (w_func!=null)
			w_func();
	}
	
	this.removeWindow=function()
	{
		if (document.getElementById(id)!=null)
		{
					document.body.removeChild(document.getElementById(id));
		}	
		if (document.getElementById(id_m)!=null)
		{
					document.body.removeChild(document.getElementById(id_m));
		}	
	}
	
	this.resizeWindow=function()
	{
		if (document.body.scrollHeight>document.body.offsetHeight)
			document.getElementById(id_m).style.height=document.body.scrollHeight; else
			document.getElementById(id_m).style.height=document.body.offsetHeight;

			document.getElementById(id).style.left=(document.body.clientWidth-document.getElementById(id).offsetWidth)/2;
			document.getElementById(id).style.top=document.body.scrollTop+(document.body.clientHeight-document.getElementById(id).offsetHeight)/2;		
		
			if (document.body.scrollTop+(document.body.clientHeight-document.getElementById(id).offsetHeight)/2<0)
				document.getElementById(id).style.top=0;
	}
}

	var obj_window=new ajax_window_class();
