<!--
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}


function makesel(){

var bpn = findObj("bpn").value;

var p=findObj("power").value;
var r=findObj("rval").value;
var m=findObj("rmul").value;

var RValue  = Math.round(r*m*100)/100;

// Resistor value
findObj("RV").value = RValue;

// string for p/n
var rvalue = sprintf("%.2f",RValue);

// string for URL
var strRValue = sprintf("%.2f",RValue);

if ( RValue < 10 ) {
	rvalue = "0"+rvalue;
	strRValue = "0"+strRValue;

	rvalue=rvalue.replace("\.","P");
	strRValue=strRValue.replace("\.","p");
}
if ( ( RValue >= 10 ) && ( RValue < 100 ) ) {
	rvalue=rvalue.replace("\.","P");
	strRValue=strRValue.replace("\.","p");
}
if ( ( RValue >= 100 ) && ( RValue < 1000 ) ) {
	var expon = Math.round( Math.log(m)/Math.log(10) ) - 2;
	rvalue = "" + Math.round(r * 100) + expon;

	strRValue=RValue;
}
if ( RValue >= 1000 ) {

	var expon = Math.round( Math.log(m)/Math.log(10) ) - 2;
	rvalue = "" + Math.round(r * 100) + expon;

	strRValue=RValue;
}

//alert(rvalue + "\n" + strRValue); return;

var pn=bpn+p+"W"+"-"+rvalue+"-1%";
hurl="/power/"+p+"w/"+p+"w_"+strRValue+"ohm_to220_power_resistor.shtml";

findObj("part").value=pn;
findObj("url").value=hurl;

//window.status=hurl;
return true;
}
//-->

