/*************************************************************************/
/********************       Ezzy Mast Configurator     *******************/
/*************************************************************************/
 
function CheckForm1() { 
   isChecked=false  

   for(var i=0;i<document.forms["form1"]["sail_list[]"].length;i++) {  
              if(document.forms["form1"]["sail_list[]"][i].checked){ 
                 isChecked=true 
              } 
   } 

   if(isChecked) { document.forms["form1"].submit() } 
   else { 
      alert('Please select at least one sail...   ') 
      return false;
   }   

} 

function CheckForm2( thisForm ) {  
   if (CheckForm2Sail( thisForm ) == true) { 
       if (CheckForm2Extension( thisForm ) == true) {
          thisForm.submit();   
       } else { 
          alert('Please select an extension.');
          return false; 
       }
   }  else { 
       alert('Please select at lease one sail.'); 
       return false; 
   }
} 

function CheckForm2Sail( thisForm ) {

    // javascript quirk where 1 option in a radio group will return undefined for length 
    // because assumes and object.


    if ( typeof( document.form2.sail.length ) == "undefined" ) {  
      return true; 
    }  
 

    var isChecked=false; 
 

    for(var i=0;i< document.form2.sail.length;i++) {   
              if( thisForm.sail[i].checked) { 
                 isChecked=true 
              } 
    } 

   if(isChecked){ return true; } else { return false; }    
}

function CheckForm2Extension( thisForm ) {

   var isChecked=false  

          for(var i=0;i< thisForm.extension.length;i++) {  
              if( thisForm.extension[i].checked) { 
                 isChecked=true 
              } 
          } 

   if(isChecked){ return true; } else { return false; }    
}

/*************************************************************************/
/********************     Ezzy Mast Configurator      ********************/
/*************************************************************************/

