// object representing the banner
function Banner( imageName ) {

	// the name of the image for the banner
	this.src = '"' + imageName + '"';
	this.align = '"center"';
	this.width = '"749"';
	this.height = '"90"';
	this.border = '"0"';
	this.hspace = '"0"';
	this.vspace = '"0"';
	this.coordinates = [];
	this.imageMap = new ImageMap('');
	this.addImageMap = function( imageMap ) {
		this.imageMap = imageMap;
	}
	this.fetchHTML = function() {

		var html  = ''; 
		html = '<img src=' + this.src +
		       ' align=' + this.align +
		       ' width=' + this.width +
		       ' height=' + this.height +
		       ' border=' + this.border +
		       ' hspace=' + this.hspace +
		       ' vspace=' + this.vspace +
		       ' usemap=#' + this.imageMap.name + '>\n';
		html += this.imageMap.fetchHTML();
		return html;
	}

}
// object representing a map
function ImageMap ( name ) {

	// the name of the image map
	this.name = name;

	// an array of area objects
	this.area = new Array();

	// add an area tag
	this.addArea = function( area ) {
		this.area[this.area.length] = area;
	}
	this.fetchHTML = function() {

		var html = '';
		html = '<map name = "'+ this.name + '">\n';
		for ( var i=0; i < this.area.length; i++ ) {
			html += this.area[i].fetchHTML() + '\n';;
		}
		html += '</map>'

		return html;
	}
	
}
// object representing an area tag
function Area ( shape, coords, href, alt, title ) {

	// the attributes for the area tag
	this.shape = shape;
	this.coords = coords;
	this.href = href;
	this.alt = alt;
	this.title = title;
	this.fetchHTML = function() {

		// print out the <area> html tags
		var shape = '"' + this.shape + '"';
		var coords = '"' + this.coords + '"';
		var href = '"' + this.href + '"';
		var alt = '"' + this.alt + '"';
		var title = '"' + this.title + '"';

		var html = '';
		html = '<area shape = ' + shape + 
		       ' coords = ' + coords + 
		       ' href = ' + href + 
		       ' alt = ' + alt + 
		       ' title = ' + title + '>';
		       
		return html;
	}
}

// object representing an image
function tabImage( src, alt, w, h ) {

	// the image attributes
	this.image=new Image(w,h);
	this.image.src = src;
	this.image.alt = alt;
	//this.image.width = w;
	//this.image.height = h;
	this.image.border = 0;
	this.image.hspace = 0;
	this.image.vspace = 0;

	this.fetchHTML = function () {
                var src = '"' + this.image.src + '"';
                var alt = '"' + this.image.alt + '"';
                var width = '"' + this.image.width + '"';
                var height = '"' + this.image.height + '"';
                var border = '"' + this.image.border + '"';
                var hspace = '"' + this.image.hspace + '"';
                var vspace = '"' + this.image.vspace + '"';
                var html = '';
                html += '<img src=' + src +
                       ' alt=' + alt +
                       ' width=' + width +
                       ' height=' + height +
                       ' border=' + border +
                       ' hspace=' + hspace +
                       ' vspace=' + vspace + '/>';

                return html;
	}

	this.tag = '<img src=' + src + '/>';

}

function Anchor( href, title ) {

	this.href = href;
	this.title = title;
	this.setTitle = function( title ) {
		this.title = title;
	}
	this.fetchHTML = function() {

		var href = '"' + this.href + '"';
		var html = '';
		html = '<a href=' + this.href + '>' +
		       this.title + '</a>';
		      
		return html;
	}
}

1;
