var dragapproved=false
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
	if (ie5&&dragapproved&&event.button==1){
		document.getElementById("dhtmlwin").style.left=tempx+event.clientX-offsetx+"px"
		document.getElementById("dhtmlwin").style.top=tempy+event.clientY-offsety+"px"
	}
	else if (ns6&&dragapproved){
		document.getElementById("dhtmlwin").style.left=tempx+e.clientX-offsetx+"px"
		document.getElementById("dhtmlwin").style.top=tempy+e.clientY-offsety+"px"
	}
}

function initializedrag(e){
	offsetx=ie5? event.clientX : e.clientX
	offsety=ie5? event.clientY : e.clientY
	tempx=parseInt(document.getElementById("dhtmlwin").style.left)
	tempy=parseInt(document.getElementById("dhtmlwin").style.top)
	dragapproved=true
	document.getElementById("dhtmlwin").onmousemove=drag_drop
}

function loadwindow(width,height){
	if (ie5||ns6){
		document.getElementById("dhtmlwin").style.display=''
		document.getElementById("dhtmlwin").style.width=initialwidth=width+"px"
		document.getElementById("dhtmlwin").style.height=initialheight=height+"px"
		document.getElementById("dhtmlwin").style.left="240px"
		document.getElementById("dhtmlwin").style.top=ns6? window.pageYOffset*1+150+"px" : iecompattest().scrollTop*1+150+"px"
	}
}

function closeit(){
	document.getElementById("dhtmlwin").style.display="none"
}

function stopdrag(){
	dragapproved=false;
	document.getElementById("dhtmlwin").onmousemove=null;
}