//capacitance unit converter functions
//copyright Simon Carter 2002-2008
//Please contact me at simon@electronics2000.co.uk if you wish to use these//and ensure this header block remains intact


function convertcap (obj) {
	if ((obj.capfrom.value == "") || (obj.capfrom.value == "-"))
		{SetText("capto", "?");}
	else{
		with (Math){
		c=calculatemult3(obj.capfrommult.selectedIndex,eval(obj.capfrom.value));
		}
		mult=obj.captomult.selectedIndex;
		if (mult==4)
			{c *= 1000000000000;
			c = c+ "p";}
		else if (mult==3)
			{c *= 1000000000;
			c = c + "n";}
		else if (mult==2)
			{c *= 1000000;
			c = c + "u";}
		else if (mult==1)
			{c *= 1000;
			c = c + "m";}
		SetText("capto", c + " Farads");
	}
}