$(document).ready(function(){
 	// Add content, top & bottom to blocks + titleBlocks
	$("div.block, div.titleBlock").wrapInner("<div class='content'></div>").prepend("<div class='top'></div>").append("<div class='bottom'></div>");
	//
	$("input[type=text]").addClass('text');
	$("input[type=submit]").addClass('submit');
	$("input[type=button]").addClass('button');
	//
	$(".identifyLast").identifyLast();
	$(".identifyFirst").identifyFirst();
	//
	$(".tinymce").tinymce();
	//
	$("textarea.autogrow").autogrow();
	//
	$('.feedContainer:has(.feedurl)').each(function() {
		var _feedUrl = $('.feedurl',this).text();
		var _feedSize = $('.feedsize',this).text();
		var _useSnippets = $(this).hasClass('snippets')
		$(this).rssfeed(_feedUrl,{limit:_feedSize,header:false,snippet:_useSnippets,date:false});
	});
});

function zRssFeedFinished() {
	console.log("HeRE");
	$('.rssFeed img[src*=feeds.feedburner.com]').hide();
}

//
function _content_home_init() {
	$(document).ready(function() {
		$('.rotateContainer div').innerfade({ animationtype: 'fade', speed: 'slow', timeout: 7000, type: 'random', containerheight: '180px' });
	});	
}

function trace(str) {
	console.log(str);
}

jQuery.fn.identifyLast = function () {
	return this.each(function() {
		$this = $(this);
		if ($this.hasClass('identifyLast')) {
			$this.parent().find('.identifyLast:last').addClass('last');
			$this.parent().find('.identifyLast').removeClass('identifyLast');
		}
	})
}
//
jQuery.fn.identifyFirst = function () {
	return this.each(function() {
		$this = $(this);
		if ($this.hasClass('identifyFirst')) {
			$this.parent().find('.identifyFirst:first').addClass('first');
			$this.parent().find('.identifyFirst').removeClass('identifFirst');
		}
	})
}