var $ = glow.dom.get;

topicsDefaultInit = function(){	
	if(glow.env.ie){$('#topics-hide').remove()}
	roundcorners(
		$('.cmWidget')
			.filter(function(){
				return!(
					/^(banner|topic-description)$/.test($(this).attr('id'))
					||$(this).parent().hasClass('cmWidget')
				)
			}),
		'6px'
	);
	$('#topic-description').get('.cornercanvas').remove();
	$('#topic-description').css('position','absolute');
	roundcorners($('#topic-description'), '6px bl br');
	roundcorners($('.cmWidget li.odd, #feedback div'),'3px');

	$('.cmWidget h3')
		.filter(function(){
			return!(
				/^(related|weather)$/.test($(this).parent().parent().attr('id'))
			)
		})
		.append('<img alt="" src="/topics/img/marker.gif" />');

	if(glow.env.ie == 7){$('.cmWidget h3 img').css('bottom','-4px')}
	if($('#topic-description')
			.addClass('blq-hide')
			.length > 0
		){
		$('#banner p').append('<span>&nbsp;Read more...</span>');
		showPanelListener = glow.events.addListener(
			'#banner p span',
			'click',
			cmWidget_showpanel
		)	
		
		if(glow.env.ie){
			$('#primary').css('margin-top', '10px');
			$('#primary #topic-description').css('margin-top','-10px')
		}
	}
	if(!glow.env.ie){$('#topics-hide').remove()}
}

function cmWidget_showpanel(){
	glow.events.removeListener(showPanelListener);
	$('#topic-description').append('<span class="close">CLOSE</span>');
	glow.events.addListener(
		'#topic-description span',
		'click',
		cmWidget_hidepanel
	);
	$('#topic-description')
		.removeClass('blq-hide')
		.addClass('cmWidget')
		.css('z-index','100')
		.css('position','absolute')
		.css('width',($('#primary').width() -10)+'px');
}

function cmWidget_hidepanel(){
	showPanelListener = glow.events.addListener(
		'#banner p span',
		'click',
		cmWidget_showpanel
	);
	$('#topic-description').addClass('blq-hide').removeClass('cmWidget');
	$('#topic-description span').remove();
}


if(glow.isSupported){glow.ready(topicsDefaultInit)}//FF1 gets past isSupported but is caught by glow.ready
else{
	var d = document.getElementById('#topics-hide');
	d.parentNode.removeChild(d);
}