// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

document.observe("dom:loaded", function() {

	/* popup label in the main search + people search */
	$$('#search label, #sort_form label').each(function(s){
		s.hide().next().observe('focus', function(){
			$(this).previous().show();
		}).observe('blur', function(){
			$(this).previous().hide();
		});
	});

	$('p').insert({after: '<select id="profession"><option value="0">Business Groups</option><option value="1">Dentists</option><option value="2">Doctors</option><option value="3">Solicitors</option><option value="4">Vets</option></select>'});
	$('profession').observe('change', function(){
		switch($('profession').value) {
			case '0': break;
			case '1': window.location.pathname = '/clients/business/professional-practices/dentists'; break;
			case '2': window.location.pathname = '/clients/business/professional-practices/doctors'; break;
			case '3': window.location.pathname = '/clients/business/professional-practices/solicitors'; break;
			case '4': window.location.pathname = '/clients/business/professional-practices/vets'; break;
			default: break;
		}
	});

});