function enableCCElements(bCheck)
{
	bEnable = new Boolean()
			
	if (bCheck == 'true')
		bEnable = true;
	else
		bEnable = false;
				
	document.form.CardMonth.disabled  = bEnable;
	document.form.CardYear.disabled   = bEnable;	
}

function displayDescription(intPID)
{
	window.open('ProgramDescription.asp?pid=' + intPID,'Program_Description','width=800,height=600,scrollbars=yes,menubar=no,location=no,resizable=yes')
}

//Used for radius select box miles or kilometers
function setDistanceParams(iSelected)
{
	var d = this.document.form;
	var dist, units;
	var i;
	var bZipEntered = false;
		
	if (d.ZipCode.value.length == 5)
	{
		units = 'mi';
		d.Country.value = 'US';	
		bZipEntered = true;	
	}
	else if (d.ZipCode.value.length == 7)
	{
		units = 'km';
		d.Country.value = 'CA';	
		bZipEntered = true;	
	}
	
	if (bZipEntered)
	{	
		for (i=1; i<=5; i++)
		{		
			dist = i * 10;
			
			d.elements[1].options[i] = new Option(dist.toString() + ' ' + units);
			d.elements[1].options[i].value = dist.toString();
			
			if (iSelected == dist)
				d.elements[1].options[i].selected = true;		
		}	
	}	

}

//Ensure a meeting location has been selected on ZipEntry.asp
function verifyFranchise()
{
	var d = this.document;
	var i;
	var len = d.form.FranchiseNo.length;
	var bChecked = false;
	var bMatch = false;
	
	//This is the only way to find the match buttons in IE
	//not sure why	
	var allInputs = document.all.tags("INPUT");
	var inputLen = allInputs.length;
	
	//Match button find			
	for (var i = 0; i < inputLen; i++)
	{
		var elType = allInputs[i].type;
		var elName = allInputs[i].name;
			
		if (elName == "Match")
			bMatch = true;			
		
	}
	
	/*
	The elements length property is undefined (var len) if there is only
	one meeting location found in which case the loop will not work
	*/
	if (d.form.FranchiseNo.checked)
	{
		toggleVisibility('go',true);
		d.getElementById('go').focus();	
			
		if (bMatch)
		{
			toggleVisibility('nomatch',true);
			toggleVisibility('match',true);					
		}
	}
	
	else
	{	
		//for (i = 0; i <= len - 1; i++ )
		for (i = 0; i <= len; i++ )
		{
			bChecked = d.form.FranchiseNo[i].checked;
			
			if (bChecked)
			{
				toggleVisibility('go',true);
				d.getElementById('go').focus();	
				
				if (bMatch)
				{
					toggleVisibility('nomatch',true);
					toggleVisibility('match',true);					
				}
				break;
			}
			
		}
	}	

}

