/**************************************************************
	function buildtext()
	Builds the HTML/javascript code for the current dot object
	and returns a string containing the appropriate <area> tag
**************************************************************/
function buildtext() {

	// local variables

	var code = '<area onmouseover=\"'; // begin building <area> tag that
																		 // the buildtext function will
																		 // return

	// Place the tooltip to the left of the mouse if it's on the right
	// half of the map
	if(this.xcoord > (mapwidth/2)) {
		code += 'this.T_LEFT=true;';
	}
	
	// Place the tooltip above the mouse if it's on the bottom
	// half of the map
	if(this.ycoord > (mapheight/2)) {
		code += 'this.T_ABOVE=true;';
	}
	
	if(this.boxwidth > 0) {
		code +='this.T_WIDTH='+ this.boxwidth +';';
	}
	
	// If there is no text associated with the dot, create the title
	if(this.text == '') {
		code += 'this.T_PADDING=1;this.T_BGCOLOR=\'#00008b\';';
		code += 'return escape(\'<b>' + this.title + '</b>\')\" ';
	}
	
	// Otherwise, use the built-in title function
	else {
		code += 'this.T_TITLE=\'' + this.title + '\';';
		code += 'return escape(\'' + this.text + '\')\" ';
	}
	
	// Create remainder of map tag, making hotspot a circle, fill in diameter
	// defined above
	code += 'shape=\"circle\" coords=\"' + this.xcoord + 
		',' + this.ycoord + ',' + diameter + '\" alt=\"' + this.title + '\">';
		
	return code;

}

/**************************************************************
	function dot()
	Constructs the dot object
	Input: xcoord, ycoord, title, text
**************************************************************/
function dot(boxwidth,xcoord,ycoord,title,text) {
	this.xcoord = xcoord;
	this.ycoord = ycoord;
	this.title = title;
	this.text = text;
	this.boxwidth = boxwidth;
	
	this.buildtext = buildtext;
	
}