
//a generic toolbar type; this will work with the code in 
//the partial views/common/_imageTypeToolbar.rhtml
function toolbarWidget(toolbarElement) 
{
	//public properties
	this.rootElement = toolbarElement;

	//public methods
	this.mapToolClick = function(toolId, clickFunc) {
		var tool = document.getElementById(toolId);
		if(tool) {
			tool.onclick = clickFunc;
		}
	}
}

//A useful derivative of the toolbar widget.
function imageTypeToolbar(toolbarElement, graphWidget) {
	//extend the toolbarWidget type
	imageTypeToolbar.prototype = new toolbarWidget();
	imageTypeToolbar.prototype.constructor = imageTypeToolbar;
	imageTypeToolbar.ctr = toolbarWidget;
	//init the base class
    	imageTypeToolbar.ctr.call(this, toolbarElement);

	//set up the toolbar button handlers
	this.mapToolClick("ishButton",setPrimary);
	this.mapToolClick("expButton",setExpress);
	this.mapToolClick("bothButton",setComposite);
	this.mapToolClick("revertButton",revertThumbnails);

	function setPrimary() {
		graphWidget.changeImageType("primary");
	}

	function setExpress() {
		graphWidget.changeImageType("express");
	}

	function setComposite() {
		graphWidget.changeImageType("composite");
	}

	function revertThumbnails() {
		graphWidget.revertImages();
	}	
}

//A useful derivative of the imageTypeToolbar.
function humanImageTypeToolbar(toolbarElement, graphWidget) {
	//extend the toolbarWidget type
	humanImageTypeToolbar.prototype = new imageTypeToolbar();
	humanImageTypeToolbar.prototype.constructor = humanImageTypeToolbar;
	humanImageTypeToolbar.ctr = imageTypeToolbar;
	//init the base class
    	humanImageTypeToolbar.ctr.call(this, toolbarElement, graphWidget);

	//set up the toolbar button handlers
	this.mapToolClick("nisslButton",setNissl);

	function setNissl() {
		graphWidget.changeImageType("nissl");
	}
}


