function popups_closePopup() {
	$j('#darkenScreenDiv').hide();
	$j('#popupContainer').hide("slow");
	
	
	document.body.scroll = "yes";
	document.body.style.overflow = 'auto';
}

function popups_openPopup(){
	if (arguments.length == 0) 
	{
		divWidth = "90%";
		divHeight = "90%";
		divTop = "5%";
		divLeft = "5%";
	} else if (arguments.length == 3 && arguments[0] == 'percent') {
		divWidth = arguments[1];
		divHeight = arguments[2];
		divTop = (100 - parseInt(divHeight.replace("%", ""))) / 2 + '%';
		divLeft = (100 - parseInt(divWidth.replace("%", ""))) / 2 + '%';
	} else if (arguments.length == 3 && arguments[0] == 'pixel') {
		divWidth = arguments[1];
		divHeight =  arguments[2];
		divTop = '50%';
		divLeft = '50%';
		divMarginTop = "-" + parseInt(divHeight.replace("px", "")) / 2 + 'px';
		divMarginLeft = "-" + parseInt(divWidth.replace("px", "")) / 2 + 'px';
	}  else if (arguments.length == 4) {
		width = arguments[0];
		divHeight = arguments[1];
		divTop = arguments[2];
		divLeft = arguments[3];
	}	
	$j('#darkenScreenDiv').show();
	
	if (arguments.length == 3 && arguments[0] == 'pixel') {
		console.log("Test");
		$j('#popupContainer').css({
			'width': divWidth,
			'height': divHeight,
			'top': divTop,
			'left': divLeft,
			'marginLeft': divMarginLeft,
			'marginTop': divMarginTop
		});	
	} else {	
		$j('#popupContainer').css({
			'width': divWidth,
			'height': divHeight,
			'top': divTop,
			'left': divLeft
		});
	}
	$j('#popupContainer').show("slow");
	
	document.body.scroll = "no";
	document.body.style.overflow = 'hidden';
	
	return "popupContainerContents";
}

function popups_loadPageInPopup(url) {
	$j('#popupGeneratorForm').attr("action",url);
	$j('#popupGeneratorForm').submit();
}

