<!--
// Product Option Update Code v.2 //
// (c) Copyright 2004 - Radical Webs Inc //
// http://www.radicalwebs.com //
// Contact Us if you wish to use this code //


function composeDescription(frm) {
	
	var desc = '';
	var desc2 = '';
	var sep = '';
	
	for( j=0; j<frm.elements.length; j++ ) {
	
		var field = frm.elements[j];
	
		if (field.checked) {
			desc += sep + field.value;
			sep = '; ';
		}
	
	}
	
	frm.os0.value = desc;
	
}



function addMe(field,max) {
	
	var item = field.form;
	
	var box = field.name.substr(0,field.name.lastIndexOf('_')+1);
	var cnt=0,i=1;
	
	while(field.form[box+i]) {
		cnt += field.form[box+i].checked;i++;
	}
	
	if (cnt > max) {
		field.checked = false;
		alert('Only choose ' + max + ' '+box.substr(0,box.length-1) +' checkboxes.\nTo pick this option unselect one of the others.');
	} else {
		composeDescription(item);
		item.Total.value = cnt;
	}
	
}

// Check that max check boxes were checked else show error and do not submit

function validate(theForm,fObj,max){
	
	var strValue = theForm.elements[fObj].value;
	
   //Make sure the field is not empty
   if(strValue == 0){
		alert('You must select ' + max + ' webinars!');
		//theForm.elements[fObj].focus();
		return false;
		}
   //Check if less than 4 but greater than 0
   if(strValue < max && strValue > 0){
		alert('You have less than ' + max + ' Webinars Selected!\nYou must select ' + max + ' webinars!');
		//theForm.elements[fObj].focus();
		return false;
		}
   //Check if more than 4
   if(strValue > max){
		alert('You have more than ' + max + ' Webinars Selected!\nYou must select only ' + max + ' webinars!');
		//theForm.elements[fObj].focus();
		return false;
		} 
	 return true;
	 
}


/*
function addMe(field) {
	
	var item = field.form;
	
	composeDescription(item);
	
}
*/
//-->