function openPopup(left, top, width, height, title, content, ctrl) {
	cross("popup").style.display = "none";
	

	width += 30
	height += 40
	sTop = document.body.scrollTop;
	maxHeight = document.body.clientHeight + sTop - top - height;
	if (ctrl) left = left - width;
	if (height < document.body.clientHeight - 15) if (maxHeight < 15) top = top + maxHeight - 15;
	if (sTop > top) top = sTop + 10;
	if (top < 32) top = 32;
	
	cross("popup").style.width = width + "px";
	cross("popup").style.height = height + "px";
	cross("HIDDEN_t").style.width = width - 31 + "px";
	cross("HIDDEN_b").style.width = width - 31 + "px";
	cross("HIDDEN_c").style.width = width - 31 + "px";
	cross("HIDDEN_c").style.height = height - 31 + "px";
	cross("HIDDEN_l").style.height = height - 31 + "px";
	cross("HIDDEN_r").style.height = height - 31 + "px";
	cross("popup_cont").width = width - 45 + "px";
	cross("popup_table").width = width - 15 + "px";
	cross("popup_table").height = height - 15 + "px";
	cross("inner").style.width = width - 15 + "px";
	cross("inner").style.height = height - 15 + "px";
	cross("popup").style.left = left + "px";
	cross("popup").style.top = top + "px";
	cross("title").innerHTML = title;
	
	if (content != "") cross("p_cont").innerHTML = content;
	
	cross("popup").style.display = "block";
}

function closePopup() {
	cross("popup").style.display = "none";
	cross("p_cont").innerHTML = "";
}

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header

isIE = document.all;
isNN =! document.all && document.getElementById;
isN4 = document.layers;
isHot = false;

function ddInit(el){
	topDog = isIE ? "BODY" : "HTML";
	whichDog = isIE ? document.all.popup : document.getElementById("popup");  
	hotDog = isIE ? event.srcElement : el.target;  

	while (hotDog.id != "popup_drag" && hotDog.tagName != topDog) {
		hotDog = isIE ? hotDog.parentElement : hotDog.parentNode;
	}  

	if (hotDog.id == "popup_drag") {
		offsetx = isIE ? event.clientX : el.clientX;
		offsety = isIE ? event.clientY : el.clientY;

		nowX = parseInt(whichDog.style.left);
		nowY = parseInt(whichDog.style.top);

		ddEnabled = true;
		document.onmousemove = dd;
	}
}

function dd(el){
	if (!ddEnabled) return;

	whichDog.style.left = isIE ? nowX + event.clientX - offsetx : nowX + el.clientX - offsetx; 
	whichDog.style.top = isIE ? nowY + event.clientY - offsety : nowY + el.clientY - offsety;

	return false;  
}

function ddN4(whatDog){
	if (!isN4) return;

	N4 = eval(whatDog);
	N4.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);

	N4.onmousedown = function(el) {
		N4.captureEvents(Event.MOUSEMOVE);
		N4x = el.x;
		N4y = el.y;
	}

	N4.onmousemove = function(el) {
		if (isHot) {
			N4.moveBy(el.x - N4x, el.y - N4y);

			return false;
		}
	}

	N4.onmouseup = function() {
		N4.releaseEvents(Event.MOUSEMOVE);
	}
}

document.onmousedown = ddInit;
document.onmouseup = Function("ddEnabled = false");