// swap elements based on ID and class
function toggleProduct(productID)
{
	eProductHide = document.getElementsByClassName('column on');
	for (i = 0; i < eProductHide.length; i++) {
		eProductHide[i].className = 'column';
	}
	eProductShow = document.getElementById(productID);
	eProductShow.className = 'column on';

	eSizeHide = document.getElementsByClassName('size');
	for (i = 0; i < eSizeHide.length; i++) {
		eSizeHide[i].style.display = 'none';
	}
	eSizeShow = document.getElementById('size-'+productID);
	eSizeShow.style.display = 'block';
}

function validateProduct(thisform)
{
        checked = false;

        for (i=0; i<thisform.productid.length; i++) {
               
             if (thisform.productid[i].checked=="1"){
                    checked = true;
                    break;
              }
         }

         if(!checked)
         {
            alert("Please select a product.");
         }
         
         return checked;
}


function validateZip(thisform){
            returnVal = true;

   	var zipRegExp = /^\d{5}([\-]\d{4})?$/;

   	if(!zipRegExp.test(thisform.zipcode.value)) {
               alert("Please enter a valid zip code.");
                thisform.zipcode.focus();
                returnVal = false;
   	}

            if(thisform.zipcode.value == ""){
                alert("Please enter a valid zip code.");
                returnVal = false;
                thisform.zipcode.focus();
            }

            return returnVal;
}

function validate(thisform)
{
          returnValue = false;

          if( validateProduct(thisform) && validateZip(thisform))
          {
              returnValue = true;
          }

          return returnValue;
}


