var products_drop_down_list = null;
var text_header = '';
Event.observe(window, 'load', function() {
	// professions.aspx => Select your profession:
	// professions/doctors.aspx => Select your professional role:
	// professions/doctors/hospital_doctors.aspx => Select a product/service group:
	// professions/doctors/hospital_doctors/personal_loans.aspx => Select a product or service:

	var loc = document.location.href.toLowerCase();
	var bum = loc.split('/content/');
	if(bum.length < 2) return;
	var slashes = bum[1].split('/');
	if(slashes.length > 0 && slashes[0] == 'about'){
		text_header = 'Find out more about Wesleyan:';
	}else{
		switch(slashes.length)
		{
		case 1:
			if(slashes[0] == 'news.aspx')
				text_header = 'Select a news type:';
			else
				text_header = 'Select your profession:';
			break;    
		case 2:
			if(slashes[0] == 'news')
				text_header = 'Select your profession:';
			else if(slashes[1] == 'teachers.aspx')
				text_header = 'Select a product/service group:';
			else
				text_header = 'Select your professional role:';
			break;
		case 3:
			if(slashes[1] == 'teachers')
				text_header = 'Select a product or service:';
			else
				text_header = 'Select a product/service group:';
		  break;
		case 4:
		  text_header = 'Select a product or service:';
		  break;
		default:
		  text_header = 'Select for more information:';
		}
	}	
	
	var dynamic_dd_options = new Array();
	if($('specific_content_banner_e')){
		theSpan = new Element('span');
		products_drop_down_header = '<label id="products_drop_down_header" for="products_include_links">' + text_header + '</label>';
		theSpan.innerHTML = products_drop_down_header;
		products_drop_down_list = new Element('select', { id: 'products_include_links'});
		products_drop_down_list.options.length = 0;
		products_drop_down_list.options[0] = new Option("Please choose");
		var products_include_links = $$('a.products_include');
		products_include_links.each(function(link) {
			products_drop_down_list.options[products_drop_down_list.options.length] = new Option(link.innerHTML.replace("&amp;","&"), link.href);
		});
		if(products_drop_down_list.options.length > 1){
			$('specific_content_banner_e').appendChild(theSpan);
			$('specific_content_banner_e').appendChild(products_drop_down_list);
			Event.observe('products_include_links', 'change', function(){if($('products_include_links').value == 'Please choose') return; window.location = $('products_include_links').value});
		}
	}
});