function myPop() {
	this.square = null;
	this.overdiv = null;

	this.popOut = function(div,title,width,height) {
			//filter:alpha(opacity=25);-moz-opacity:.25;opacity:.25;
			this.square = document.createElement("div");
			this.square.className = "square";
			document.body.appendChild(this.square);
			$(this.square).html("<div class='title' >"+title+"</div><div class=content >" + div.html() + "</div>");
			if (width!=null)
			    $(this.square).css('width',width + 'px');
			if (height!=null)
			    $(this.square).css('height',height + 'px');
			
			var w = parseInt($(this.square).css('width').replace('px'));
			var winw = document.documentElement.offsetHeight;
		    $(this.square).css('left', (winw/2) + 'px');
		    
	}
	this.popOutHtml = function(html,title,width,height) {
			//filter:alpha(opacity=25);-moz-opacity:.25;opacity:.25;
			this.square = document.createElement("div");
			this.square.className = "square";
			document.body.appendChild(this.square);
			$(this.square).html("<div class='title' >"+title+"</div><div class=content >" + html + "</div>");
			if (width!=null)
			    $(this.square).css('width',width + 'px');
			if (height!=null)
			    $(this.square).css('height',height + 'px');
			
			var w = parseInt($(this.square).css('width').replace('px'));
			var winw = document.documentElement.offsetHeight;
		    $(this.square).css('left', (winw/2) + 'px');
		    
	}


	this.popIn = function() {
			if (this.square != null) {
					document.body.removeChild(this.square);
					this.square = null;
			}
            PopUp.removeOverlay();

	}
	this.showOverlay = function () {
	    $('body').append('<div id="mypopoverlay" ></div>');
	    // if IE
	    $('body').css('overflow','hidden');
	    $('html').css('overflow','hidden');
        $("#mypopoverlay").css({opacity:50/100});
        $('select').css('visibility','hidden');
	};
	
	this.removeOverlay = function () {
	    $('body').css('overflow','hidden');
	    $('html').css('overflow','hidden');
        $("#mypopoverlay").remove();
        $('select').css('visibility','show');
	};
	this.ShowWorking = function(obj){
	    if ($('#' +obj.id + '_working').length==0) {
		    var working = document.createElement("div");
		    var img = document.createElement("img");
		    img.src = '/images/waiting_indic2.gif';
		    working.id = obj.id + '_working';
		    working.appendChild(img);
		    var jObj = $(obj);
		    jObj.attr('position',jObj.css('position'));
		    jObj.attr('overflow',jObj.css('overflow'));
		    jObj.css('position', 'relative');
		    working.className = "working";
		    $(working).width(jObj[0].clientWidth);
		    $(working).height(jObj[0].clientHeight);
		    $(img).css('left',jObj[0].clientWidth/2 - (128/2));
		    $(img).css('top',jObj[0].clientHeight/2 - (128/2));
		    
            $(working).css({opacity:50/100});
		    obj.appendChild(working);
            $('select').css('visibility','hidden');
        }
    };
	this.RemoveWorking = function(obj){
	    if ($('#' +obj.id + '_working').length>0) {
	        var sObj = $('#' +obj.id + '_working');
	        sObj.remove();
		    var jObj = $(obj);
		    jObj.css('position', jObj.attr('position'));
		    jObj.css('overflow',jObj.attr('overflow'));
            $('select').css('visibility','show');
        }
	}
}
var PopUp = new myPop();