jQuery(document).ready(function($){

	var widgetID = "public-sector-widget";
	var tabList;

	tabList = $('#secondary-content dl#' + widgetID);
	if ( tabList.length > 0 ) {
    		tabList.accordion( { collapsible: true, active: false });
	}

	tabList = $('#sidebar dl#' + widgetID);
	if ( tabList.length > 0 ) {
    		tabList.accordion( { collapsible: true, active: false });
	}

	tabList = $('#main-content dl#' + widgetID);
	if ( tabList.length > 0 ) {
		var newDiv  = $("<div>").attr("id", tabList.attr("id"));

		tabList.find('dd').each(function(i) {
			newDiv.append(
				$("<div>").append(
					$(this).clone().contents()
				).attr("id", $(this).attr("id"))
			 	.attr("class", $(this).attr("class"))
			);
		});

		var newUl = $("<ul>");
		tabList.find('dt').each(function(i) {
			newUl.append(
				$("<li>").append(
					$(this).clone().contents()
				)
			);
		});

		newDiv.append(newUl);
		$('#main-content dl#' + widgetID).replaceWith(newDiv);

		newDiv.tabs( {cookie: {expires: (1 / 12)} } );
	}

	// $('#' + widgetID).localScroll({'hash' : true});
});
