function validate() {	
	var ErrMsg = 'You left out the following fields:                           ';
	var ErrName = 'Company Information - Company Name';
	var ErrPhone = 'Company Information - Phone';
	var ErrEmail = 'Company Information - Email';
	var ErrAddr = 'Company Information - Primary Address';
	var ErrCountry = 'Company Information - Country';
	var ErrBusifocus = 'Business Type - Primary Business Focus';
	var ErrBusitype = 'Business type';
	var ErrCiname = 'Point of Contact Information - Name(1)';
	var ErrCiaddress = 'Point of Contact Information - Address';
	var ErrCiphone = 'Point of Contact Information - Phone';
	var strEmptyFields = '';
	var thisDoc = document.form1;	
	if (thisDoc.ci_companyname.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrName + '\n'};
	if (thisDoc.ci_telephone.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrPhone + '\n'};
	if (thisDoc.ci_email.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrEmail + '\n'};
	if (thisDoc.ci_address.value.length == 0) {strEmptyFields = strEmptyFields + ' '+ ErrAddr + '\n'};
	if (thisDoc.ci_country.value.length == 0) {strEmptyFields = strEmptyFields + ' '+ ErrCountry + '\n'};
	if (thisDoc.ci_primebusiness.value.length == 0) {strEmptyFields = strEmptyFields + ' '+ ErrBusifocus + '\n'};	
	if (!radio_button_checker(thisDoc)) {strEmptyFields = strEmptyFields + ' '+ ErrBusitype + '\n'};
	if (thisDoc.pci_name1.value.length == 0) {strEmptyFields = strEmptyFields + ' '+ ErrCiname + '\n'};
	if (thisDoc.pci_address1.value.length == 0) {strEmptyFields = strEmptyFields + ' '+ ErrCiaddress + '\n'};	
	if (thisDoc.pci_telephone1.value.length == 0) {strEmptyFields = strEmptyFields + ' '+ ErrCiphone + '\n'};

	if (strEmptyFields.length > 0){
		window.alert(ErrMsg + '\n\n' + strEmptyFields)
		return false;
	}else{
		setField(thisDoc);
		return true;
	}
}

function radio_button_checker(object){
// set var radio_choice to false
var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0;  counter < object.bt_rdo.length; counter++){
// If a radio button has been selected it will return true
// (If not it will return false)
	if (object.bt_rdo[counter].checked)
	radio_choice = true; 
}

if (!radio_choice){
// If there were no selections made display an alert box 
	return (false);
}
	return (true);
}

function setField(object){
	var thisDoc = object;
	//company information
	if (thisDoc.ci_website.value.length == 0) {thisDoc.ci_website.value="-"};
	if (thisDoc.ci_fax.value.length == 0) {thisDoc.ci_fax.value="-"};
	if (thisDoc.ci_commenced.value.length == 0) {thisDoc.ci_commenced.value="-"};
	if (thisDoc.ci_employees.value.length == 0) {thisDoc.ci_employees.value="-"};
	if (thisDoc.ci_technician.value.length == 0) {thisDoc.ci_technician.value="-"};
	if (thisDoc.ci_BAS1.value.length == 0) {thisDoc.ci_BAS1.value="-"};
	if (thisDoc.ci_BAS2.value.length == 0) {thisDoc.ci_BAS2.value="-"};
	if (thisDoc.ci_BAS3.value.length == 0) {thisDoc.ci_BAS3.value="-"};
	if (thisDoc.ci_BAS4.value.length == 0) {thisDoc.ci_BAS4.value="-"};
	if (thisDoc.ci_BAS5.value.length == 0) {thisDoc.ci_BAS5.value="-"};
	if (thisDoc.ci_BAS6.value.length == 0) {thisDoc.ci_BAS6.value="-"};
	if (thisDoc.bt_other.value.length == 0) {thisDoc.bt_other.value="-"};
	//contact information
	if (thisDoc.pci_email1.value.length == 0) {thisDoc.pci_email1.value="-"};
	if (thisDoc.pci_fax1.value.length == 0) {thisDoc.pci_fax1.value="-"};
	if (thisDoc.pci_type1.value.length == 0) {thisDoc.pci_type1.value="-"};
	if (thisDoc.pci_name2.value.length == 0) {thisDoc.pci_name2.value="-"};
	if (thisDoc.pci_address2.value.length == 0) {thisDoc.pci_address2.value="-"};
	if (thisDoc.pci_email2.value.length == 0) {thisDoc.pci_email2.value="-"};
	if (thisDoc.pci_telephone2.value.length == 0) {thisDoc.pci_telephone2.value="-"};
	if (thisDoc.pci_fax2.value.length == 0) {thisDoc.pci_fax2.value="-"};
	if (thisDoc.pci_type2.value.length == 0) {thisDoc.pci_type2.value="-"};
	//business & trade references
	if (thisDoc.btr_name1.value.length == 0) {thisDoc.btr_name1.value="-"};
	if (thisDoc.btr_address1.value.length == 0) {thisDoc.btr_address1.value="-"};
	if (thisDoc.btr_email1.value.length == 0) {thisDoc.btr_email1.value="-"};
	if (thisDoc.btr_telephone1.value.length == 0) {thisDoc.btr_telephone1.value="-"};
	if (thisDoc.btr_fax1.value.length == 0) {thisDoc.btr_fax1.value="-"};
	if (thisDoc.btr_type1.value.length == 0) {thisDoc.btr_type1.value="-"};
	if (thisDoc.btr_name2.value.length == 0) {thisDoc.btr_name2.value="-"};
	if (thisDoc.btr_address2.value.length == 0) {thisDoc.btr_address2.value="-"};
	if (thisDoc.btr_email2.value.length == 0) {thisDoc.btr_email2.value="-"};
	if (thisDoc.btr_telephone2.value.length == 0) {thisDoc.btr_telephone2.value="-"};
	if (thisDoc.btr_fax2.value.length == 0) {thisDoc.btr_fax2.value="-"};
	if (thisDoc.btr_type2.value.length == 0) {thisDoc.btr_type2.value="-"};
	if (thisDoc.btr_name3.value.length == 0) {thisDoc.btr_name3.value="-"};
	if (thisDoc.btr_address3.value.length == 0) {thisDoc.btr_address3.value="-"};
	if (thisDoc.btr_email3.value.length == 0) {thisDoc.btr_email3.value="-"};
	if (thisDoc.btr_telephone3.value.length == 0) {thisDoc.btr_telephone3.value="-"};
	if (thisDoc.btr_fax3.value.length == 0) {thisDoc.btr_fax3.value="-"};
	if (thisDoc.btr_type3.value.length == 0) {thisDoc.btr_type3.value="-"};
	//signatures
	if (thisDoc.as_name1.value.length == 0) {thisDoc.as_name1.value="-"};
	if (thisDoc.as_date1.value.length == 0) {thisDoc.as_date1.value="-"};
	if (thisDoc.as_name2.value.length == 0) {thisDoc.as_name2.value="-"};
	if (thisDoc.as_date2.value.length == 0) {thisDoc.as_date2.value="-"};
	//set hidden field
	thisDoc.email.value=thisDoc.ci_email.value;
	thisDoc.realname.value=thisDoc.pci_name1.value;
	thisDoc.recipients.value="sales@flexidrv.com";
}
