var Name_Option_text='';

function updateCart (form,MYIDform){
if (!form.AddOn1.value && !form.AddOn2.value && !form.AddOn3.value && !form.AddOn4.value && !form.AddOn5.value && !form.AddOn6.value && !form.AddOn7.value){
jAlert('<center><br />Please Select Runner Length<br />or<br />Select # Stair Treads - all Treads are serged on all sides.</center>','Oops!!' );
return false;

}else if (!form.AddOn1.value && form.AddOn2.value){
jAlert("Serging or Capping requires you select Runner length");
return false;

}else if (form.AddOn3.value && !form.AddOn2.value){
  jAlert("Sorry to add a Fringe the Runner must be Serged or Capped");
    FinishedEndsID(MYIDform)
    toggle_visibility('show',MYIDform,Name_Option_text)
  return false;

}else if (form.AddOn7.value && !form.AddOn4.value){

 jConfirm('Do You Require Pad for your Stair Treads?', 'Oops Did you Forget Something!!', function(r){
if( !r ){
        document.forms[MYIDform].submit();
 }else{
          PadText(MYIDform)
          toggle_visibility('show',MYIDform,Name_Option_text)
          return true;
    } 
});

return false;
}
}


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";
  }
//return Name_Option_text;

}
function FinishedEndsID(MYIDform){
  if (MYIDform == 'Cart-Form1'){ 
  Name_Option_text = "endfinish1";
  }
  if (MYIDform == 'Cart-Form2'){ 
  Name_Option_text = "endfinish2";
  }
  if (MYIDform == 'Cart-Form3'){ 
  Name_Option_text = "endfinish3";
  }
  if (MYIDform == 'Cart-Form4'){ 
  Name_Option_text = "endfinish4";
  } 
 //return Name_Option_text;

}

function OptionwidthShow_HideXXX(){
eval("document.all."+'Show_Option'+".style.visibility='visible';");
}

function OptionwidthShow_Hide(){

var okay_yes = document.getElementById('Show').selectedIndex;

if (okay_yes =='0'){
  eval("document.getElementById('Show_Option_Width').style.visibility='hidden';");
   document.getElementById('Show_Option_Width').selectedIndex = 0;
  }else{
   eval("document.getElementById('Show_Option_Width').style.visibility='visible';");
  }
}


