// lead.js  - used by enquiry_form.js, new_member_form.js and member_form.js
function LeadOptions(f, thisForm)
{
    var ddLeadList = document.getElementsByName('LeadList');
    if (ddLeadList.length > 0) {
		for(var i=ddLeadList[0].options.length-1;i>=0;i--) {
			if (ddLeadList[0].options[i].value == f.value)
				var ddLeadListText = ddLeadList[0].options[i].text;                  
		}
	} 

//	alert("Found match on line " + ddLeadListText);
	var LeadListTokens = ddLeadListText.split( "|" );  
	      
	if (LeadListTokens[1] == '0')  {
	    thisForm.lead_details.value = "n/a"; 
	    thisForm.lead_details.disabled = true; 
	}
	else {
		if (thisForm.lead_details.value == "n/a")
	    	thisForm.lead_details.value = ""; 
	    thisForm.lead_details.disabled = false; 
		thisForm.lead_details.focus();
		thisForm.lead_details.select();
	}	    
	if (LeadListTokens[2] == '0') {
	    thisForm.lead_member_no.value = "n/a"; 
	    thisForm.lead_member_no.disabled = true; 
	}
	else {
	    if (thisForm.lead_member_no.value == "n/a")
	    	thisForm.lead_member_no.value = ""; 
	    thisForm.lead_member_no.disabled = false; 
	}

    if (thisForm.lead_details.value == "n/a" &&
    	thisForm.lead_member_no.value == "n/a")  {
		thisForm.message.focus();
		thisForm.message.select();           
	}

	return false;	
}

