function check_cart_checkout ( )
{
//alert('adsfsdf');

	if (document.cart_checkout.ButtonClicked.value == 'checkout') {
	// validate myradiobuttons
		var giftwrappingOption = -1;
		if (document.gift_wrap) {
			for (i=document.gift_wrap.giftwrappingSelected.length-1; i > -1; i--) {
				if (document.gift_wrap.giftwrappingSelected[i].checked) {
					giftwrappingOption = i;
					i = -1;
				}
			}
		}
	
	
//	alert(document.cart_checkout.sess_giftwrap.value + ' and ' + giftwrappingOption);
		if ((document.cart_checkout.sess_giftwrap.value != "Y") && (giftwrappingOption == -1)) {
			alert("  Please select a gift card option.  " );
			document.gift_wrap.giftwrappingSelected[0].focus();
			return false ;
		}
	}
	return true ;
}

function cart_checkout_clickedbutton ( v )
{
	document.cart_checkout.ButtonClicked.value = v;
}

 function HandleSelects(selectname)
   {
      fselectlist=document.getElementsByName(selectname);
      if (fselectlist.length>0) {
         fselect=fselectlist[0];
         selectvalue=0;

   for (x=0;x<fselect.options.length;x++) {
    if (fselect.options[x].selected) {
     selectvalue=parseInt(fselect.options[x].value);
    }
   }
   /* Handling for making the other value greyed out */
   if (selectvalue>=367 && selectvalue<=378) {
    /* see if we have a prefix */
    prefix="";
    if (selectname.charAt(0)=='x') {
     prefix="x";
     for (x=1;x<selectname.length;x++) {
      if (selectname.charAt(x)>='0' && selectname.charAt(x)<='9') {
       prefix+=selectname.charAt(x);
      } else {
       break;
      }
     }
    }

    /* See if we can find the enter your gift option */
    for (x=1;x<100;x++) {
     sElemlist=document.getElementsByName(prefix+"UserCaption"+x.toString());
     if (sElemlist.length>0) {
        if (sElemlist[0].value=="83") {
           sOtherList=document.getElementsByName(prefix+"Feature"+x.toString());
           if (sOtherList.length>0) {
              if (selectvalue<377 || selectvalue==378) {
                 sOtherList[0].disabled=true;
                 sOtherList[0].value="";
              } else {
                 sOtherList[0].disabled=false;
              }
              break;
           }
        }
     }
    }
   }
      }
   }

   function DoOnLoad()
   {
      for (x=1;x<100;x++) {
         flist=document.getElementsByName("Feature"+x.toString());
         if (flist.length>0) {
            if (flist[0].type.substring(0,6)=="select") {
               HandleSelects("Feature"+x.toString());
            }
         } else {
            break;
         }
      }

      for (y=0;y<100;y++) {
         for (x=1;x<100;y++) {
            flist=document.getElementsByName("x"+y.toString()+"Feature"+x.toString());
            if (flist.length>0) {
               HandleSelects("x"+y.toString()+"Feature"+x.toString());
            } else {
               break;
            }
         }
      }
   }