function initPopUp() {
		
}

function positionPopUp (x,y) {
	var thePopUp = fixElement('popUpWindow');
	var boundingDiv = fixElement('mainArea');
	if (!boundingDiv) boundingDiv = getElement('bcApp20MainContent'); //bcapp 2.0
	if (!x) {
		var x = xMousePos;
		if ((x+getAbsWidth(thePopUp)) > (getAbsX(boundingDiv) + getAbsWidth(boundingDiv))) {
			x-= ((x+getAbsWidth(thePopUp)) - (getAbsX(boundingDiv) + getAbsWidth(boundingDiv)));
		}
	}
	else if (x == "center") {
		x = getAbsX(boundingDiv) + (getAbsWidth(boundingDiv) / 2) - (getAbsWidth(thePopUp) / 2);
		if (x < getAbsX(boundingDiv)) x = getAbsX(boundingDiv);
	}
	if (!y) {
		var y = yMousePos;
		if ((y+getAbsHeight(thePopUp)) > (getAbsY(boundingDiv) + getAbsHeight(boundingDiv))) {
			y-= ((y+getAbsHeight(thePopUp)) - (getAbsY(boundingDiv) + getAbsHeight(boundingDiv)));
		}
	} else if (y == "center") {
		//alert(getAbsHeight(thePopUp) + " " + getAbsHeight(theBoundingDiv));	
	}
	setAbsX(thePopUp,x);
	setAbsY(thePopUp,y);
}

function closePopUp ( flush ) {
	var thePopUp = fixElement('popUpWindow');
	if (!thePopUp) thePopUp = fixParentElement('popUpWindow');
	if( flush ){
		var theFrame = fixElement('popUpFrame');
		if (!theFrame) theFrame = fixParentElement('popUpFrame');
		theFrame.src = '/popUpPlaceholder.php';
	}
	if (document.all) {
		if (parent) parent.positionPopUp(-1000,-1000);
		else positionPopUp(-1000,-1000);
	}
	if (thePopUp) setDisplay(thePopUp,"none");
}

function openPopUp (loc) {
	var thePopUp = fixElement('popUpWindow');
	var theFrame = fixElement('popUpFrame');
	if (loc && theFrame) theFrame.src = loc;
	if (thePopUp) setDisplay( thePopUp, "block");
}


function windowOpen (url) {
	var name = arguments[1];
	var options = arguments[2];
	if (!name) name = "windowPopup";
	if (options) options = "," + options;
	
	console.log("location=no,menubar=no,resizable=yes,toolbar=no,directories=no" + options);
	console.log("window name: " + name);

	window.open(url, name, "location=no,menubar=no,resizable=yes,toolbar=no,directories=no" + options, true);
}

