function treadcheck(form,MYIDform){

var selection = document.forms[MYIDform].Color;
//var braided = document.forms[MYIDform].Multi;
var braided = document.forms[MYIDform].SKU.value;





if (!form.AddOn6.value && !form.AddOn1.value){
jAlert('<center><br />Please Select # Stair Treads - all Treads are Finished on all sides.</center>','Oops!!' );
return false;

}else if (form.AddOn1.value && selection[0].checked == true && braided != 'Braided'){

 jConfirm('Would you Like to Upgrade your pad', 'Option!!', function(r){
if( !r ){
         document.forms[MYIDform].submit();
 }else{
         testdata(selection,MYIDform); 
         PadText(MYIDform);
          toggle_visibility('show',MYIDform,Name_Option_text);
         return true;
 }        
});

return false;
}
testdata(selection,MYIDform);
}


function testdata(selection,MYIDform){
//var NumberTreads = document.getElementById('AddOn1').selectedIndex;
var NumberTreads = document.forms[MYIDform].AddOn1.selectedIndex;
var PadUpgradePriceEach = 3.00;
var TreadPrice = (NumberTreads * PadUpgradePriceEach);

var PadUpgradePriceEach=PadUpgradePriceEach.toFixed(2);
var TreadPrice=TreadPrice.toFixed(2);
var Grade = "Pad Upgrade Cost $"+TreadPrice+" "+"(For pad cut & glued to "+NumberTreads+" "+"Treads -"+" $"+PadUpgradePriceEach+" "+"Per Tread)^"+TreadPrice;

if (selection[1].checked == true){ 
 document.forms[MYIDform].NAddOn1.value = Grade;
}
if (selection[1].checked == false){ 
  document.forms[MYIDform].NAddOn1.value = "FREE Pad";
}

}// end Function




function toggle_visibility(hideorshow,MYIDform,Name_Option_text)
{

       var e = document.getElementById(Name_Option_text);
        if (hideorshow == 'hide')
    {
        if (e.style.visibility == 'visible')
        {
            blink(10);
        }
        else
        {
            blink(10);
        }
    }
    else
    {
        if (e.style.visibility == 'visible')
        {
            blink(10);
        }
        else
        {
            blink(10);
        }
    }
}
function blink(count)
{

    var count = count
    var e = document.getElementById(Name_Option_text);
    e.style.visibility = ( e.style.visibility == 'visible' )? 'hidden' : 'visible';
    count--;
    if (count <= 0)
    {
    return;
        }
    else
    {
        setTimeout("blink('" + count + "');", 500);
    }
}

function PadText(MYIDform){
if (MYIDform == 'Cart-Form1'){ 
  Name_Option_text = "alerticon1";
  }
  if (MYIDform == 'Cart-Form2'){ 
  Name_Option_text = "alerticon2";
  }
  if (MYIDform == 'Cart-Form3'){ 
  Name_Option_text = "alerticon3";
  }
  if (MYIDform == 'Cart-Form4'){ 
  Name_Option_text = "alerticon4";
  }

}

