function cleanTextLink(text_link){
 	text_link = text_link.toLowerCase();
  	regex = '([^a-zA-Z0-9\-])+';
  	var re = new RegExp(regex, "g");
  	text_link =  text_link.replace(re, '-');

  	regex = '-(-)+';
  	var re = new RegExp(regex, "g");
  	text_link =  text_link.replace(re, '-');

  	regex = '-(-)+';
  	var re = new RegExp(regex, "g");
  	text_link =  text_link.replace(re, '-');

  	regex = '^(-)+';
  	var re = new RegExp(regex, "g");
  	text_link =  text_link.replace(re, '');

  	regex = '(-)+$';
  	var re = new RegExp(regex, "g");
  	text_link =  text_link.replace(re, '');

  	return text_link;
 }

function updateSpecialties()
{
	var specialties = document.getElementById('HomeSearchSpecialty');
	specialties.disabled = true;
	var category = document.getElementById('HomeSearchCategory');
	while (specialties.hasChildNodes())
		specialties.removeChild(specialties.lastChild);
	var _specialties = _subcategories_list[category.selectedIndex];
	var option = document.createElement('OPTION');
	option.appendChild(document.createTextNode('Select a Specialty'));
	specialties.appendChild(option);
	option = document.createElement('OPTION');
	option.appendChild(document.createTextNode('-------------------------'));
	specialties.appendChild(option);
	var pattern = /([^a-zA-Z0-9\-])+/;
	pattern = /[^a-z\d]+/ig;
	for (var i = 0; i < _specialties.length; i++) {
		option = document.createElement('OPTION');
		option.value = cleanTextLink(_specialties[i].name);
		option.appendChild(document.createTextNode(_specialties[i].name));

		if(_subcategory_selected != '')
		{
			compare = _specialties[i].name;
			compare_current = compare.replace(pattern,"");
			compare_selected = _subcategory_selected;
			compare_selected = compare_selected.replace(pattern,"");
			if(compare_selected.toLowerCase() == compare_current.toLowerCase())
				option.selected = true;
		}
		specialties.appendChild(option);
	}
	specialties.disabled = false;
}

function validateEnter(objeto)
{
	var evento_key = (window.Event)?objeto.which:objeto.keyCode;		
	if (evento_key == 13) doSearchPharmacy();	
	return;
}