var resizeble=false;

//	var blankimage='';
	var blankimage='../51D1F6858AFEF460C125755300375E1E/$file/blank.gif';




/* Modefied 2008-12-11 by Martin Johansson/CIKADO */
/* Modefied 2009-01-13 by Martin Johansson/CIKADO */
/* Modefied 2009-02-05 by Martin Johansson/CIKADO */

	//tmt.constructor.prototype.FloatingFrames=new Array();
	tmt.constructor.prototype.CurrentFloatingFrame=null;
	tmt.constructor.prototype.FloatingFramesZ=0;//-1;

	tmt.constructor.prototype.FloatingFrame=function(autoclose) {

var me=this;
			if (navigator.userAgent.indexOf(' MSIE ')>=0 && !document.namespaces) return alert('This client is not supported'); //msie 5 and other old ones...

			var safari=(navigator.userAgent.indexOf('Safari')>=0);
			var firefox=(navigator.userAgent.indexOf('Firefox/')>=0);
			var firefox2=(navigator.userAgent.indexOf('Firefox/2.')>=0);
			var firefox3=(navigator.userAgent.indexOf('Firefox/3.')>=0);

			var msie=(!safari && !window.opera && typeof(document.all)!='undefined');
			var msie7=(msie && document.documentElement && document.documentElement.currentStyle && typeof(document.documentElement.currentStyle.maxWidth)!='undefined');
			var msie6=(msie && !msie7); //msie 5.5 and msie 6 - msie 5 is not supported
			var msie55=(msie && !document.compatMode);

			//if (!document.compatMode) return alert('This client is not supported.'); //msie 5.01
			

var sh=!true;



			if (tmt.FloatingFrames) tmt.FloatingFrames.push(this);

			var autofocus=!true;

			var closeonblur=autoclose;
			var closeonreload=autoclose;

//			var minw=256;
//			var minh=128;
			var border=4*0;


			var shadow=(msie6 ? -5 : 60);
			var shadowx=(msie6 ? 12 : 25);
			var shadowy=(msie6 ? 12 : 22);

			var minw=60+shadow;
			var minh=64-border*2;

if (sh) border=4;

			var bgcolor='transparent';
			var activecolor='blue';'black'; //'highlight'; 'captiontext';
			var inactivecolor='black';'threeddarkshadow'; //'inactivecaptiontext';



			var autoposition=true;
			var autosize=true;
			
			this.SetPosition=function(x,y) {

				autoposition=false;

				if (x<0) x=0;
				if (y<0) y=0;

				x-=shadowx;
				y-=shadowy;

				fff.style.left=x+'px';
				fff.style.top=y+'px';
			}			
			this.SetSize=function(w,h,center) {
				autosize=false;

				w+=shadow-2+(msie6 ? 2-border*2 : 0);
				h-=border*2;

				if (w<minw) w=minw;
				if (h<minh) h=minh;

				fff.style.width=w+'px';
				frame.style.height=h+'px';
//alert(frame.contentWindow.document);
				//if (center) Resize2.call(frame,true,false);
			}

			function Resize(pos,isretry) {

				if (typeof(this.contentWindow.document)=='unknown') { //no access
alert('no access...')
var w=400;
var h=400;
var x=400;
var y=400;
					this.style.width=w+'px';
					this.style.height=h+'px';
					this.style.borderWidth=border+'px';
					if (pos) {
						this.style.left=x+'px';
						this.style.top=y+'px';
					}
					return;
				}


				//var o=(this.contentWindow.document.compatMode && this.contentWindow.document.compatMode!='BackCompat' ? this.contentWindow.document.documentElement : this.contentWindow.document.body);
				var o=this.contentWindow.document.body; //chrome returns 0 for documentElement.scrollHeight...

				var w=o.scrollWidth;
				var h=o.scrollHeight;

	var ws=this.contentWindow.document.getElementById('tmt-win-workspace');
	if (ws) {
//ws.style.overflowX='hidden';
				w+=ws.scrollWidth-ws.offsetWidth;//-ws.clientWidth;
				h+=ws.scrollHeight-ws.offsetHeight;//-ws.clientHeight;
	}

/*
Resize2.call(this,pos,isretry);
}
function Resize2(pos,isretry,w,h) {
*/

//alert(this.contentWindow.document.body.clientWidth+':'+this.contentWindow.document.body.offsetWidth);

//var h=this.contentWindow.document.body.scrollHeight;
//alert(this.contentWindow.document.body.outerHTML);
//top.document.title=o.nodeName+': '+this.contentWindow.document.body.scrollHeight+' - '+this.contentWindow.document.compatMode;
//top.document.title=o.nodeName+': '+h;

/*
				if (this.clientWidth>=w || this.clientHeight>=h) {
					if (isretry) alert('Resize failed.');
					else {
alert('resize...');
						this.style.borderWidth='0px';
						this.style.width='1px';
						this.style.height='1px';
						Resize.call(this,pos,true)
//						var me=this;
//						setTimeout(function() {Resize.call(me,pos)},1)
						return;
					}
				}		
*/
				var oo=(document.compatMode && document.compatMode!='BackCompat' ? document.documentElement : document.body);
				var ow=oo.clientWidth-border*2;
				var oh=oo.clientHeight-border*2;

				var max=false;
				if (max) {			
					if (w>ow) w=ow; else if (w<minw) w=minw;
					if (h>oh) h=oh; else if (h<minh) h=minh;
				}



/*

//var w=o.scrollWidth;if (ws) w+=ws.scrollWidth-ws.offsetWidth;//-ws.clientWidth;				
				fff.style.width=(w+shadow+border*2)+'px';

//var h=o.scrollHeight;if (ws) h+=ws.scrollHeight-ws.offsetHeight;//-ws.clientHeight;
				this.style.height=(h+2)+'px';				

//if (ws) ws.style.overflow='auto';

//				this.style.borderWidth=border+'px';

*/

				if (autosize) me.SetSize(w+border*2+2,h+border*2+2)
				
				if (pos) {

					var x=parseInt((ow-w)/2,10)
					var y=parseInt((oh-h)/2,10)

					if (autoposition) me.SetPosition(x,y)
/*
					if (x<0) x=0;
					if (y<0) y=0;

					fff.style.left=x+'px';
					fff.style.top=y+'px';
*/

//					if (this.contentWindow.document.body.scrollLeft!=0) this.contentWindow.document.body.scrollLeft=0; //firefox
//					if (this.contentWindow.document.body.scrollTop!=0) this.contentWindow.document.body.scrollTop=0; //firefox

				}

				me.Show();
			}

			function FocusHandler() {

				if (tmt.CurrentFloatingFrame) {
					if (tmt.CurrentFloatingFrame==me) return;
					tmt.CurrentFloatingFrame.Blur();//SendBack();
				}
				tmt.CurrentFloatingFrame=me;



				framecontainer.style.borderColor=activecolor;
document.title+='1'
//				if (this!=this.parentNode.lastChild) this.parentNode.appendChild(this); //msie only
				if (fff.style.zIndex<tmt.FloatingFramesZ) fff.style.zIndex=++tmt.FloatingFramesZ;



				if (draghelper) {
draghelper.style.filter='alpha(opacity=0)';
draghelper.style.opacity=0;
				}

if (overlay) overlay.style.visibility='visible';



//				if (overlay) overlay.style.zIndex=fff.style.zIndex;


			}




			this.Blur=function() { //this is used to set a transparent protection layer over the window (for example when the window is using frames for other domains...)

//				frame.contentWindow.blur();
//				frame.blur();

				BlurHandler();
				
			}




			function BlurHandler() {

				framecontainer.style.borderColor=inactivecolor;
//document.title+='0'
				if (draghelper) {
					PutDragHandlerInBody();
draghelper.style.filter='alpha(opacity=33)';
draghelper.style.opacity=0.33;
					draghelper.style.zIndex=1;
				}



				if (closeonblur) Close.call(this); 
			}

			var closed=false;
			function Close(returnvalue, isparentunloading) {

				if (closed) return true;


				if (typeof(me.onclose)=='function') {
//					var evt=new Object();
//					evt.canceled=canceled;
					if (typeof(returnvalue)=='undefined') returnvalue=null;
					if (me.onclose.call(me,returnvalue)==false && !isparentunloading) return false;
				}

				if (IsMaximized()) ToggleMaximizeRestore();

				this.onload=this.onreadystatechange=function() {
					this.onload=this.onreadystatechange=function() {} //opera

//					if (this.parentNode) this.parentNode.style.borderWidth='0px';
//					fff.style.display='none';

					if (firefox3) this.src='about:blank';
					if (fff.parentNode) fff.parentNode.removeChild(fff); else fff.outerHTML='';

					closed=true;
				};

				fff.style.display='none';

				try {
					if (msie || !isparentunloading) {
						//this does not trigger a navigation sound in MSIE and not a get for favicon in Chrome...
						this.contentWindow.document.open('text/html','replace');	
						this.contentWindow.document.close(); //not working in Chrome when the owner window unloads...
					}
					else this.src='about:blank';
				}
				catch (e) {
					alert(e.message);
					//this.src='';
					//this.src='javascript:;';
					this.src='about:blank'; //this trigger the event above and gives time for any other attached unload events to do theire thing... (very important!)	 - opera wants about:blank			
				}

				return true;
			}



tmt.FloatingFramesZ=tmt.FloatingFramesZ+1;



if (!overlay) {
		overlay=document.createElement('div');
		overlay.style.cssText='position:fixed; z-index:'+tmt.FloatingFramesZ+'; width:100%; height:100%; top:0; left:0; xmin-height:100%; background-color:#012; opacity:0.66; filter:alpha(opacity=66); visibility:hidden;';

		if (msie6) {
			overlay.innerHTML='<iframe frameborder="0" tabindex="-1" style="width:100%; height:100%; filter:alpha(opacity=0);" unselectable="on"></iframe>';
			WindowResizeHandler();
			window.attachEvent('onresize',function() {setTimeout(WindowResizeHandler,1);});
			window.attachEvent('onscroll',WindowResizeHandler);
		}

		overlay=document.body.appendChild(overlay);

		if (!window.opera) window.onfocus=HideOverlay
		if (msie) document.onactivate=HideOverlay
		overlay.onmousedown=HideOverlay;


}

function WindowResizeHandler() { //msie6 only
	overlay.runtimeStyle.cssText='position:absolute; width:'+document.documentElement.scrollWidth+'px; height:'+document.documentElement.scrollWidth+'px;';
}

function HideOverlay() {
	if (tmt.CurrentFloatingFrame) {
		tmt.CurrentFloatingFrame.Blur();
		tmt.CurrentFloatingFrame=null;
	}
	overlay.style.visibility='hidden';	
}


	

var fff=document.createElement('div');

fff.innerHTML=''+



'<div class="ctop1" unselectable="on"><div class="ctop2" unselectable="on"><div class="ctop3" unselectable="on"></div></div></div>'+
'<div class="cmiddle1" unselectable="on"><div class="cmiddle2" unselectable="on"><div class="cmiddle3" style="background-color:'+bgcolor+';">'+

(msie6 ? '<iframe frameborder="0" tabindex="-1" style="position:absolute; z-index:-1; top:0; left:0; width:expression(this.nextSibling.offsetWidth+\'px\'); height:expression(this.nextSibling.offsetHeight+\'px\'); filter:alpha(opacity=0);" unselectable="on"></iframe>' : '')+
'<div style="'+(msie6 ? 'width:100%;' : 'height:100%;')+' border:solid '+border+'px '+inactivecolor+';" unselectable="on">'+
'<iframe frameborder="0" scrolling="no" allowtransparency="true" style="width:100%;" unselectable="on"></iframe>'+
'</div>'+

'</div></div></div>'+
'<div class="cbottom1" unselectable="on"><div class="cbottom2" unselectable="on"><div class="cbottom3" unselectable="on"></div></div></div>'+
'';

fff.className='tmt-win';
fff.style.cssText='position:'+(msie6 ? 'absolute' : 'fixed')+'; z-index:'+tmt.FloatingFramesZ+'; width:1px; height:1px; cursor:default;';
var frames=fff.getElementsByTagName('IFRAME');
//var cloke=(msie6 ? frames[0] : null);
var frame=frames[frames.length-1];
var framecontainer=frame.parentNode;//.parentNode;

//	fff.style.display='none';
//	fff.style.visibility='hidden';

fff=document.body.appendChild(fff);			
AddEvent(fff,'contextmenu',ContextMenuHandler);






	

if (document.elementFromPoint) fff.onmousedown=function(evt) {

	if (!evt) evt=event;

	if (evt.preventDefault) evt.preventDefault(); //safari

	framecontainer.style.visibility='visible'; //to hide only the shadow
	fff.style.visibility='hidden'; //important that none of the child nodes have visibility:visible set in for example a stylesheet...

	try {
		var page=(msie || firefox ? false : true);
		var elt=document.elementFromPoint((page ? evt.pageX : evt.clientX),(page ? evt.pageY : evt.clientY));

		if (elt) {
//alert(elt.outerHTML);
			if (elt==overlay) { //safari and mozilla
				fff.style.visibility='visible';
				window.focus(); //important for safari and firefox that we set focus (not only call HideOverlay)
				return;
			}

			if (elt.nodeName!='IFRAME') {
				var eee=GetSelfOrAncestorThenHasClass(elt,'tmt-win');
				if (eee!=null) {
					if (eee!=fff) eee.onmousedown(evt);	
					fff.style.visibility='visible';	
					return;
				}
			}

			fff.style.visibility='visible';
	
//			if (window.opera && elt.nodeName=='IFRAME') elt.contentWindow.focus(); else elt.focus();			
			if (elt.contentWindow) elt.contentWindow.focus(); else elt.focus();


		}	
	}
	catch(e) {
		fff.style.visibility='visible';
	}



}

	





			if (frame.readyState) frame.onreadystatechange=function() {
				if (this.readyState=='complete') {

					InitContentWindow(this);
this.onactivate=function() {
	event.cancelBubble=true;
}
//					this.onfocus=FocusHandler;
//!!					this.onblur=BlurHandler; 

this.contentWindow.document.body.onfocus=function() {FocusHandler.call(frame)} //msie6 needs it attached to the body...

					Resize.call(this,true);

//					if (autofocus) this.focus();
					if (autofocus) {
						this.contentWindow.focus();
						FocusHandler.call(this);
					}

					this.onreadystatechange=function() {
						if (this.readyState=='complete') {
							if (closeonreload) Close.call(this);
							else {
								InitContentWindow(this);
this.contentWindow.document.body.onfocus=function() {FocusHandler.call(frame)} //msie6 needs it attached to the body...
								Resize.call(this,false);
							}
						}
					}

				}
			}
			else frame.onload=function() {

				InitContentWindow(this);
/*
this.onmousedown=function() {
	event.cancelBubble=true;
}
*/
//this.onfocus=FocusHandler;
//this.onblur=BlurHandler; 
/*
this.addEventListener('focus',FocusHandler,false);
this.addEventListener('blur',BlurHandler,false);
this.contentWindow.addEventListener('focus',FocusHandler,false);
this.contentWindow.addEventListener('blur',BlurHandler,false);
this.contentWindow.document.addEventListener('focus',FocusHandler,false);
this.contentWindow.document.addEventListener('blur',BlurHandler,false);
*/

				this.contentWindow.onfocus=function() {FocusHandler.call(frame)}
/*
				this.contentWindow.onblur=function(evt) {
					//document check needed by mozilla 2.0
//					if (evt.target.toString()=='[object HTMLDocument]' && evt.target==frame.contentWindow.document) BlurHandler.call(frame)
					BlurHandler.call(frame)
				}
*/

//!!				this.onmousedown=function() {this.contentWindow.focus(); return false;} //firefox and opera

				Resize.call(this,true);

				if (autofocus) {
					this.contentWindow.focus();
					FocusHandler.call(this);
				}

				this.onload=function() {
					if (closeonreload) {
//						this.onload=null;
//						this.src='';					
						Close.call(this);
					}
					else {
						InitContentWindow(this);
						this.contentWindow.onfocus=function() {FocusHandler.call(frame)}
//						this.contentWindow.onblur=function() {BlurHandler.call(frame)}
/*
this.contentWindow.addEventListener('focus',FocusHandler,false);
this.contentWindow.addEventListener('blur',BlurHandler,false);
this.contentWindow.document.addEventListener('focus',FocusHandler,false);
this.contentWindow.document.addEventListener('blur',BlurHandler,false);
*/
						Resize.call(this,false);
					}
				}
			}

			//firefox persists the floating frame when navigating the browser history, which is very good, but since no other browser does this we clean it all up when the host page is unloading...
			if (window.attachEvent) {
				window.attachEvent('onunload',function() {Close.call(frame,null,true);});
			}
			else if (window.addEventListener) {
				window.addEventListener('unload',function() {Close.call(frame,null,true);},false);
			}

var requiredmovehandleclass='';//'handle';
var draghelper=null;				
			function InitContentWindow(frame) {

				var win=frame.contentWindow;
				if (typeof(win.document)=='unknown') return; //no access

				var doc=win.document;
				if (!doc) return;
				if (!doc.body) alert('No body, yet...?'); //mozilla3?




var elt=doc.getElementById('header');
if (elt) {
	var bgcolor=null;
	if (elt.currentStyle) bgcolor=elt.currentStyle.backgroundColor;
	else if (elt.ownerDocument.defaultView && elt.ownerDocument.defaultView.getComputedStyle) {
		var style=elt.ownerDocument.defaultView.getComputedStyle(elt,null);
		if (style) bgcolor=style.getPropertyValue('background-color');
	}
//	alert(bgcolor);
	if (bgcolor!='transparent' && bgcolor!='rgba(0, 0, 0, 0)') requiredmovehandleclass=elt.className;
}
//alert(requiredmovehandleclass);



				if (resizeble) draghelper=doc.createElement(msie ? 'img' : 'span');
if (draghelper) {
				if (blankimage) draghelper.src=blankimage;

//draghelper.style.cssText='opacity:0; filter:alpha(opacity=0); position:'+(msie6 ? 'absolute' : 'fixed')+'; z-index:0; left:0; top:0;'+(msie6 ? ' width:200%; height:200%;' : ' width:100%; height:100%; -moz-user-select:none;');
//draghelper.style.cssText='background-color:red; position:'+(msie6 ? 'absolute' : 'fixed')+'; z-index:0; left:0; top:0;'+(msie6 ? ' width:200%; height:200%;' : ' width:100%; height:100%; -moz-user-select:none;');				


//draghelper.style.cssText=(msie6 ? 'background-color:transparent; width:200%;' : 'width:100%;')+' height:100%; left:0; top:0; filter:alpha(opacity=0); opacity:0; -moz-user-select:none;';
draghelper.style.cssText=(msie6 ? 'width:200%;' : 'width:100%;')+' height:100%; left:0; top:0; background-color:#210; xfilter:alpha(opacity=0); xopacity:0; user-select:none; -khtml-user-select:none; -moz-user-select:none;';
draghelper.unselectable='on';

/*
draghelper.unselectable='on';
draghelper.setAttribute('draggable','false');
-moz-user-focus:ignore; -moz-user-input:disabled; -moz-user-select:none;

*/
				//draghelper=doc.body.insertBefore(draghelper,doc.body.firstChild);
				//draghelper=doc.body.appendChild(draghelper);

				if (draghelper) {
					PutDragHandlerInBody();
draghelper.style.filter='alpha(opacity=33)';
draghelper.style.opacity=0.33;
					draghelper.style.zIndex=1;
				}





				draghelper.ondblclick=ToggleMaximizeRestore; //todo: only if in "handle" area...

				//draghelper.onclick=ToggleMaximizeRestore;
				//draghelper.onmousedown=ToggleMaximizeRestore;
				//draghelper.onmouseup=ToggleMaximizeRestore;

}

//				if (draghelper) doc.documentElement.style.margin=doc.documentElement.style.padding=doc.body.style.margin=doc.body.style.padding=0;
				if (draghelper) doc.body.style.margin=0; //msie
//doc.body.style.cssText='user-select:none; -moz-user-select:none; -khtml-user-select:none; -moz-user-focus:ignore; -moz-user-input:disabled; -moz-user-select:none;';
doc.documentElement.style.cssText='user-select:none; -khtml-user-select:none; -moz-user-select:-moz-none;';
//doc.body.style.cssText='xuser-select:none; -moz-user-select:text; x-khtml-user-select:none;';



//alert(doc.body.offsetLeft+':'+doc.body.clientLeft);


				AddEvent(doc,'mouseover',MouseOverHandler);
				if (draghelper) AddEvent(draghelper,'mousedown',MouseDownHandler);
				AddEvent(frame,'contextmenu',ContextMenuHandler);
				AddEvent(doc,'contextmenu',ContextMenuHandler);

				if (msie) { //draghelper.nodeName=='IMG') { //doc.attachEvent && !doc.addEventListener) { //opera supports them both...	
/*
win.attachEvent('onresize',ResizeHandler);			
win.attachEvent('onscroll',ResizeHandler);
//doc.attachEvent('ondragstart',DragStartHandler);
*/

					doc.attachEvent('onselectstart',SelectStartHandler);

					if (draghelper) draghelper.attachEvent('onmousemove',MouseMoveHandler);
					if (draghelper) draghelper.attachEvent('onmouseup',MouseUpHandler);

					


				}
				else {	//if (doc.addEventListener) {

/*
win.addEventListener('resize',ResizeHandler,false);	
win.addEventListener('scroll',ResizeHandler,false);	
//win.addEventListener('dragstart',DragStartHandler,false);
*/

					win.addEventListener('scroll',function() { //firefox
						doc.documentElement.scrollLeft=0; 
						doc.documentElement.scrollTop=0;
					},false);

					//win.addEventListener('selectstart',DragStartHandler,false); //does not work for mozilla (but we also use -moz-user-select:none)

					doc.addEventListener('mousemove',MouseMoveHandler,false);
					document.addEventListener('mousemove',MouseMoveHandler,false); //mozilla
					doc.addEventListener('mouseup',MouseUpHandler,false);
					document.addEventListener('mouseup',MouseUpHandler,false); //mozilla3



				}

				if (window.opera) window.addEventListener('resize',function() {
					if (IsMaximized()) {
						frame.style.width=document.documentElement.clientWidth+'px'
						frame.style.height=document.documentElement.clientHeight+'px'
					}
				},false);






try {
				win.close=function() {
//					setTimeout(function() {Close.call(frame,win.returnValue);},1); //safari sometimes crashes if no timeout here (if the calling thread originate from an embeded iframe...)
					Close.call(frame,this.returnValue); //not anymore - and it is important to no "loose any threeds" here...
				}
}
catch (e) {
//	alert(e.message);  //msie5.5 error on setting win.close...
}


				win.maximize=function() {
					ToggleMaximizeRestore();
				}


				if (doc.body) {

//					doc.body.tabIndex=-1;
					doc.body.hideFocus=true;

					if (!msie && !firefox && !window.opera) {
						doc.body.insertBefore(CreateHiddenFocusableElement(doc),doc.body.firstChild);
						doc.body.appendChild(CreateHiddenFocusableElement(doc));
					}

					if (bgcolor=='transparent' && doc.body.getAttribute('bgColor')=='') doc.body.setAttribute('bgColor','transparent');
				}
			}

		function CreateHiddenFocusableElement(doc) {
			var elt=doc.createElement('input');
			elt.style.cssText='position:absolute; left:0; top:-2px; height:1px; padding:0; border-width:0; background-color:transparent;';
			elt.readOnly=true;
		//	elt.onfocus=function() {
		//		if (this.nextSibling.contentWindow) this.nextSibling.contentWindow.focus();
		//		if (this.previousSibling.contentWindow) this.previousSibling.contentWindow.focus();
		//		return false;
		//	}
			return elt;
		}

		function AddEvent(elt,event,f) {

			if (elt.addEventListener) elt.addEventListener(event,f,false);
			else if (elt.attachEvent) elt.attachEvent('on'+event,f);
			else elt['on'+event]=function(evt) {
				if (evt) f(evt);
				else {
					var doc=this.ownerDocument;
					var win=(doc ? doc.parentWindow : this.parentWindow);
					var event=(win ? win.event : this.event);
					f(event ? event : window.event);
				}
			};
		}

		

		var beforemaximzedheight=null;
		function IsMaximized() {
			return (beforemaximzedheight!=null);
//			var position=(msie6 ? 'absolute' : 'fixed');
//			return (frame.style.position==position);
		}
		function ToggleMaximizeRestore() {

			var position=(msie6 ? 'absolute' : 'fixed');
			if (IsMaximized()) {

				if (position=='absolute') {
					framecontainer.appendChild(frame);
					document.body.runtimeStyle.cssText='';
					frame.runtimeStyle.cssText='';
				}

				frame.style.cssText='width:100%; height:'+beforemaximzedheight;
				if (msie6) frame.allowTransparency=true;

				if (!firefox2) document.documentElement.style.overflow='';
				beforemaximzedheight=null;
			}
			else {

				beforemaximzedheight=frame.style.height;
				if (!firefox2) document.documentElement.style.overflow='hidden';

				if (msie6) frame.allowTransparency=false; // needed by msie6 to hide window controls such as the select element...
				frame.style.cssText='position:'+position+'; z-index:'+fff.style.zIndex+'; left:0; top:0; width:100%; height:100%; background-color:window;'; //since msie6 need to turn off allowTransparency, we set a window background to get the same apparence for other browsers

				if (position=='absolute') {

					frame.runtimeStyle.cssText='left:'+(document.documentElement.scrollLeft)+'px; top:'+(document.documentElement.scrollTop)+'px;';
					document.body.runtimeStyle.cssText='width:100%;';
					document.body.appendChild(frame);	
				}

			}
		}

		function DragStartHandler(evt) {
			//alert('DragStartHandler');
			return ContextMenuHandler(evt);
		}
		function SelectStartHandler(evt) {
			//alert('SelectStartHandler');
			return ContextMenuHandler(evt);
		}
		function ResizeHandler(evt) {
		}

		function IsControlElement(elt) {
//alert(elt.isContentEditable+' '+elt.contentEditable+' '+elt.getAttribute('contentEditable'));
			if (elt.nodeType!=1) elt=elt.parentNode; //firefox
			return (elt.isContentEditable || elt.getAttribute('contentEditable')=='true' || elt.type=='text' || elt.type=='textarea'); //elt.getAttribute('contentEditable') is for mozilla
		}


		var movingelt=null;
		var dx, dy;
		function MouseDownHandler(evt) {

			me.Focus();
			if (evt.button!=(msie ? 1 : 0)) return true;

			var elt=(evt.srcElement || evt.target);
//			if (elt && ((' '+elt.className+' ').indexOf(' handle ')>=0 || elt.nodeName=='BODY' || elt.nodeName=='HTML')) {
		//	if (elt && (elt.getAttribute('unselectable') || (' '+elt.className+' ').indexOf(' handle ')>=0 || elt.nodeName=='BODY' || elt.nodeName=='HTML')) {
//			if (elt && elt.nodeName!='A' && elt.nodeName!='BUTTON') {
//alert(elt.outerHTML);

//			if (elt && !IsControlElement(elt) && elt.nodeName!='BUTTON' && elt.nodeName!='INPUT' && elt.nodeName!='TEXTAREA' && elt.nodeName!='SELECT') {
			if (elt) {

//!!				if (elt.unselectable && document.activeElement!=frame) frame.focus(); //msie

				if (elt.nodeName!='SELECT') { //safari kills the frame if a select...

//elt.unselectable='on';
//document.title=evt.screenX+':'+evt.clientX+':'+evt.offsetX+':'+evt.x



					movingelt=new MovingElement(fff,frame,evt);



					//if (!movingelt.IsResize()) && elt!=draghelper && (' '+elt.parentNode.className+' ').indexOf(' handle ')<0) {
					
					if (requiredmovehandleclass && !movingelt.IsResize() && GetSelfOrAncestorThenHasClass(draghelper,requiredmovehandleclass)==null) {
						movingelt=null;
					}
					else {

						movingelt.BeginMove();

						if (evt.preventDefault) evt.preventDefault(); //firefox3
						//me.Focus();

						return false;
					}
				}
			}

			return true;
		}

//		function SelfOrAncestorHasClass(elt,classname) {
//			return (GetSelfOrAncestorThenHasClass(elt,classname)!=null)
//		}
		function GetSelfOrAncestorThenHasClass(elt,classname) {
			while (elt && (' '+elt.className+' ').indexOf(' '+classname+' ')<0) elt=elt.parentNode;
			return elt;
		}

		function GetOwnerDocument(elt) {
			return (elt.ownerDocument ? elt.ownerDocument : elt.document);
		}
		function SetCursor(evt) {

//if (movingelt) return;

			var elt=(evt.srcElement || evt.target);
			if (GetOwnerDocument(elt)==GetOwnerDocument(frame)) return; //chrome

			//alert(GetOwnerDocument(elt).body.offsetLeft+':'+GetOwnerDocument(elt).body.clientLeft);

			var b=4;
//alert(GetOwnerDocument(elt).documentElement.offsetWidth+' '+GetOwnerDocument(elt).body.offsetWidth);
//alert(GetOwnerDocument(elt).documentElement.clientWidth+' '+GetOwnerDocument(elt).body.clientWidth)

			var rx=0; 
			if (evt.clientX<b) rx=-1; else if (evt.clientX>=frame.clientWidth-b) rx=1;

			var ry=0;
			if (evt.clientY<b) ry=-1; else if (evt.clientY>=frame.clientHeight-b) ry=1;

//document.title=rx+':'+ry+' - '+(elt.ownerDocument==frame.ownerDocument);

			var cursor='';

			if (rx<0 && evt.clientY<b*4 || evt.clientX<b*4 && ry<0) {
				cursor='nw-resize';
			}
			else if (rx<0 && evt.clientY>=frame.clientHeight-b*4 || evt.clientX<b*4 && ry>0) {
				cursor='sw-resize';
			}
			else if (rx>0 && evt.clientY<b*4 || evt.clientX>=frame.clientWidth-b*4 && ry<0) {
				cursor='ne-resize';
			}
			else if (rx>0 && evt.clientY>=frame.clientHeight-b*4 || evt.clientX>=frame.clientWidth-b*4 && ry>0) {
				cursor='se-resize';
			}

			if (!cursor) {
				if (rx<0) cursor='w-resize'; else if (rx>0) cursor='e-resize';				
				if (ry<0) cursor='n-resize'; else if (ry>0) cursor='s-resize';				
			}

			if (draghelper) draghelper.style.cursor=cursor;

//			if (draghelper) document.title=cursor;

		}

		function MouseOverHandler(evt) {

if (movingelt) return;
			if (!draghelper) return;
			//draghelper.style.left=10+'px';
			//draghelper.style.top=10+'px';

			var elt=(evt.srcElement || evt.target);
if (elt==draghelper) return;

//if (!elt || elt==draghelper || elt.className=='icon' || elt.parentNode.className=='icon') return;
//if (elt && (elt.nodeName=='BODY' || elt.id=='title')) { //elt.id=='header')) return;

//if (elt && (elt.nodeName=='BODY2' || elt.nodeName=='DIV')) {

	if (requiredmovehandleclass) elt=GetSelfOrAncestorThenHasClass(elt,requiredmovehandleclass);
		else elt=elt.parentNode;

if (elt && elt.nodeName=='DIV') {

try {

			//if (elt.id=='title') elt=elt.parentNode.parentNode;
/*
			if (elt.nodeName=='BODY') {
				if (!msie6) draghelper.style.position='fixed';
			}
			else {
				if (!msie6) draghelper.style.position='absolute';
				elt=elt.parentNode;
			}
*/

//			if (elt.nodeName!='BODY') if (!requiredmovehandleclass) elt=elt.parentNode;
			if (draghelper==elt.firstChild) return;
			
			elt.insertBefore(draghelper,elt.firstChild);
			EnsureDragHandlerPosition();


			return;
}
catch (e) {
	alert(elt.nodeName+' '+e.description);
	//if (draghelper.parentNode) draghelper.parentNode.removeChild(draghelper);
//	PutDragHandlerInBody();

}
}
			PutDragHandlerInBody();


		}

		function PutDragHandlerInBody() {
			var doc=draghelper.ownerDocument;
			if (draghelper!=doc.body.firstChild) {
				doc.body.insertBefore(draghelper,doc.body.firstChild);	
				EnsureDragHandlerPosition();
			}
		}
		function EnsureDragHandlerPosition() {
			var position=(!msie6 && draghelper.parentNode.nodeName=='BODY' ? 'fixed' : 'absolute');
			if (draghelper.style.position!=position) draghelper.style.position=position;
		}

		function MouseMoveHandler(evt) {

			if (!movingelt) {
				SetCursor(evt);
				return true;
			}

//movingelt.BeginMove();
			movingelt.Move(evt);
/*
evt.returnValue=!false; 
if (!evt.returnValue && evt.preventDefault) evt.preventDefault(); //needed by firefox
//evt.cancelBubble=true; 
return evt.returnValue;
*/


			return false; /* msie can not return false here because then text on the page can not be selected... */
		}
		function MouseUpHandler(evt) {
			if (movingelt) {
				movingelt.EndMove();
				movingelt=null;
			}
		}
		function ContextMenuHandler(evt) {
			var elt=(evt.srcElement || evt.target);
			evt.returnValue=IsControlElement(elt);
			if (!evt.returnValue && evt.preventDefault) evt.preventDefault(); //needed by firefox
			return evt.returnValue;
		}

		function MovingElement(elt,elt2,evt) {

//			this.elt=elt;
//			this.elt2=elt2;

			var sx=evt.screenX;
			var sy=evt.screenY;

			var x=elt.offsetLeft;
			var y=elt.offsetTop;

			var w=elt.offsetWidth;
			var h=elt2.offsetHeight;

			if (msie6) w-=30;

//			var b=3; //html.style.border+body.style.margin

			var rx=0; 
//			if (evt.clientX<b) rx=-1; else if (evt.clientX>=elt2.clientWidth-b) rx=1;

			var ry=0;
//			if (evt.clientY<b) ry=-1; else if (evt.clientY>=elt2.clientHeight-b) ry=1;

			if (draghelper) {
				switch(draghelper.style.cursor) {
				case 'nw-resize': rx=-1; ry=-1; break;
				case 'sw-resize': rx=-1; ry=1; break;
				case 'ne-resize': rx=1; ry=-1; break;
				case 'se-resize': rx=1; ry=1; break;
				case 'w-resize': rx=-1; break;
				case 'e-resize': rx=1; break;
				case 'n-resize': ry=-1; break;
				case 's-resize': ry=1; break;				
				}
			}

			this.IsResize=function() {
				return !(rx==0 && ry==0);
			}

			this.Move=function(evt) {

				var dx=sx-evt.screenX;
				var dy=sy-evt.screenY;

				if (rx>0) {
					if (w-dx<minw) dx=w-minw;
					elt.style.width=(w-dx)+'px';
				}
				else if (rx<0) {
					if (w+dx<minw) dx=minw-w;
					elt.style.width=(w+dx)+'px';
					elt.style.left=(x-dx)+'px';
				}
				else if (ry==0) elt.style.left=(x-dx)+'px';

				if (ry>0) {
					if (h-dy<minh) dy=h-minh;
					elt2.style.height=(h-dy)+'px';
//if (msie) elt2.contentWindow.document.documentElement.fireEvent('onresize');
				}
				else if (ry<0) {
					if (h+dy<minh) dy=minh-h;
					elt2.style.height=(h+dy)+'px';
					elt.style.top=(y-dy)+'px';
//if (msie) elt2.contentWindow.document.documentElement.fireEvent('onresize');
				}
				else if (rx==0) elt.style.top=(y-dy)+'px';

			}
			this.BeginMove=function() {
if (draghelper) {
	PutDragHandlerInBody();
	draghelper.style.zIndex=1;
}

return;
//mozilla2:
				if (this.iii) return;

				var doc=elt2.contentWindow.document;

				this.iii=doc.createElement('div');
				this.iii.style.cssText='position:absolute; left:0; top:0; width:100%; height:100%; background-color:blue;';
				this.iii=doc.body.appendChild(this.iii);

			}
			this.EndMove=function() {
if (draghelper) {
//	var doc=draghelper.ownerDocument;
//	doc.body.insertBefore(draghelper,doc.body.firstChild);
	draghelper.style.zIndex=0;
}

return;
//mozilla2:
				if (this.iii && this.iii.parentNode) this.iii.parentNode.removeChild(this.iii);
			}

		}

		this.WriteHTML=function(html) {
			with (frame.contentWindow.document) {
				open('text/html','replace');
				write(html);
				close();
			}
		}

		this.LoadURL=function(url,direct) {
			if (direct) frame.src=url;
			else {
				var http=tmt.CreateXMLHttp();
				http.open('GET',url,false);
				http.send('');
				this.WriteHTML(http.responseText);
			}
		}
		this.Hide=function() {
//			frame.style.visibility='hidden';
fff.style.visibility='hidden';
		}
		this.Show=function() {
//			frame.style.visibility='visible';
fff.style.visibility='visible';
		}
		this.Focus=function() {
			try {
				var win=frame.contentWindow;				
				if (msie && win.document.activeElement) win.document.activeElement.focus(); else win.focus();
			}
			catch (e) {
				FocusHandler.call(frame);
			}		

		}
	}
