function AddPadding(cablelength) 
	{
	if (cablelength.length == 1)
		{
		cablelength = '00' + cablelength;
		}
	else if (cablelength.length == 2)
		{
		cablelength = '0' + cablelength;
		}
	else 
		{
		}
	return cablelength;	
	}

function cableTypeIs3mm() {
    var C =document.getElementById("ctl00_M_CableType").value;
    return ((C == "LT") || (C == "LK") || (C == "MD")|| (C == "MK"));
}
	
function checkHybrid()
{
	if (document.getElementById("ctl00_M_FiberCount").value == 'Hybrid')
		{
		document.all.hybrid.style.visibility = 'visible'
		document.all.TotalCount.disabled = false;
		document.all.SMCount.disabled = false;
		document.all.MMCount.disabled = false;
		var totalcount = document.getElementById("TotalCount").value;
		var dataNode = document.all.hybridxml.selectSingleNode("//DATA");
		var hybridNodes = eval('dataNode.selectNodes("//hybrid[@TotalCount = \''+totalcount+'\']")')
		var len = hybridNodes.length;
		
		document.aspnetForm.SMCount.options.length = 0;
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=hybridNodes[i].getAttribute("SMCount");
			oOption.value=hybridNodes[i].getAttribute("SMValue");
			document.all.SMCount.add(oOption);
			
			}
		document.getElementById("SMCount").selectedIndex = 0;
		
		document.aspnetForm.MMCount.options.length = 0;
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=hybridNodes[i].getAttribute("MMCount");
			oOption.value=hybridNodes[i].getAttribute("MMValue");
			document.all.MMCount.add(oOption);
			}
		document.aspnetForm.ctl00$M$FiberType.options.length = 0;
		dataNode = document.all.builderxml.selectSingleNode("//DATA");
		var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberType' and @Value != 'A']")

		len = builderNodes.length
		var oOption;
		oOption = document.createElement("OPTION");
		oOption.text="--Select MM Fiber Type--";
		oOption.value="";
		document.all.ctl00$M$FiberType.add(oOption);
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=builderNodes[i].getAttribute("Text");
			oOption.value=builderNodes[i].getAttribute("Value");
			document.all.ctl00$M$FiberType.add(oOption);
			}
		}
	else
		{
		document.all.hybrid.style.visibility = 'hidden'
		document.all.TotalCount.disabled = true;
		document.all.SMCount.disabled = true;
		document.all.MMCount.disabled = true;
		var dataNode = document.all.builderxml.selectSingleNode("//DATA");
		document.aspnetForm.ctl00$M$FiberType.options.length = 0;	
		var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberType']")
		var len = builderNodes.length
		var oOption;
		oOption = document.createElement("OPTION");
		oOption.text="--Select Fiber Type--";
		oOption.value="";
		document.all.ctl00$M$FiberType.add(oOption);
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=builderNodes[i].getAttribute("Text");
			oOption.value=builderNodes[i].getAttribute("Value");
			document.all.ctl00$M$FiberType.add(oOption);
			}
		}
}

function checkInterconnectRound()
{
    var cableTypeOptions = document.getElementById("ctl00_M_CableType").options;
	var cabletypetext =getSelectedLabelById("ctl00_M_CableType");
	var fibercount = document.getElementById("ctl00_M_FiberCount").value;
	if ((cabletypetext == "Interconnect Round") && (fibercount == '02'))
		{
		cableTypeOptions[cableTypeOptions.selectedIndex].value = 'I2';
		}
	else if ((cabletypetext == "Interconnect Round") && (fibercount == '04'))
		{
		cableTypeOptions[cableTypeOptions.selectedIndex].value = 'I4';
		}
}

function CheckLengthType()
{
    var LengthRow = document.getElementById("LengthRow");
    var MultiLengthRow1 = document.getElementById("MultiLengthRow1"); //multi-lengths
    var MultiLengthRow2 = document.getElementById("MultiLengthRow2");//multi-length qtys
    var OrderQtyRow = document.getElementById("OrderQtyRow");
    

	if (document.all.aspnetForm.ctl00$M$LengthType[0].checked == true)
		{
		Show(LengthRow);
		Hide(MultiLengthRow1);
		Hide(MultiLengthRow2);
		Show(OrderQtyRow);
		}
	else if (document.all.aspnetForm.ctl00$M$LengthType[1].checked == true)
		{
		Hide(LengthRow);
		Hide(MultiLengthRow1);
		Hide(MultiLengthRow2);
		Hide(OrderQtyRow);
		}
	else
		{
    	Hide(LengthRow);
		Show(MultiLengthRow1);
		Show(MultiLengthRow2);
		Hide(OrderQtyRow);			
		}
}

function checkPullEye()
{
	var cabletype = document.getElementById("ctl00_M_CableType").value;
	var fibercount = document.getElementById("ctl00_M_FiberCount").value;
	if (cabletype == 'RD')
		{
		document.all.aspnetForm.FlameRating[1].disabled = true;
		}
	else
		{
		document.all.aspnetForm.FlameRating[1].disabled = false;
		}
	if (cabletype == 'RD')	    
		{
		if (document.all.aspnetForm.PullingEye[1].checked == true)
			{
		    document.all.aspnetForm.PullingEye[1].checked = false
			document.all.aspnetForm.PullingEye[0].checked = true
			}
		document.all.aspnetForm.PullingEye[1].disabled = true;
		document.all.aspnetForm.PullingEye[2].disabled = true;
		document.all.pulloptcomment.style.display = "block";
		}
	else
		{
        document.all.aspnetForm.PullingEye[1].disabled = false;
		document.all.aspnetForm.PullingEye[2].disabled = false;
		document.all.pulloptcomment.style.display = "none";
		}
}

function checkPullingEyeType()
{
	var fibercount = document.aspnetForm.ctl00$M$FiberCount.value;
	var cabletype = document.aspnetForm.ctl00$M$CableType.value;
	var sideA = document.aspnetForm.ctl00$M$SideA.value;
	//BAL 07/08/2008  Change desc for fibercount of 144 to be 2.35" OD
	if (fibercount == '44')
	    {
			document.all.pullopttype.innerHTML = 'Standard Pulling eye requires min. 3" ID duct (PE has a OD 2.35" nom)';
	    }
	//BAL 07/10/2008  MD,8, LC Dup or SC Dup should be 2.00 OD , or 12 and lc duplex, sc duplex, or sc/apc
	else if ((cabletype == 'MD') &&(fibercount == '08') && ((sideA == '4') || (sideA == '2')) || ((fibercount == '12') && ((sideA == '1') || (sideA == 'A') || (sideA == 'G'))))
		{
			document.all.pullopttype.innerHTML = 'Standard Pulling eye requires min. 3" ID duct (PE has a OD 2" nom)';
		}
		
	else if((cabletype == 'I2' || cabletype == 'I4' || cabletype == 'AT') || (fibercount == '04') || (fibercount == '08') || (fibercount == '06' && sideA != '2' && sideA != 'B' && sideA != 'H') || ((fibercount == '08' || fibercount == '12') && sideA != '2' && sideA != 'B' && sideA != 'H' && sideA != '4' && sideA != 'D') || ((fibercount == '18' || fibercount == '24') && sideA != '2' && sideA != 'B' && sideA != 'H' && sideA != '4' && sideA != 'D' && sideA != '1' && sideA != 'A' && sideA != 'G' && sideA != '5' && sideA != 'K' && sideA != '6' && sideA != 'J' && sideA != '8' && sideA != 'I'))
		{
			document.all.pullopttype.innerHTML = 'Standard Pulling eye requires min. 2" ID duct (PE has a OD 1.3" nom)';
		}
	else
		{
			document.all.pullopttype.innerHTML = 'Standard Pulling eye requires min. 3" ID duct (PE has a OD 2" nom)';
		}
}

// BAL 05/29/2008  Add R, L as new connector types which are MTP  03/31/2009  Add "0" for MTP Male
function connIsMTP(Side) {
    var Conn = document.getElementById("ctl00_M_Side" + Side).value;
    return ((Conn == "E") || (Conn == "7") || (Conn == "U") || (Conn == "R") || (Conn == "L") || (Conn == "0"));
}

function connIsMTPByValue(Conn) {
    return ((Conn == "E") || (Conn == "7") || (Conn == "U") || (Conn == "R") || (Conn == "L") || (Conn == "0"));
}

function MTPConnCompatible() {
    var ConnA = document.getElementById("ctl00_M_SideA").value;
    var ConnB = document.getElementById("ctl00_M_SideB").value;
//mtp male is compatible with mtp female
    if ((((ConnA == "E") || (ConnA == "7")) && (ConnB == "0")) || ((ConnA == "0") && ((ConnB == "E") || (ConnB == "7")))) {
        return true
    }
    else {
        return false
    }
}

function connIsLCUniboot(Side) {
    var Conn = document.getElementById("ctl00_M_Side" + Side).value;
    return (Conn == "S" );
}
function Ctrl(shortId){
    return document.getElementById('ctl00_M_' + shortId);
}
  
function disableBreakOut(side,opt0,opt1,opt2,opt3){

    document.getElementById('BreakOut' + side + '0').disabled = opt0;
	document.getElementById('BreakOut' + side + '1').disabled = opt1;
	document.getElementById('BreakOut' + side + '2').disabled = opt2;
	// BAL  7/28/08 Option 3 for custom is no longer part of this group
	//document.getElementById('BreakOut' + side + '3').disabled = opt3;
	if ((opt3 == true) && (side == "A") )
	    {
    	document.all.ctl00_M_CustomRequirementARow.style.visibility = 'hidden';
    	}
   else if ((opt3 != true) && (side == "A") )
 	    {
        document.all.ctl00_M_CustomRequirementARow.style.visibility = 'visible';
    	}
	else if ((opt3 == true) && (side == "B")) 
	    {
    	document.all.ctl00_M_CustomRequirementBRow.style.visibility = 'hidden';
    	}
    else if ((opt3 != true) && (side == "B")) 
 	    {
    	document.all.ctl00_M_CustomRequirementBRow.style.visibility = 'visible';
    	}    
}

function EnableGroundWire(IDtoCheck,A,B,Both,None) {
    document.getElementById(IDtoCheck).checked=true;
    document.getElementById("GroundWireA").disabled=!A;
    document.getElementById("GroundWireB").disabled=!B;
    document.getElementById("GroundWireBoth").disabled=!Both;
    document.getElementById("GroundWireNone").disabled=!None;
}

function getBreakOutSText(Side) {
    if (cableTypeIs3mm() && (connIsMTP(Side))) { 
        return '3.0mm Round';
    } else {
        return '900 Micron';
    }
}

function getBreakOutFText(Side) {
    if (cableTypeIs3mm() && (connIsLCUniboot(Side))) { 
        return '3.0mm Round';
    } else {
    return '2.0mm Furcation';
    }
} 
function getSelectedRadioButtonValue(elementName){
    var theArray = document.aspnetForm[elementName];
    var elValue;
    for ( var index = 0; index < theArray.length; index++ ) 
    { 
      if ( theArray[ index ].checked ) 
      { 
        elValue = theArray[ index ].value; 
        break; 
      } 
    } 
    return elValue;
}

function getSelectedValueById(id){
  return document.getElementById(id).value;
}

function getSelectedLabelById(id){
  var o = document.getElementById(id).options;
  
  //var cabletype = document.all.CableType.options[document.all.CableType.options.selectedIndex].value;
  //var cabletypetext = document.all.CableType.options[document.all.CableType.options.selectedIndex].text;
  return o[o.selectedIndex].text;
}

function Hide(el) {
    el.style.display = 'none';
}

function IsCableTypeSelected(source, args) {
    args.IsValid = (args.Value != '');
}

function IsFiberTypeSelected(source, args) {
    args.IsValid = (args.Value != '');
}

function IsCustomAEmpty(source, args) {
    document.aspnetForm.chkCustomA.checked ? args.IsValid = (args.Value != '') : args.IsValid=true;
}

function IsCustomBEmpty(source, args) {
    document.aspnetForm.chkCustomB.checked ? args.IsValid = (args.Value != '') : args.IsValid=true;
}

function IsLenOK(ctl) {
    var len = document.all.aspnetForm['ctl00$M$' + ctl].value;
    var MaxLen;
    if ((len=='')||(isNaN(len))) {
        return false; 
        } else {
    document.aspnetForm.ctl00$M$Units[0].checked ? MaxLen = 9999 : MaxLen = 3047;
    return ((parseInt(len) <= MaxLen)&&(parseInt(len) >= 1))
	}
}

function LengthOk(source, args) {
	args.IsValid = IsLenOK('Length');
}

function LenM1Ok(source, args) {
	args.IsValid = IsLenOK('Len1');
}

function LenM2Ok(source, args) {
	args.IsValid = IsLenOK('Len2');
}

function LenM3Ok(source, args) {
	args.IsValid = IsLenOK('Len3');
}

function LenM4Ok(source, args) {
	args.IsValid = IsLenOK('Len4');
}

function LenM5Ok(source, args) {
	args.IsValid = IsLenOK('Len5');
}

function LenM6Ok(source, args) {
	args.IsValid = IsLenOK('Len6');
}

function LenM7Ok(source, args) {
	args.IsValid = IsLenOK('Len7');
}

function AreMTPConnectorsEqual(source, args) {
    var AConnIsMTP = connIsMTP("A");
    var BConnIsMTP = connIsMTP("B");
    if ((AConnIsMTP) && (BConnIsMTP)) {
        if (MTPConnCompatible()) {
            args.IsValid = true;
        }
        else {
            args.IsValid = (document.getElementById("ctl00_M_SideA").value == document.getElementById("ctl00_M_SideB").value);
        }
    }
    else {
        args.IsValid = true;
    }
}

//Change the MTP Value to the be same if both are MTP -- Set SideB = SideA
// MTP Female and MTP Male are compatible so allow
function MakeMTPConnectorsEqual() {

        var AConnIsMTP = connIsMTP("A");
        var BConnIsMTP = connIsMTP("B");

        if ((AConnIsMTP) && (BConnIsMTP)) {
            if (MTPConnCompatible ())
            {
            }
            else
            {
            var ChangeValue = (document.getElementById("ctl00_M_SideB").value = document.getElementById("ctl00_M_SideA").value);
            }
        }
    }


function LenQtyMisMatch(LenBox, QtyBox){
    var Msg='';
    var Len = LenBox.value;
    var Qty = QtyBox.value;
    var QtyId = QtyBox.id.replace('ctl00_M_','');
    QtyId = QtyId.replace('Qty','Quantity ');
    var LenId = LenBox.id.replace('ctl00_M_','');
    LenId = LenId.replace('Len','Length ');
    
    if(Len == '' && Qty != '') {
        Msg = "A value of " + Qty + " was entered in " + QtyId + ", but " + LenId + " is empty.\n"
    } else {
        if(Len != '' && Qty == '') {
            Msg = "A value of " + Len + " was entered in " + LenId + ", but " + QtyId + " is empty.\n"
        }
    }
    return Msg
}

function LoadABIfUnfolded() {
    if (PageIsUnfolded()) {
        loadSideAB();
    }
}

function loadCableType()
{
    document.aspnetForm.ctl00$M$CableType.options.length = 0;
	var dataNode = document.all.builderxml.selectSingleNode("//DATA");
	var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'CableType']")
	var len = builderNodes.length
	var oOption;
	oOption = document.createElement("OPTION");
		oOption.text="--Select Cable Type--";
		oOption.value="";
		document.all.ctl00$M$CableType.add(oOption);
	for(var i=0;i<len;i++)
		{
		oOption = document.createElement("OPTION");
		oOption.text=builderNodes[i].getAttribute("Text");
		oOption.value=builderNodes[i].getAttribute("Value");
		document.all.ctl00$M$CableType.add(oOption);
		}
	var rowindex = document.all.BuilderTable.rows.length;
	for(var i=0;i<5;i++)
		{
		document.all.BuilderTable.rows[i].style.display = 'block';
		}
}

function loadFiberTypeCount()
{
	document.aspnetForm.ctl00$M$FiberCount.options.length = 0;
	var dataNode = document.all.builderxml.selectSingleNode("//DATA");
	
	var cabletype = getSelectedValueById("ctl00_M_CableType");
	var cabletypetext = getSelectedLabelById("ctl00_M_CableType");
	if (cabletypetext == "Interconnect Round")
		{
		var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberCount' and @Value = '02' or @Value = '04']")
		}
	else if ((cabletype == "LT") )
		{
		var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberCount' and @Value = '06' or @Value = '12' or @Value = '24' or @Value = '36' or @Value = '48' or @Value = '72' or @Value = '96' or @Value = '44' or @Value = '16' or @Value = 'Hybrid']")
		}
	else if ((cabletype == "PD"))
		{
		var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberCount' and @Value = '06' or @Value = '12' or @Value = '24' or @Value = '36' or @Value = '48' or @Value = '72' or @Value = '96' or @Value = '44' or @Value = 'Hybrid']")
		}
		
	else if ((cabletype == "LK") || (cabletype == "PK"))
		{
		var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberCount' and @Value = '06' or @Value = '12' or @Value = '24' or @Value = '36' or @Value = '48' or @Value = '72' or @Value = 'Hybrid']")
		}
	else if ((cabletype == "MD") || (cabletype == "MK"))
		{
		var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberCount' and @Value = '04' or @Value = '08' or @Value = '12' or @Value = '24' or @Value = '36' or @Value = '48' or @Value = '72']")
		}
	else if ((cabletype == "AT"))
		{
		var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberCount' and @Value = '01' or @Value = '02']")
		}		
    else
		{
		var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberCount' and @Value = '12']")
		}
	
	var len = builderNodes.length
	var oOption;
	
	for(var i=0;i<len;i++)
		{
		oOption = document.createElement("OPTION");
		oOption.text=builderNodes[i].getAttribute("Text");
		oOption.value=builderNodes[i].getAttribute("Value");
		document.all.ctl00$M$FiberCount.add(oOption);
		}
	document.all.ctl00$M$FiberCount.selectedIndex = 0;
	
	document.aspnetForm.ctl00$M$FiberType.options.length = 0;
	builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FiberType']")

	len = builderNodes.length
	var oOption;
	oOption = document.createElement("OPTION");
	if (document.getElementById("ctl00_M_FiberCount").text == 'hybrid')
		{
		oOption.text="--Select MM Fiber Type--";
		}
	else
		{
		oOption.text="--Select Fiber Type--";
		}
	oOption.value="";
	document.all.ctl00$M$FiberType.add(oOption);
	for(var i=0;i<len;i++)
		{
		oOption = document.createElement("OPTION");
		oOption.text=builderNodes[i].getAttribute("Text");
		oOption.value=builderNodes[i].getAttribute("Value");
		document.all.ctl00$M$FiberType.add(oOption);
		}
	var rowindex = document.all.BuilderTable.rows.length;
	for(var i=0;i<10;i++)
		{
		document.all.BuilderTable.rows[i].style.display = 'block';
		}
	toggleHybrid()	
}

function loadFlameRating()
{
	var dataNode = document.all.builderxml.selectSingleNode("//DATA");
	var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'FlameRating']")
    
    var Flame1Span = document.getElementById("FlameRating1Span");//
    var Flame1SpanText = builderNodes[0].getAttribute("Text");
    Flame1Span.innerText = Flame1SpanText
    var Flame1Radio = document.getElementById("FlameRating1");//
    var Flame1RadioValue = builderNodes[0].getAttribute("Value");
    Flame1Radio.value = Flame1RadioValue;
}

function loadSideAB()
{
	var dataNode = document.all.builderxml.selectSingleNode("//DATA");
	var fibertype = document.getElementById("ctl00_M_FiberType").value;
	var cabletype = document.getElementById("ctl00_M_CableType").value;
	var fibercountText = document.getElementById("ctl00_M_FiberCount").value;
	var fibercount = Number(fibercountText);
    if (fibercount==44) fibercount=144;
    if (fibercount==16) fibercount=216;

//BAL 02/21/2008 Add MTRJ as a connector choice for singlemode fiber (but not for AT and 1 fiber)
	if (fibertype == 'A')
		{
        if (((cabletype == 'LT' ) || (cabletype == 'LK' ) || (cabletype == 'MD' ) || (cabletype == 'MK' )) && (fibercount > 8 ))
			{
			var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'SideA' and @Limits = 'A' or @FieldName = 'SideA' and @Value='N' or @FieldName = 'SideA' and @Value='J']")
			}
		else if ((cabletype == 'RD' ) && (fibercount == '12' ))
			{
			var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'SideA' and @Limits = 'A' and @Value='E' or @FieldName = 'SideA' and @Value='N' ]")
			}
		else if ((cabletype == 'AT' ) && (fibercount == '01' ))
			{
			var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'SideA' and @Value='A' or @FieldName = 'SideA' and @Value='C' or @FieldName = 'SideA' and @Value='G' or @FieldName = 'SideA' and @Value='F' or @FieldName = 'SideA' and @Value='I' or @FieldName = 'SideA' and @Value='K' or @FieldName = 'SideA' and @Value='N']")
			}			
		else
			{
			    var builderNodes = dataNode.selectNodes("//builder[(@FieldName = 'SideA' and @Limits = 'A' and (@Value != 'E' and  @Value != '0')) or @FieldName = 'SideA' and @Value='N' or @FieldName = 'SideA' and @Value='J']")
			}
		var len = builderNodes.length
		var oOption;
		document.aspnetForm.ctl00$M$SideA.options.length = 0;
		document.aspnetForm.ctl00$M$SideB.options.length = 0;
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=builderNodes[i].getAttribute("Text");
			oOption.value=builderNodes[i].getAttribute("Value");
			document.all.ctl00$M$SideA.add(oOption);
			}
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=builderNodes[i].getAttribute("Text");
			oOption.value=builderNodes[i].getAttribute("Value");
			document.all.ctl00$M$SideB.add(oOption);
			}
		}
	else if(fibercountText == 'Hybrid')
		{
	
		var totalcount = document.getElementById("TotalCount").value;
		if (totalcount == '12' || totalcount == '18' || cabletype == 'PD' || cabletype == 'PK')
			{
			var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'SideA' and @Value='Z' and @Limits = 'Hybrid' or @FieldName = 'SideA' and @Value='Y' and @Limits = 'Hybrid' or @FieldName = 'SideA' and @Value='W' and @Limits = 'Hybrid' or @FieldName = 'SideA' and @Value='V' and @Limits = 'Hybrid']")
			}
		else
			{
			    var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'SideA' and @Value='Z' and @Limits = 'Hybrid' or @FieldName = 'SideA' and @Value='Y' and @Limits = 'Hybrid' or @FieldName = 'SideA' and @Value='W' and @Limits = 'Hybrid' or @FieldName = 'SideA' and @Value='V' and @Limits = 'Hybrid' or @FieldName = 'SideA' and @Value='U' and @Limits = 'Hybrid' or @FieldName = 'SideA' and @Limits = 'Hybrid' and @Value='R' and @Limits = 'Hybrid' or @FieldName = 'SideA' and @Value='L'and @Limits = 'Hybrid'  or @FieldName = 'SideA' and @Value='0'and @Limits = 'Hybrid' ]")
			}
		var len = builderNodes.length
		var oOption;
		document.aspnetForm.ctl00$M$SideA.options.length = 0;
		document.aspnetForm.ctl00$M$SideB.options.length = 0;
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=builderNodes[i].getAttribute("Text");
			oOption.value=builderNodes[i].getAttribute("Value");
			document.all.ctl00$M$SideA.add(oOption);
			}
		oOption = document.createElement("OPTION");
		oOption.text="None";
		oOption.value="N";
		document.all.ctl00$M$SideA.add(oOption);
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=builderNodes[i].getAttribute("Text");
			oOption.value=builderNodes[i].getAttribute("Value");
			document.all.ctl00$M$SideB.add(oOption);
			}
		oOption = document.createElement("OPTION");
		oOption.text="None";
		oOption.value="N";
		document.all.ctl00$M$SideB.add(oOption);
		}
	else
		{
		//MTP and C,G,L,E,X
		if (((cabletype == 'LT' ) || (cabletype == 'LK' ) || (cabletype == 'MD' ) || (cabletype == 'MK' )) && (fibercount > 8 ))
			{
			var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'SideA' and @Limits != 'A' and @Limits != 'Hybrid' or @FieldName = 'SideA' and @Value='N']")
			}
		else if ((cabletype == 'RD' ) && (fibercount == '12' ))
			{
			    var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'SideA' and @Limits != 'A' and @Limits != 'Hybrid' and (@Value='7' or @Value='R' or  @Value='L' or  @Value='0')or @FieldName = 'SideA' and @Value='N']")
			}
		else if ((cabletype == 'AT' ) && (fibercount == '1' ))
			{
			var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'SideA' and @Limits != 'A' and @Limits != 'Hybrid' and @Value='1' or @FieldName = 'SideA' and @Limits != 'A' and @Limits != 'Hybrid' and @Value='3' or  @FieldName = 'SideA' and @Limits != 'A' and @Limits != 'Hybrid' and @Value='5' or @FieldName = 'SideA' and @Limits != 'A' and @Limits != 'Hybrid' and @Value='8' or @FieldName = 'SideA' and @Limits != 'A' and @Limits != 'Hybrid' and @Value='N']")
			}			
		else
		// BAL 05/29/08  Do not include R and L in default list  03/31/08  Do not include 0(zero) in the default list
			{
			    var builderNodes = dataNode.selectNodes("//builder[@FieldName = 'SideA' and @Limits != 'A' and @Limits != 'Hybrid' and (@Value != '7' and  @Value != 'R' and @Value != 'L' and @Value != '0' )or @FieldName = 'SideA' and @Value='N']")
			}
		var len = builderNodes.length
		var oOption;
		document.aspnetForm.ctl00$M$SideA.options.length = 0;
		document.aspnetForm.ctl00$M$SideB.options.length = 0;
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=builderNodes[i].getAttribute("Text");
			oOption.value=builderNodes[i].getAttribute("Value");
			document.all.ctl00$M$SideA.add(oOption);
			}
		for(var i=0;i<len;i++)
			{
			oOption = document.createElement("OPTION");
			oOption.text=builderNodes[i].getAttribute("Text");
			oOption.value=builderNodes[i].getAttribute("Value");
			document.all.ctl00$M$SideB.add(oOption);
			}
		}
	var rowindex = document.all.BuilderTable.rows.length;
	for(var i=0;i<rowindex;i++)
		{
		document.all.BuilderTable.rows[i].style.display = 'block';
		}

    SetFiberDesc();
	SetCableDesc();
	checkInterconnectRound()
	checkPullEye()
	CheckLengthType()
	toggleHybrid()
	prepareBreakOuts();
	showhidedesc();	
	toggleGroundWire();
	showhideConnectorMsg();
	toggleKey();
}

function NoLenEntered() {
	var AllLenText='';
	for(var i=1;i<8;i++)
	{
	AllLenText += document.all.aspnetForm['ctl00$M$Len' + i].value;
	}
    return AllLenText == ''
}

function NoQtyEntered() {
	var AllQtyText='';
	for(var i=1;i<8;i++)
	{
	AllQtyText += document.all.aspnetForm['ctl00$M$Qty' + i].value;
	}
    return AllQtyText == ''
}

function PageIsUnfolded() {
    return (document.getElementById('DescRow').style.display=='block');
}

function prepareBreakOuts()
{
    prepareBreakOut('A');
    prepareBreakOut('B');
}

function prepareBreakOut(side){
    var cabletype = document.getElementById("ctl00_M_CableType").value;
    var conn = document.getElementById("ctl00_M_Side" + side).value;
    // BAL 05/29/2008  Add new MTP connectors R & L  10/13/09  Add MTP Male 0
    if ((((conn == '7') || (conn == 'E') || (conn == 'R') || (conn == 'L') || (conn == '0')) && (cabletype == 'RD')) || (conn == 'N'))
		{
		disableBreakOut(side,true,true,false,true);
		setBreakOutOption(side,2);
		}

		else if (cableTypeIs3mm() && (connIsMTP(side))) //|| connIsLCUniboot(side)
		{
		disableBreakOut(side,false,true,true,false);  // BAL 20080331 Changed to disable the "none" option here
		
		setBreakOutOption(side,0);
}
        else if (cableTypeIs3mm() &&  connIsLCUniboot(side))
            {
                disableBreakOut(side,  true,false, true, false);  // BAL 20080331 Changed to disable the "none" option here

                setBreakOutOption(side, 1);
            }
	else
		{
		disableBreakOut(side,false,false,true,false); // BAL 11/29/07 Don't allow option none here 
		setBreakOutOption(side,1);
		}
	checkPullingEyeType();
    var t = getBreakOutSText(side) ;
    document.getElementById('BreakOut' + side + 'Text').innerText = t;
    var t2 = getBreakOutFText(side);
    document.getElementById('BreakOut' + side + 'TextF').innerText = t2;
    
}

function setBreakOutOption(side,optionIndex){
    document.getElementById('BreakOut' + side + optionIndex).checked = true;
}

function Show(el) {
    ShowBlock(el);
}

function ShowBlock(el) {
    el.style.display = 'block';
}

function showhidedesc()
{   
    var CustDescA = document.getElementById("ctl00_M_BreakOutLengthACustomDescriptionRow");
    var CustDescB = document.getElementById("CustDescBRow");
	if (document.all.aspnetForm.chkCustomA.checked == true)
		{
		Show(CustDescA);
		document.all.aspnetForm.ctl00$M$CustomA.focus();
		}
	else
		{
		Hide(CustDescA);		
		}
	if (document.all.aspnetForm.chkCustomB.checked == true)
		{
		Show(CustDescB);
		document.all.aspnetForm.ctl00$M$CustomB.focus();
	
		}
	else
		{
		Hide(CustDescB);
		}
}

function ShowInline(el) {
    el.style.display = 'inline';
}

//BAL 10/09/08  Should not have 
function toggleFlameRating() {
    var cabletype = document.getElementById("ctl00_M_CableType").value;
    var RiserButton = document.getElementById("FlameRating2");
    var RiserSpan = document.getElementById("FlameRating2Span");
    if ((cabletype == 'MD')||(cabletype == 'MK')||(cabletype == 'RD'))
		{
		document.all.aspnetForm.FlameRating[0].checked = true;
		Hide(RiserButton)
		Hide(RiserSpan)
		}
	else
		{
		ShowInline(RiserButton);
		ShowInline(RiserSpan);
		}
}

function toggleGroundWire() {
    var IsPageUnfolded=(document.getElementById('DescRow').style.display=='block'); 
    if (IsPageUnfolded) {
        var cabletype = getSelectedValueById("ctl00_M_CableType");
        var GroundWireRow = document.getElementById("ctl00_M_GroundWireRow");
        if ((cabletype=='PK')||(cabletype=='LK')) {
            Show(GroundWireRow);
            document.getElementById("GroundWireB").checked=true;
            var ConnSideA = document.getElementById("ctl00$M$SideA").value;
            var ConnSideB = document.getElementById("ctl00$M$SideB").value;
//            If connectors are only on 1 side, then the ground wire should default to that side and shouldn't 
//            be an option for the other side.  
            if (ConnSideA!="N"&&ConnSideB=="N"){
                EnableGroundWire("GroundWireA",true,false,false,true);
            }
            if (ConnSideA=="N"&&ConnSideB!="N"){
                EnableGroundWire("GroundWireB",false,true,false,true);
            }
//            If connectors are on both sides, then the ground wire should default to Side B, 
//            but all other options are still available. 
            if (ConnSideA!="N"&&ConnSideB!="N"){
                 EnableGroundWire("GroundWireB",true,true,true,true);
            }
            //if the user sets connectors set to None on both sides the ground wire should be 
            //forced to "None."
            if (ConnSideA=="N"&&ConnSideB=="N"){
                 EnableGroundWire("GroundWireNone",false,false,false,true);
            }
		} else {
		    Hide(GroundWireRow);
		     document.getElementById("GroundWireNone").checked=true;
		}
    }
}

function toggleHybrid()
{
    var HybridCountRow = document.getElementById("HybridCountRow");
	if (document.getElementById("ctl00_M_FiberCount").value == 'Hybrid')
		{	
		Show(HybridCountRow);
		}
	else
		{
		Hide(HybridCountRow);
		}
}

function togglePullingEyeType()
{
    var PullingEyeTypeRow = document.getElementById("PullingEyeTypeRow");
	if (document.aspnetForm.PullingEye[1].checked || document.aspnetForm.PullingEye[2].checked)
		{	
		Show(PullingEyeTypeRow);
		}
	else
		{
		Hide(PullingEyeTypeRow);
		}
}
    
function VLQmatch(source, args){
    if(document.getElementById('ctl00_M_LengthTypeMulti').checked){
        var msg = '';
        if (NoLenEntered() && NoQtyEntered()){
            source.errormessage = 'Multiple lengths: No length or quantity was entered.' ;
            args.IsValid = false;
        } else {
            msg += LenQtyMisMatch(Ctrl('Len1'), Ctrl('Qty1'));
            msg += LenQtyMisMatch(Ctrl('Len2'), Ctrl('Qty2'));
            msg += LenQtyMisMatch(Ctrl('Len3'), Ctrl('Qty3'));
            msg += LenQtyMisMatch(Ctrl('Len4'), Ctrl('Qty4'));
            msg += LenQtyMisMatch(Ctrl('Len5'), Ctrl('Qty5'));
            msg += LenQtyMisMatch(Ctrl('Len6'), Ctrl('Qty6'));
            msg += LenQtyMisMatch(Ctrl('Len7'), Ctrl('Qty7'));
            if(msg != ''){
                source.errormessage = "Multiple lengths: \n" + msg;
            }
            args.IsValid = (msg == '');
        }
    } else {
        args.IsValid = true; 
   }
}

function showhideConnectorMsg() {
    var CustDescB = document.getElementById("ConnectorMsg1Side");
    var ConnSideA = getSelectedValueById("ctl00$M$SideA");
    var ConnSideB = getSelectedValueById("ctl00$M$SideB");
    //if the connector is specified on side A, and no connetor on side B, then show the message
    if (ConnSideA != "N" && ConnSideB == "N") {
        Show(CustDescB);
    }
    else {
        Hide(CustDescB);
    }
    //if connector is MTP then show message, otherwise hide
    var MTPDescA = document.getElementById("ctl00_M_ConnectorDescRowA");
    if (connIsMTP("A")) {
        Show(MTPDescA);
    }
    else {
        Hide(MTPDescA)
    }
    var MTPDescB = document.getElementById("ctl00_M_ConnectorDescRowB");
    if (connIsMTP("B")) {
        Show(MTPDescB);
    }
    else {
        Hide(MTPDescB)
    }    
}

function toggleKey()
{
    var AConnIsMTP = connIsMTP("A");
    var BConnIsMTP = connIsMTP("B");
    
    var KeySideARow = document.getElementById("ctl00_M_KeySideARow");
	if (AConnIsMTP)
		{	
		Show(KeySideARow);
		var w = document.getElementById("ctl00_M_SideA").selectedIndex;
        var selected_text = document.getElementById("ctl00_M_SideA").options[w].text;
		}
	else
		{
		Hide(KeySideARow);
		document.getElementById("KeySideAStandard").checked=true;
		}
    var KeySideBRow = document.getElementById("ctl00_M_KeySideBRow");
	if (BConnIsMTP)
		{	
		Show(KeySideBRow);
		}
	else
		{
		Hide(KeySideBRow);
		document.getElementById("KeySideBStandard").checked=true;		
		}		
		//BAL  06/03/2008  Make sure that both ends are the same.  Use A to choose both ends and set them the same
	if ((AConnIsMTP) && (BConnIsMTP))
	{
		document.getElementById("KeySideBStandard").checked = document.getElementById("KeySideAStandard").checked;
		document.getElementById("KeySideBSecuredR").checked = document.getElementById("KeySideASecuredR").checked;		
		document.getElementById("KeySideBSecuredY").checked = document.getElementById("KeySideASecuredY").checked;		
		document.getElementById("KeySideBSecuredG").checked = document.getElementById("KeySideASecuredG").checked;		
		document.getElementById("KeySideBSecuredB").checked = document.getElementById("KeySideASecuredB").checked;		
	    document.getElementById("KeySideBStandard").disabled=true;		
	    document.getElementById("KeySideBSecuredR").disabled=true;			
	    document.getElementById("KeySideBSecuredY").disabled=true;			
	    document.getElementById("KeySideBSecuredG").disabled=true;			
	    document.getElementById("KeySideBSecuredB").disabled=true;	
	    //VerifyMTPConnAB (document.getElementById("ctl00_M_SideA").value, document.getElementById("ctl00_M_SideB").value);		
	    MakeMTPConnectorsEqual();
	}
	else
	{
	    if (document.getElementById('ctl00_M_KeySideBRow').style.display=='block')
	    {
	    document.getElementById("KeySideBStandard").disabled=false;		
	    document.getElementById("KeySideBSecuredR").disabled=false;		
	    document.getElementById("KeySideBSecuredY").disabled=false;			
	    document.getElementById("KeySideBSecuredG").disabled=false;			
	    document.getElementById("KeySideBSecuredB").disabled=false;			
	    }
	}	
}

function VerifyMTPConnAB( MTPA, MTPB)
{
if (MTPA==MTPB) 
{
}
else
{
        alert ("When choosing MTP Female low-loss connector for both ends, please choose the same one for each end.");
}
}

function addOption(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}

function cycle() 
	{
    if(document.aspnetForm.ctl00$M$CableType.value==''){
	return false;}
	
	toggleKey()
	var itemdescription = '';
	var convertstr = '';
	var PartNo = document.aspnetForm.Prefix.value+document.aspnetForm.ctl00$M$CableType.value;
	if(document.aspnetForm.FlameRating[0].checked)
		{
		PartNo+=document.aspnetForm.FlameRating[0].value
		}
	else
		{
		PartNo+=document.aspnetForm.FlameRating[1].value
		}
	if(document.all.hybrid.style.visibility == 'visible')
		{
		var totalcount = document.getElementById("TotalCount").value;
		var smcount = document.getElementById("SMCount").value;
		var dataNode = document.all.hybridxml.selectSingleNode("//DATA");
		var hybridNodes = eval('dataNode.selectNodes("//hybrid[@TotalCount = \''+totalcount+'\' and @SMValue = \''+smcount+'\']")')
		var mmcount;
		for(var i=0;i<hybridNodes.length;i++)
			{
			mmtext = hybridNodes[i].getAttribute("MMValue");
			mmcount = hybridNodes[i].getAttribute("MMCount");
			}
		document.aspnetForm.MMCount1.value = mmcount;
		document.aspnetForm.SMCount1.value = getSelectedLabelById("SMCount");
		PartNo+=mmtext+document.aspnetForm.SMCount.value;
		}
	else
		{
		PartNo+=document.aspnetForm.ctl00$M$FiberCount.value;
		}
    PartNo+=document.aspnetForm.ctl00$M$FiberType.value;
	PartNo+=document.aspnetForm.ctl00$M$SideA.value;
	PartNo+=document.aspnetForm.ctl00$M$SideB.value;
	// Custom breakout option (custom requirements checkbox) will override the breakout item chosen
	if (document.aspnetForm.chkCustomA.checked)
	    {
		PartNo+='C'
		}
	else if (document.aspnetForm.BreakOutA[0].checked)
		{
		PartNo+=document.aspnetForm.BreakOutA[0].value
		}
	else  if (document.aspnetForm.BreakOutA[1].checked)
		{
		PartNo+=document.aspnetForm.BreakOutA[1].value
		}
	else  
		{
		PartNo+=document.aspnetForm.BreakOutA[2].value
		}
	
	if (document.aspnetForm.chkCustomB.checked)
	    {
		PartNo+='C'
		}
	else if (document.aspnetForm.BreakOutB[0].checked)
		{
		PartNo+=document.aspnetForm.BreakOutB[0].value
		}
	else if (document.aspnetForm.BreakOutB[1].checked)
		{
		PartNo+=document.aspnetForm.BreakOutB[1].value
		}
	else  
		{
		PartNo+=document.aspnetForm.BreakOutB[2].value
		}
	
	
	if (document.aspnetForm.PullingEye[0].checked)
		{
		PartNo+=document.aspnetForm.PullingEye[0].value
		document.aspnetForm.PullEye.value = document.aspnetForm.PullingEye[0].value
		}
	else if (document.aspnetForm.PullingEye[1].checked)
		{
			PartNo+=document.aspnetForm.PullingEye[1].value
			document.aspnetForm.PullEye.value = document.aspnetForm.PullingEye[1].value
		}
	else
		{
			PartNo+=document.aspnetForm.PullingEye[2].value
			document.aspnetForm.PullEye.value = document.aspnetForm.PullingEye[2].value
		}
			
	if (document.aspnetForm.ctl00$M$LengthType[0].checked)
		{
		if (document.aspnetForm.ctl00$M$Units[0].checked)//feet
			{
			var padded = Math.ceil(document.aspnetForm.ctl00$M$Length.value);
			padded = padded + '';
			padded = AddPadding(padded);
			var len = parseFloat(document.aspnetForm.ctl00$M$Length.value); 
			convertstr = document.aspnetForm.ctl00$M$Length.value + ' Ft';
			var convert = (parseInt(100 * (len / 3.28))/100);
			convertstr += '[' + convert + " M]"	;
			PartNo += padded;
			}
		else //meters
			{
			var len = parseFloat(document.aspnetForm.ctl00$M$Length.value); 
			var padded = Math.ceil(len * 3.28);
			var convert = (parseInt(100 * (len * 3.28))/100);
			padded = padded + '';
			padded = AddPadding(padded);
			convertstr = document.aspnetForm.ctl00$M$Length.value + ' M';
			convertstr += '[' + convert + " Ft]"	;
			PartNo += padded;
       		}
		}
	else
		{
		PartNo += 'XXX';
       	}
       	
	if (document.getElementById('ctl00_M_KeySideARow').style.display=='block'){
	    var KeySideA  = getSelectedRadioButtonValue('KeySideA');
	    switch(KeySideA) {
	        case "1":
	            PartNo+='-SR';
	        break;
	        case "2":
                PartNo+='-SY';
	        break;
	        case "3":
                PartNo+='-SG';
	        break;
	        case "4":
                PartNo+='-SB';
	        break;	        
	     }
	  }	    

	if (document.getElementById('ctl00_M_KeySideARow').style.display!='block'){
	    if (document.getElementById('ctl00_M_KeySideBRow').style.display=='block'){
	        var KeySideB  = getSelectedRadioButtonValue('KeySideB');
	        switch(KeySideB) {
	            case "1":
	                PartNo+='-SR';
	            break;
	            case "2":
                    PartNo+='-SY';
	            break;
	            case "3":
                    PartNo+='-SG';
	            break;
	            case "4":
                    PartNo+='-SB';
	            break;	        
	         }
	      }
	  }	  
	    	  
	  document.aspnetForm.ctl00$M$PartNo.value = PartNo;
	
	var Description1='';
	var Description2='';
	var dataNode = document.all.builderxml.selectSingleNode("//DATA");
	var optionvalue,optionid,builderNodes
	if ((document.aspnetForm.ctl00$M$CableType.value == "I4") && (document.aspnetForm.ctl00$M$FiberCount.value == "04"))
		{
		optionvalue = 'I2';
		optionid = 'CableType';
		}
	else
		{
		optionvalue = document.aspnetForm.ctl00$M$CableType.value;
		optionid = 'CableType';
		}
	builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \''+optionid+'\' and @Value = \''+optionvalue+'\']\")');
	Description1+= builderNodes[0].getAttribute("Description")
	
	if(document.aspnetForm.FlameRating[0].checked)
		{
		optionvalue = document.aspnetForm.FlameRating[0].value
		}
	else
		{
		optionvalue = document.aspnetForm.FlameRating[1].value
		}
	optionid = 'FlameRating'
	builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \''+optionid+'\' and @Value = \''+optionvalue+'\']\")');
	Description1+= ',' + builderNodes[0].getAttribute("Description")
	
	if(document.all.hybrid.style.visibility == 'visible')
		{
		Description1+= ',Hybrid '+mmcount+' MM/'+getSelectedLabelById("SMCount")+' SM'
		}
	else
		{
		optionvalue = document.aspnetForm.ctl00$M$FiberCount.value
		optionid = 'FiberCount'
		builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \''+optionid+'\' and @Value = \''+optionvalue+'\']\")');
		Description1+= ',' + builderNodes[0].getAttribute("Description")
		}
		
	//if Adventum, or Adventum with Armor and 24 count, add "Duplex Design" to the description
	if (((document.aspnetForm.ctl00$M$CableType.value == "LT") ||  (document.aspnetForm.ctl00$M$CableType.value == "LK")  )&& (document.aspnetForm.ctl00$M$FiberCount.value == "24"))
		{
		Description1+= ', Duplex Design'
		}
	
	if (document.aspnetForm.ctl00$M$FiberType.value != '')
	{
	optionvalue = document.aspnetForm.ctl00$M$FiberType.value
	optionid = 'FiberType'
	builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \''+optionid+'\' and @Value = \''+optionvalue+'\']\")');
	Description1+= ',' + builderNodes[0].getAttribute("Description")
	}
	
	var jacketNode = document.all.jacketxml.selectSingleNode("//DATA");
	var cabletype = document.getElementById("ctl00_M_CableType").value;
	var flamerating
	var jacketcolor = ''
	if (document.all.aspnetForm.FlameRating[0].checked == true)
		{
		flamerating = document.all.aspnetForm.FlameRating[0].value;
		}
	else
		{
		flamerating = document.all.aspnetForm.FlameRating[1].value;
		}
	var fibertype = document.getElementById("ctl00_M_FiberType").value;
	var colorNodes = eval('jacketNode.selectNodes(\"//jacketcolor[@CableType = \''+cabletype+'\' and @FlameRating = \''+flamerating+'\' and @FiberType = \''+fibertype+'\']\")');
	if(colorNodes.length != 0)
		{
		jacketcolor = colorNodes[0].getAttribute("Description")
		}
	optionvalue = document.aspnetForm.ctl00$M$SideA.value
	optionid = 'SideA'
	builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \''+optionid+'\' and @Value = \''+optionvalue+'\']\")');
	Description2+= builderNodes[0].getAttribute("Description")+' '
		
		//BAL   05/29/2008  Add Secure Key option to description
	if (document.getElementById('ctl00_M_KeySideARow').style.display=='block'){
	    var KeySideA  = getSelectedRadioButtonValue('KeySideA');
	    switch(KeySideA) {
	        case "1":
	            Description2+='Secure Key Red,';
	        break;
	        case "2":
	            Description2+='Secure Key Yellow,';
	        break;
	        case "3":
	            Description2+='Secure Key Green,';
	        break;
	        case "4":
	            Description2+='Secure Key Blue,';
	        break;	        
	     }
	  }	
	  
	if (optionvalue != 'N')
		{
		if (document.aspnetForm.BreakOutA[0].checked)
			{
			optionvalue = document.aspnetForm.BreakOutA[0].value
			Description2+='with ' + getBreakOutSText('A') + ','
			}
		else if (document.aspnetForm.BreakOutA[1].checked)
			{
			    //optionvalue = document.aspnetForm.BreakOutA[1].value
			    optionvalue = document.aspnetForm.BreakOutA[1].value
			    Description2 += 'with ' + getBreakOutFText('A') + ','
			
			}
		else if (document.aspnetForm.BreakOutA[2].checked)
			{
			    optionvalue = document.aspnetForm.BreakOutA[2].value
			    optionid = 'BreakOutA'
			    builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \'' + optionid + '\' and @Value = \'' + optionvalue + '\']\")');
			    Description2 += builderNodes[0].getAttribute("Description")			
			}
		else
			{
			    optionvalue = document.aspnetForm.BreakOutA[3].value
			    optionid = 'BreakOutA'
			    builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \'' + optionid + '\' and @Value = \'' + optionvalue + '\']\")');
			    Description2 += builderNodes[0].getAttribute("Description")
			
			}	
		}
	if (document.aspnetForm.chkCustomA.checked)
		{
		Description2+='Custom Break-Out -' + document.aspnetForm.ctl00$M$CustomA.value+',';
		}
	else if (optionvalue != 'N')
		{
		Description2+=' 39 in. Break-Out,';
		}
	
	optionvalue = document.aspnetForm.ctl00$M$SideB.value
	optionid = 'SideB'
	builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \''+optionid+'\' and @Value = \''+optionvalue+'\']\")');
//LLP 12/15/2006 4:10:04 PM - add "if" statement
//builderNodes.length is 0 if pigtails is selected, because pigtails don't have side b.
    if (builderNodes.length>0)
	Description2+= builderNodes[0].getAttribute("Description")+' '

	//BAL   05/29/2008  Add Secure Key option to description
	if (document.getElementById('ctl00_M_KeySideBRow').style.display=='block'){
	    var KeySideB  = getSelectedRadioButtonValue('KeySideB');
	    switch(KeySideB) {
	        case "1":
	            Description2+='Secure Key Red,';
	        break;
	        case "2":
	            Description2+='Secure Key Yellow,';
	        break;
	        case "3":
	            Description2+='Secure Key Green,';
	        break;
	        case "4":
	            Description2+='Secure Key Blue,';
	        break;	        
	     }
	  }	
	  	 
	if (optionvalue != 'N')
		{
		if (document.aspnetForm.BreakOutB[0].checked)
			{
			optionvalue = document.aspnetForm.BreakOutB[0].value
			Description2+='with ' + getBreakOutSText('B') + ','
			}
		else if (document.aspnetForm.BreakOutB[1].checked)
			{
			    //optionvalue = document.aspnetForm.BreakOutB[1].value
			    optionvalue = document.aspnetForm.BreakOutB[1].value
			    Description2 += 'with ' + getBreakOutFText('B') + ','
			
			}
		else if (document.aspnetForm.BreakOutB[2].checked)
			{
			    optionvalue = document.aspnetForm.BreakOutB[2].value
			    optionid = 'BreakOutA'
			    builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \'' + optionid + '\' and @Value = \'' + optionvalue + '\']\")');
			    Description2 += builderNodes[0].getAttribute("Description")			
			}
		else
			{
			    optionvalue = document.aspnetForm.BreakOutB[3].value
			    optionid = 'BreakOutA'
			    builderNodes = eval('dataNode.selectNodes(\"//builder[@FieldName = \'' + optionid + '\' and @Value = \'' + optionvalue + '\']\")');
			    Description2 += builderNodes[0].getAttribute("Description")
			}
		}
	if (document.aspnetForm.chkCustomB.checked)
		{
		Description2+= 'Custom Break-Out -' + document.aspnetForm.ctl00$M$CustomB.value+',';
		}
	else if (optionvalue != 'N')
		{
		Description2+=' 39 in. Break-Out,';
		}

	//LLP 4/11/2007 11:48:03 AM - Ground wire
	if (document.getElementById('ctl00_M_GroundWireRow').style.display=='block'){
	    var GroundWire = getSelectedRadioButtonValue('GroundWire');
	    switch(GroundWire) {
	        case "1":
	            Description2+='Ground Wire Side A,';
	        break;
	        case "2":
	            Description2+='Ground Wire Side B,';
	        break;
	        case "3":
	            Description2+='Ground Wire Side A and Side B,';
	        break;
	     }
	}
	
	if (document.aspnetForm.PullingEye[0].checked)
		{
		Description2+='No Pulling Eye,';
		}
	else if (document.aspnetForm.PullingEye[1].checked)
		{
			Description2+='Standard PE Pulling End Only';
		}
	else
		{
			Description2+='Standard PE Both ends';
		}	
		
		//BAL 11/05/2007  Add OD to Pulling eye option, except for "No Pulling Eye"		
		if (document.aspnetForm.PullingEye[0].checked == false)
	    {
	    
			if (document.all.pullopttype.innerHTML == 'Standard Pulling eye requires min. 2" ID duct (PE has a OD 1.3" nom)')
			    {
			     Description2+='-(1.3" OD),';
			    }			    
			else if (document.all.pullopttype.innerHTML == 'Standard Pulling eye requires min. 3" ID duct (PE has a OD 2" nom)')
			    {
			     Description2+='-(2" OD),';
			    }
			else if (document.all.pullopttype.innerHTML == 'Standard Pulling eye requires min. 3" ID duct (PE has a OD 2.35" nom)')
			    {
			     Description2+='-(2.35" OD),';
			    }
		}		    
	if (document.aspnetForm.ctl00$M$LengthType[0].checked)
		{
		if (document.aspnetForm.ctl00$M$Units[0].checked) //feet
			{
			var len = parseFloat(document.aspnetForm.ctl00$M$Length.value); 
			convertstr = document.aspnetForm.ctl00$M$Length.value + ' Ft';
			var convert = ((Math.ceil(10 * (len / 3.28)))/10);
			convertstr += '[' + convert + " M]"	;
			}
		else // meters
			{
			var len = parseFloat(document.aspnetForm.ctl00$M$Length.value); 
			convertstr = document.aspnetForm.ctl00$M$Length.value + ' M';
			var convert = Math.ceil((parseInt(100 * (len * 3.28))/100));
			convertstr += '[' + convert + " Ft]"	;
       		}
		}
	else if (document.aspnetForm.ctl00$M$LengthType[1].checked)
		{
		var convertstr = 'Length: Per Foot/Meter Adder';
       	}
	else
		{
		var convertstr = 'Multi-Length';
       	}
	document.all.aspnetForm.Description1.value = Description1+','+jacketcolor+','
	document.all.aspnetForm.Description2.value = Description2 + convertstr
	document.aspnetForm.ctl00$M$Description.value = Description1+','+jacketcolor+',' + Description2 + convertstr;
	togglePullingEyeType();
	showhideConnectorMsg();
}

//Called by the button that hides and shows the description
function ToggleCableDesc()
{
    var CableDescRow = document.getElementById("ctl00_M_CableDescRow");
    if (document.getElementById('ctl00_M_CableDescRow').style.display=='block')
		{	
		Hide(CableDescRow);
		document.aspnetForm.hdCableDesc.value = 'h';
		document.getElementById('ctl00_M_CableDescLnk').innerHTML = "Click here for more detail";
		}
	else
		{
		Show(CableDescRow);
		document.aspnetForm.hdCableDesc.value = 's';
		document.getElementById('ctl00_M_CableDescLnk').innerHTML = "Click here to hide detail.";
		}
}

//Since all rows are set to "block"  need to reset the row according to the hidden value 
function SetCableDesc()
{
    var CableDescRow = document.getElementById("ctl00_M_CableDescRow");
    ShowChosenCableDesc();
    if (document.aspnetForm.hdCableDesc.value == 'h')
		{	
		Hide(CableDescRow);
		document.aspnetForm.hdCableDesc.value = 'h';
		}
	else
		{
		Show(CableDescRow);
		document.aspnetForm.hdCableDesc.value = 's';
		}
}

function ShowChosenCableDesc()
{
        var uls = document.getElementById('CableDescList').getElementsByTagName('li');
        var CableType =document.getElementById("ctl00_M_CableType")
        var SelectText = 'CTD' + CableType.options[CableType.selectedIndex].text;
        var imagenum;
        
        if (SelectText == 'CTD--Select Cable Type--') {
            rollover('0');
        }
         for(i=0;i<uls.length;i++)
        {
        if (SelectText == 'CTD--Select Cable Type--') 
              {
                Show(uls[i]);
                }
        else
        {
        var litext = uls[i].id;
            if (SelectText == litext   )
               {
                   Show(uls[i]);
                   imagenum = i + 1;
                   rollover(imagenum + '');
                }
            else
               {
                Hide(uls[i]);
                }
          }
        }
}

function rollover(imgnum) {
    switch (imgnum) {
        case "0":
            document.getElementById("cableimage1").src = "../cableassemblies/images/product/Adventum.jpg";
            document.getElementById('cableimagetext').innerHTML = 'Adventum';
            break;
	        case "1":
	            document.getElementById("cableimage1").src = "../cableassemblies/images/product/Adventum.jpg";
	            document.getElementById('cableimagetext').innerHTML = 'Adventum';
    	        break;
	        case "2":
	            document.getElementById("cableimage1").src = "../cableassemblies/images/product/Adventum with ArmorTek.jpg";
	            document.getElementById('cableimagetext').innerHTML = 'Adventum with ArmorTek';
	            break;
	        case "3":
	            document.getElementById("cableimage1").src = "../cableassemblies/images/product/Adventum Tight Buffer.jpg";
	            document.getElementById('cableimagetext').innerHTML = 'Adventum Tight Buffer';
	            break;
	        case "4":
	            document.getElementById("cableimage1").src = "../cableassemblies/images/product/Micro Data Center.jpg";
	            document.getElementById('cableimagetext').innerHTML = 'Micro Data Center';	            
	            break;
	        case "5":
	            document.getElementById("cableimage1").src = "../cableassemblies/images/product/Premises Distribution.jpg";
	            document.getElementById('cableimagetext').innerHTML = 'Premises Distribution';
	            break;
	        case "6":
	            document.getElementById("cableimage1").src = "../cableassemblies/images/product/Premises Distribution with ArmorTek.jpg";
	            document.getElementById('cableimagetext').innerHTML = 'Premises Distr. w/ ArmorTek';
	            break;	            
	        case "7":
	            document.getElementById("cableimage1").src = "../cableassemblies/images/product/Ribbon Interconnect.jpg";
	            document.getElementById('cableimagetext').innerHTML = 'Ribbon Interconnect';	            	            
	            break;
	        case "8":
	            document.getElementById("cableimage1").src = "../cableassemblies/images/product/Interconnect Round.jpg";
	            document.getElementById('cableimagetext').innerHTML = 'Interconnect Round';	            
	            break;	            
	  }	
}

//Called by the button that hides and shows the description
function ToggleFiberDesc()
{
    var FiberDescRow = document.getElementById("ctl00_M_FiberDescRow");
    if (document.getElementById('ctl00_M_FiberDescRow').style.display=='block')
	
		{	
		Hide(FiberDescRow);
		document.aspnetForm.hdFiberDesc.value = 'h';
		document.getElementById('ctl00_M_FiberDescLnk').innerHTML = "Click here for more detail";

		}
	else
		{
		Show(FiberDescRow);
		document.aspnetForm.hdFiberDesc.value = 's';
		document.getElementById('ctl00_M_FiberDescLnk').innerHTML = "Click here to hide detail";
		}
}

function SetFiberDesc()
{
    var FiberDescRow = document.getElementById("ctl00_M_FiberDescRow");
    ShowChosenFiberDesc();
    if (document.aspnetForm.hdFiberDesc.value == 'h')
		{	
		Hide(FiberDescRow);
		document.aspnetForm.hdFiberDesc.value = 'h';
		}
	else
		{
		Show(FiberDescRow);
		document.aspnetForm.hdFiberDesc.value = 's';
		}
}

function ShowChosenFiberDesc()
{
        var uls = document.getElementById('FiberDescList').getElementsByTagName('li');
        var FiberType =document.getElementById("ctl00_M_FiberType")
        var SelectText = 'FTD' + FiberType.options[FiberType.selectedIndex].text;
         for(i=0;i<uls.length;i++)
        {
        if (SelectText == 'FTD--Select Fiber Type--' || uls[i].id=='FTDSHOW') 
              {
                Show(uls[i]);
                }
        else
        {
        var litext = uls[i].id;
            if (SelectText == litext   )
               {
                Show(uls[i]);
                }
            else
               {
                Hide(uls[i]);
                }
          }
        }
}