calc_timeout= new Array();;
logo_timeout= false;
tip_images=new Array();
current_tip=false;
function _where (obj) {
	var pos = {
		x: obj.offsetLeft,
		y: obj.offsetTop
	};

	while (obj = obj.offsetParent) {
		pos.x += obj.offsetLeft;
		pos.y += obj.offsetTop;
   	}

	return pos;
}




function _tip_preloadimage(idx,impath,imwidth,imheight)
{
 if((imwidth)&&(imheight))
  tip_images[idx]=new Image(imwidth,imheight);
 else
  tip_images[idx]=new Image();
 tip_images[idx].src=''+impath;
 calc_timeout[idx]=false;
 box=document.getElementById ('calc_tip_box');
   
 if(imwidth>56) reswidth=imwidth-56; else reswidth=0;

 tmp=box.cloneNode(true);
 tmp.id='calc_tip_box_'+idx;
 dd=tmp.getElementsByTagName("img");
 for(i=0;i<dd.length;i++) 
 { if(dd[i].id=="calc_image") {
    dd[i].id="cc_"+idx;
 	dd[i].src=''+tip_images[idx].src;
	dd[i].width=imwidth;
	dd[i].height=imheight;}
   if(dd[i].id=='calc_tip_left'){
    dd[i].id="c1_"+idx;
    dd[i].style.width = 0;}
   if(dd[i].id=='calc_tip_right'){
    dd[i].id-"c2_"+idx;
    dd[i].style.width = reswidth;}
 }
 tmp.style.width=imwidth+28+28;
 tmp.style.position='absolute';
 tmp.style.zIndex='20';
 box.parentNode.appendChild(tmp);
}

function _tip_show(obj,imidx)
{
    if(current_tip) document.getElementById('calc_tip_box_'+current_tip).style.display = 'none';
    if(calc_timeout[imidx])
		window.clearTimeout(calc_timeout[imidx]);
	calc_timeout[imidx]=false;
	var where = _where(obj);
	
    box=document.getElementById ('calc_tip_box_'+imidx);
        if(box.style.display == '')
          box.style.display='none';
	box.style.left= parseInt(where.x);
	box.style.top = parseInt(where.y) -parseInt(tip_images[imidx].height)-60;
    box.style.display = '';
    current_tip=imidx;
}

function _tip_clear(imidx)
{
	if(calc_timeout[imidx])
		window.clearTimeout(calc_timeout[imidx]);
	calc_timeout=window.setTimeout("document.getElementById('calc_tip_box_"+imidx+"').style.display = 'none'",100);
}


function l_tip_show(obj,param)
{
    if(logo_timeout)
		window.clearTimeout(logo_timeout);
	logo_timeout=false;
	var where = _where(obj);
	document.getElementById ('logo_tip_box').style.display = '';
	document.getElementById ('logo_tip_box').style.left = where.x + 150;
	document.getElementById ('logo_tip_box').style.top = where.y + 100;
	document.getElementById ('logo_tip_left').style.width = 0;
	document.getElementById ('logo_tip_right').style.width = param;

}


function l_tip_clear()
{
	if(logo_timeout)
		window.clearTimeout(logo_timeout);
	logo_timeout=window.setTimeout("document.getElementById('logo_tip_box').style.display = 'none'",600);
}
