phocus.DOM.onDOMReady=function()
{
	var fig1 = new Fig('fig1');
	fig1.addtip
	(
		new phocus.Point(237,62),
		50,
		'We remove non-producing rubber trees and process them into woodchips. We then replant rubber tree and other ground crops to help individual farmers and Liberia to reestablish one of its core industries'
	);
	fig1.addtip
	(
		new phocus.Point(85,217),
		50,
		'Woodchips from rubber trees are low in moisture content and have high calorific values - ideal for European coal fired power plants to help offset carbon footprint. The chips are also ideal for sources of fibre for medium density fibre board.'
	);
	fig1.addtip
	(
		new phocus.Point(388,217),
		50,
		'We are developing a 35 MW power plant near Monrovia that will use the woodchips. This is considered carbon neutral. This will help Liberia create energy independence as well as help accelerate its economic growth.'
	);
	fig1.addtip
	(
		new phocus.Point(237,217),
		50,
		'Using our impressive fleet of heavy equipment and management expertise we have to ensure we have good transportation access to the port of Buchanan - in so doing we are helping Liberia reestablish its road infrastructure.'
	);
	fig1.addtip
	(
		new phocus.Point(237,370),
		50,
		'The company is affiliated with a foundation that focuses on social programs in Liberia. Some of the cash generated from our activities will be used to fund grant related activities.'
	);
}

function Fig(id)
{
	this.id=id;
	this.fig=phocus.DOM.getnodes('img#'+this.id);
	if(this.fig.length)
		this.fig=this.fig.node(0);
	else
		return false;
	
	this.fig.set('alt','');
		
	this.tips=[];
	
	this.init();
}
var $pr=Fig.prototype;

$pr.init=function()
{
	var _p=this;
	this.fig.setevent('mousemove',function(e){_p.mousemove(e)});
	this.fig.setevent('mouseout',function(e){_p.closetip(true)});
}
$pr.addtip=function(pos,radius,tip)
{
	if(typeof pos != 'object' || !pos.ispoint)
		return null;
	if(!top)
		return null;
	if(!radius || isNaN(radius))
		var radius = 50;
	
	this.tips.push([pos,radius,tip]);
}
$pr.mousemove=function(e)
{
	mousepos=phocus.DOM.getmousepos(e,this.fig);
	absmousepos=phocus.DOM.getmousepos(e);
	var tip=false;
	for(var i=0;i<this.tips.length;i++)
	{
		var op=this.tips[i];
		var distance=mousepos.subtractnew(op[0]);
		var l=distance.getlength();
		if(l<=op[1])
		{
			tip=true;
			if(this.tip != i)
			{
				this.tip=i;
				this.opentip(i);
			}
		}
	}
	if(tip == false)
		this.closetip(true);
	else
		this.movetip(absmousepos);
}
$pr.opentip=function(i)
{
	this.closetip();
	
	var msg=this.tips[i][2];
	
	var b=phocus.DOM.getNode(document.body);
	this.tooltip=b.addnode('div','END',{id:'tooltip'});
	this.tooltip.addnode('p','END',null,msg);
}
$pr.closetip=function(del)
{
	if(del==true)
		this.tip=null

	var tt=phocus.DOM.getnodes('div#tooltip');
	if(tt.length>0)
		tt.deletenode();
}
$pr.movetip=function(mousepos)
{
	var pos=mousepos.addnew(new phocus.Point(20,-40));
	var dim=this.tooltip.get('dims')[0];
	var maxpos=pos.addnew(dim);
	var windowdims=phocus.DOM.getNode(document.body).get('dims');
	if(maxpos.x>windowdims.x)
		pos=pos.addnew(new phocus.Point(-dim.x-40,0));
	this.tooltip.set('pos',pos);
}