String.prototype.trim = function () {
	//return this.replace(/^\s*/, "").replace(/\s*$/, "");
	return this.replace(/^\s+|\s+$/g, '') ;
}

function selall(beg,end) {
	for (i=beg;i<=end;i++) {
		care='document.exp.o'+i+'.checked='+document.exp.ix.checked;
		eval(care);
	}
}

function decimalToHex(decimal) {
  var hex = decimal.toString(16);
  if (hex.length == 1) hex = '0' + hex;
  return hex;
}
function hexToDecimal(hex) {return parseInt(hex,16);}

function returnOpposite(colour) {
  return decimalToHex(255 - hexToDecimal(colour.substr(0,2)))
    + decimalToHex(255 - hexToDecimal(colour.substr(2,2)))
    + decimalToHex(255 -  hexToDecimal(colour.substr(4,2)));
}

function urlFromSel(id) {
    var sel=document.getElementById(id);
    var url=sel.options[sel.selectedIndex].value;
    window.location=url;
}