
oMTLib.colourBlend = function(hexStart, hexEnd, nSteps){
	hexStart = hexStart.replace("#", "")
	hexEnd 	= hexEnd.replace("#", "")
	if(hexStart.length < 6) hexStart = hexStart + hexStart;
	if(hexEnd.length < 6) hexEnd = hexEnd + hexEnd;
	this.r = parseInt(hexStart.substring(0, 2), 16)
	this.g = parseInt(hexStart.substring(2, 4), 16)
	this.b = parseInt(hexStart.substring(4, 6), 16)
	this.nSteps = nSteps;
	this.nStepR = parseInt((parseInt(hexEnd.substring(0, 2), 16) - this.r) / this.nSteps);
	this.nStepG = parseInt((parseInt(hexEnd.substring(2, 4), 16) - this.g) / this.nSteps);
	this.nStepB = parseInt((parseInt(hexEnd.substring(4, 6), 16) - this.b) / this.nSteps);
	this.aR = []; this.aG = []; this.aB = [];
	for(var i=0; i<this.nSteps-1; i++){
		this.aR[i] = this.r + (i * this.nStepR);
		this.aG[i] = this.g + (i * this.nStepG);
		this.aB[i] = this.b + (i * this.nStepB);
	};
	this.aReturn = [];
	for(i=0; i<this.nSteps-1; i++){
		this.aReturn[i] = this.decimalToHex(this.aR[i]) + this.decimalToHex(this.aG[i]) + this.decimalToHex(this.aB[i]);
	};
	this.aReturn[this.aReturn.length] = hexEnd;
	return this.aReturn;
};

oMTLib.decimalToHex = function(nDecimal){
	var sHex = "0123456789ABCDEF";
	var sReturn = sHex.substr(nDecimal&15,1);
	while(nDecimal > 15){
		nDecimal >>= 4;
		sReturn = sHex.substr(nDecimal&15,1) + sReturn;
	};
	if(sReturn.length<2) sReturn = "0" + sReturn;
	return sReturn;
};