//
// Dynamic comment
//
//pic_info = new Array();

var over = false;
var oHandler = null;
var counter_hide = null;
var counter_dyn = null;
var hide_delay = 300;
var offsetLeft = -5;
var offsetTop = 3;
/*
var skin_start =  '<table cellspacing="0" class="tip"><tr><td><img src="%%filesRef%%tip_l_v.gif" width="7" height="7"></td><td class="top"><img src="%%filesRef%%p.gif" width="1" height="1"></td><td><img src="%%filesRef%%tip_r_v.gif" width="7" height="7"></td></tr><tr><td class="left"><img src="%%filesRef%%p.gif" width="1" height="1"></td><td class="content">';
var skin_end   = '</td><td class="right"><img src="%%filesRef%%p.gif" width="1" height="1"></td></tr><tr><td valign="top"><img src="%%filesRef%%tip_l_n.gif" width="7" height="7"></td><td class="bottom" valign="bottom"><img src="%%filesRef%%tip_end.gif" width="13" height="13"></td><td valign="top"><img src="%%filesRef%%tip_r_n.gif" width="7" height="7"></td></tr></table>';
*/

function PrepareToShow(pobj,num) {
	if(oHandler != null && oHandler.id != pobj.id) {
		over = false;
		HideInfo(oHandler);
	}
	oHandler = pobj;
	over = true;
	ShowInfo(pobj,num);
}

function PrepareToHide(pobj) {
	over = false;
	clearTimeout(counter_hide);
	counter_hide = setTimeout(function() {
		HideInfoDynamic(pobj);
	},hide_delay);
}

function ShowInfo(pobj,num) {
	if(!document.getElementById('infoDiv')) {
		infoObj = document.createElement('div');
		infoObj.setAttribute('id','infoDiv');
		infoObj.style.position = 'absolute';
		infoObj.style.zIndex = 10;
		infoObj.innerHTML = skin_start + pic_info[num] + skin_end;
		infoObj.onmouseover = function() {
			over = true;
			clearTimeout(counter_dyn);
			ObjOpacity(90);
		}
		infoObj.onmouseout = function() {
			PrepareToHide();
		}
		//document.body.appendChild(infoObj);
		pobj.appendChild(infoObj);
		
		//infoObj.style.left = pobj.offsetLeft + pobj.offsetWidth + offsetLeft + 'px';
		//infoObj.style.top = pobj.offsetTop - infoObj.offsetHeight + offsetTop + 'px';
		infoObj.style.left = offsetLeft + 'px';
		infoObj.style.top = offsetTop - infoObj.offsetHeight + 'px';
		ObjOpacity(0);
		Dynamic(0,90,10,20);
	}
	else {
		clearTimeout(counter_hide);
		clearTimeout(counter_dyn);
		ObjOpacity(90);
	}
}

function ObjOpacity(value) {
	infoObj.style.filter = 'alpha(opacity='+value+')';
	infoObj.style.MozOpacity = (value / 100);
}

function Dynamic(minvalue,maxvalue,step,delay) {
	minvalue += step;
	ObjOpacity(minvalue);
	if((maxvalue - minvalue)/step >= 1) {
		clearTimeout(counter_dyn);
		counter_dyn = setTimeout("Dynamic("+minvalue+","+maxvalue+","+step+","+delay+")",delay);
	}
	else {
		clearTimeout(counter_dyn);
		ObjOpacity(maxvalue);
	}
	return;
}

function HideInfoDynamic(pobj) {
	if(!over && document.getElementById('infoDiv')) {
		Dynamic(90,0,-10,20);
		clearTimeout(counter_hide);
		counter_hide = setTimeout(function() {
			if(!over) pobj.removeChild(infoObj);
		},220);
	}
}

function HideInfo(pobj) {
	if(!over && document.getElementById('infoDiv')) {
		pobj.removeChild(infoObj);
	}
}

function getObj(obj){
	return (o = document.getElementById(obj))? o : document.all[obj];
}
