
ie = (document.all)?true:false
function popup(w,h,x,y,titel)
{
 
	
	winW = document.body.offsetWidth;

	winH = document.body.offsetHeight;
	xTotW = x + w;
	if (xTotW > winW){
	x = winW - w - 25
	}
	xTotH = y + h;
	if (xTotH > winH){
	y = winH - h - 10
	}

//regel 20
  var winBody = new popvar(x,y,w,h,"#c8c8b4");
  var Balk = new popvar(4,3,w-14,18,"#FFc8b4");
  var venster = new popvar(4,26,w-10,h-40,"#fFfae6");
  var titeltext = document.createTextNode(titel);
  winBody.style.backgroundColor = "#FEFEE4";
  winBody.style.borderStyle = "ridge";
  winBody.style.borderWidth = "5px";
  winBody.style.borderColor = "#fafae6";
  
  winBody.style.zIndex = (popup.zCount++)

  Balk.style.color = "#ffffff";
  Balk.style.fontFamily = "arial";
  Balk.style.fontSize = "10pt";
  Balk.style.fontWeight = "bold";
  Balk.style.paddingLeft="2px";
  Balk.style.paddingRight="2px";
  Balk.style.borderStyle = "outset";
  Balk.style.borderWidth = "1px";
  Balk.style.backgroundColor = "#DA1623";
  Balk.style.backgroundImage = "url('bg.jpg')";
  Balk.proxyFor = winBody;

  Sleep.manage(Balk)

  venster.style.width = (parseInt(venster.style.width)-4)+"px"
  venster.style.borderColor="#c8c8b4"
  venster.style.borderStyle="inset"
  venster.style.borderWidth="1px"
  venster.style.overflow="auto"
  venster.style.paddingLeft="3px"
  venster.style.paddingRight="0px"
  venster.style.fontFamily = "arial"
  venster.style.fontSize = "10pt"
  winBody.content = venster;
//regel 50
  venster.innerHTML = iText
  winBody.appendChild(venster)
  Balk.appendChild(titeltext)
  winBody.appendChild(Balk)
  return winBody
}

popup.zCount=0;

function popvar (x,y,w,h,col){
	var lyr = document.createElement("DIV")
 	 lyr.style.position = "absolute"
	 lyr.style.left = x + "px"
	 lyr.style.top = y + "px"
	 lyr.style.width = w + "px"
	 lyr.style.height = h + "px"
	 lyr.style.backgroundColor = "transparent"
	 
	 lyr.style.visibility = "visible"
	 lyr.style.padding= "0px 0px 0px 0px"
	return lyr
}

Sleep = {}

Sleep.trackMouse=function(e){
    if (ie) e = event
	Sleep.mousex = (ie)?e.x:e.pageX
	Sleep.mousey = (ie)?e.y:e.pageY
	if (Sleep.grabbed) {
		var obj = Sleep.grabbedObj.proxyFor||Sleep.grabbedObj
		var x = Math.round(Sleep.mousex - Sleep.lyrx - 7) + "px"
		var y = Math.round(Sleep.mousey - Sleep.lyry - 7) + "px"
		obj.style.left = x
		obj.style.top = y
}
}

Sleep.grab = function(e){
     	e = event
	Sleep.lyrx = (ie)?e.offsetX:e.layerX
	Sleep.lyry = (ie)?e.offsetY:e.layerY
	Sleep.grabbed=true
	Sleep.grabbedObj = this.proxyFor||this
	Sleep.grabbedObj.style.zIndex = parseInt(Sleep.grabbedObj.style.zIndex) + 10
}

Sleep.ungrab = function(){
	
	Sleep.grabbed=false
	Sleep.grabbedObj = null
}
//regel 102
Sleep.manage = function(obj){
	obj.onmousedown = Sleep.grab
	obj.onmouseup = Sleep.ungrab
}

document.onmousemove = Sleep.trackMouse

function Erin(){
	event.srcElement.style.border = "outset 1pt";
	}
function Eruit(){
	event.srcElement.style.border = "inset 1pt";
}

function wprint(){
	window.print();
}



