function divSwap(obj, new_style, type) 
{
	if (type == "class")
		obj.className = new_style;
	else if (type == "id")
		obj.id = new_style;
}

function resetDates() 
{
	document.adv_search.start_month.selectedIndex = 0;
	document.adv_search.end_month.selectedIndex = 0;
	document.adv_search.start_year.selectedIndex = 0;
	document.adv_search.end_year.selectedIndex = 0;
}

function resetTimeFrame() 
{
	document.adv_search.time_frame.selectedIndex = 0;
}

function checkDates() 
{
	form = document.adv_search;

	if (form.time_frame.selectedIndex == 0 && form.start_month.selectedIndex == 0
		&& form.start_year.selectedIndex == 0 && form.end_month.selectedIndex == 0
		&& form.end_year.selectedIndex == 0) {
		
		return true;
	}
	if (form.dir_services.checked || form.dir_properties.checked || form.dir_facilities.checked
		|| form.dir_pubentities.checked || form.dir_parties.checked || form.dir_glossary.checked
		|| form.gov_gsc.checked || form.gov_committee.checked || form.gov_contacts.checked) {
		
		var not_searchable = '';
		var first = true;
		
		if (form.dir_services.checked) {
			if (first) {
				not_searchable = not_searchable + 'SERVICES';
				first = false;
			} else {
				not_searchable = not_searchable +  ', SERVICES';
			}
		}
		
		if (form.dir_properties.checked) {
			if (first) {
				not_searchable = not_searchable + 'PROPERTIES';
				first = false;
			} else {
				not_searchable = not_searchable +  ', PROPERTIES';
			}
		}
		
		if (form.dir_facilities.checked) {
			if (first) {
				not_searchable = not_searchable + 'FACILITIES';
				first = false;
			} else {
				not_searchable = not_searchable +  ', FACILITIES';
			}
		}
		
		if (form.dir_pubentities.checked) {
			if (first) {
				not_searchable = not_searchable + 'PUBLIC ENTITIES';
				first = false;
			} else {
				not_searchable = not_searchable +  ', PUBLIC ENTITIES';
			}
		}
		
		if (form.dir_parties.checked) {
			if (first) {
				not_searchable = not_searchable + 'POLITICAL PARTIES';
				first = false;
			} else {
				not_searchable = not_searchable +  ', POLITICAL PARTIES';
			}
		}
		
		if (form.dir_glossary.checked) {
			if (first) {
				not_searchable = not_searchable + 'GLOSSARY';
				first = false;
			} else {
				not_searchable = not_searchable +  ', GLOSSARY';
			}
		}
		
		if (form.gov_gsc.checked) {
			if (first) {
				not_searchable = not_searchable + 'Government Body';
				first = false;
			} else {
				not_searchable = not_searchable +  ', Government Body';
			}
		}
		
		if (form.gov_committee.checked) {
			if (first) {
				not_searchable = not_searchable + 'Committees';
				first = false;
			} else {
				not_searchable = not_searchable +  ', Committees';
			}
		}
		
		if (form.gov_contacts.checked) {
			if (first) {
				not_searchable = not_searchable + 'Contacts';
				first = false;
			} else {
				not_searchable = not_searchable +  ', Contacts';
			}
		}
		
		var section = 'The following section(s) will not be filtered by date: ##. Do you want to continue?';
		
		return confirm(section.replace('##', not_searchable));
	}
	return true;
}