function Popup(popupName, backgroundName, closeName, width, height) {

	this.popupName = popupName;
	this.backgroundName = backgroundName;
	this.closeName = closeName;
	this.popupStatus = 0;
	this.width = width;
	this.height = height;

}

Popup.prototype.SetHeight = function(height) {
	this.height = height;
}

Popup.prototype.SetWidth = function(width) {
	this.width = width;
}

Popup.prototype.GetCloseName = function() {
	return this.closeName;
}

Popup.prototype.LoadPopup = function() {
	//alert("called load " + this.width + " " + this.height);
	this.CenterPopup();
	//loads popup only if it is disabled
	if(this.popupStatus==0){
		$(this.backgroundName).css({
			"opacity": "0.7"
		});
		
		$(this.popupName).width(this.width);
		$(this.popupName).height(this.height);
		//alert($(this.popupName).width());
		$(this.backgroundName).fadeIn("slow");
		$(this.popupName).fadeIn("slow");
		this.popupStatus = 1;
	}
}

Popup.prototype.DisablePopup = function() {
	//disables popup only if it is enabled
	if(this.popupStatus==1){
		$(this.backgroundName).fadeOut("slow");
		$(this.popupName).fadeOut("slow");
		this.popupStatus = 0;
	}
}

Popup.prototype.CenterPopup = function() {
	//alert("center");
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = this.height;
	var popupWidth = this.width;
	//centering
	$(this.popupName).css({
		"position": "fixed",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	
	$(this.backgroundName).css({
		"height": windowHeight
	});
}

Popup.prototype.ResizeFrame = function(f) {
	f.style.height = f.contentWindow.document.body.scrollHeight + "px";
}
