/* Author: 
	Richard R. Zellner
*/

$j = jQuery.noConflict();


// removes border from second to last menu item
$j('#mainMenu li:last').prev().addClass('noBorder');

// remove footer widget title
$j('.footerWidgetTitle').remove();


// Add Span to Twitter List Items
var content = null;

$j('.twitter-item').each( function(i){
	content = $j(this).html();
	$j(this).html('<span>' + content + '</span>');

});

// Replace [...] From Bottom of Sidebar RSS Widget Text
$j('#sidebar .widget_rss ul li').each( function(i) {
	var artLink = $j(this).children('a:last').attr('href');
	$j(this).children('a').remove();
	$j(this).children('.rssSummary').each( function(i){
		var oldText = $j(this).text();
		var newText = oldText.substring(0, oldText.length - 4);
		newText = newText + ' <a href="' + artLink +'" class="readMore">Read More...</a>';
		$j(this).html(newText);
	});
});


// Remove [...] From Bottom of RSS Widget Text
$j('.widget_rss ul li .rssSummary').each( function(i) {
	var oldText = $j(this).html();
	var newText = oldText.substring(0, oldText.length - 4);
	newText = newText + '.. ';
	$j(this).html(newText);
});

// Remove Link From Content Widget Titles
$j('#content .widget_rss .widgetTitle').each( function(i){
	var theTitle = $j(this).children('a:last').html();
	$j(this).html(theTitle);
});

// Replace Content Area RSS Feed List With Paragraphs
var rssContent = $j('#content .widget_rss ul').html()
$j('#content .widget_rss ul').each( function(i){
	$j(this).replaceWith(rssContent); // remove ul tag
});

$j('#content .widget_rss li').each( function(i){
	var rssContent = $j(this).html();
	$j(this).replaceWith('<section>' + rssContent + '</section>'); // replace li tag with section tag
});

$j('#content .widget_rss .rssSummary').each( function(i){
	var rssContent  = $j(this).html();
	$j(this).replaceWith('<p>' + rssContent + '</p>'); // replace .rssSummary div with p tag
});


// Add Span to All Content List Items
$j('#content ul li').each( function(i){
	var theContent = $j(this).text();
	$j(this).html('<span>' + theContent + '</span>');
});


// Make all twitter and rss links open in new window
$j('.widget_twitter a, .widget_rss a').each( function(i){
	$j(this).attr('target','_blank');											 
});
