// ==== js class definition ====
// make helper balloon
var divHelper = Class.create();
divHelper.prototype = {
	initialize: function(targetid, c, w) {
		this.element = $(targetid);
		this.id = 'divhelper';
		this.helper = $(this.id);
		this.helpmarginleft = 4;
		this.helpmarginbottom = 8;
		if (c == undefined) c = 'balloon2';
		if (w == undefined) w = '200px';
		this.classname = c;
		this.width = w;

		if (this.helper == undefined) {
			//alert('helper div is not found');
			this.helper = document.createElement("div");
			this.helper.id = this.id;
			this.helper.className = this.classname;
			if (this.width != undefined)
				this.helper.style.width = this.width;
			this.helper.className = this.classname;

			document.body.appendChild(this.helper);
		}

	},
	show: function(msg) {
		this.helper.innerHTML = msg;
		
		var helpdim = Element.getDimensions(this.helper);
		var elmdim = Element.getDimensions(this.element);
		var elmpos = Position.positionedOffset(this.element);
		
		var helpleft = elmpos[0] + this.helpmarginleft;
		var helptop = elmpos[1] + elmdim.height + this.helpmarginbottom;
		this.helper.style.left = helpleft+'px';
		this.helper.style.top  = helptop +'px';
		
		Element.show(this.helper);
	},
	hide: function() {
		Element.hide(this.helper);
	}
};

// ==== js class definition ====


// show summary
function showsum(target_id, visible, sum_id) {
	var helper= new divHelper(target_id);
	var d = document.getElementById(sum_id);
	//var helper = document.getElementById(target_id);
	if (visible == 1) {
		if (d) {
			if (d.style.display == 'none') {
				helper.show(d.innerHTML);
			}
		}
	} else {
		helper.hide();
		if (d) {
			d.style.display = 'none';
		}
	}
}

function showpop(target_id, visible) {
	var d = document.getElementById(target_id);
	d.className = 'balloon2';
	if (visible == 1) {
		d.style.display ==''
  }else{
    Element.hide(d);
  }
}

