//jQuery Extension - changeTeaser
(function($){
	$.fn.extend({
		changeTeaser: function(data,idx){
			return $(this).each(function() {
				$(this).find("#" + this.id + "_headline").text(data.content[idx].headline);
				$(this).find("#" + this.id + "_headline").css("color",data.content[idx].fg_color);
				
                $(this).css("background-image","url(" + data.content[idx].image + ")");
				
                $(this).find("a[id^=" + this.id + "_title]").removeClass("active");
				$(this).find("#" + this.id + "_title_" + idx).addClass("active");
				$(this).find("#" + this.id + "_link").attr("href",data.content[idx].link);
				if(!data.content[idx].teaser) {
					$(this).find("#" + this.id + "_teaser").text("");
					$(this).find("div[id^=" + this.id + "_Text]").hide();
					$(this).find("#" + this.id + "_TextBackground").hide();
					if (!jQuery.support.opacity) {
						$(this).find("#" + this.id + "_TextBackground").css("filter","progid:DXImageTransform.Microsoft.Alpha(opacity=0)");
					}
				} else {
					$(this).find("#" + this.id + "_teaser").text(data.content[idx].teaser);
					$(this).find("div[id^=" + this.id + "_Text]").show();
					if (!jQuery.support.opacity) {
						$(this).find("#" + this.id + "_TextBackground").css("filter","progid:DXImageTransform.Microsoft.Alpha(opacity=50)");
					}
					$(this).find("#" + this.id + "_TextBackground").css("background-color",data.content[idx].bg_color);
					$(this).find("#" + this.id + "_teaser").css("color",data.content[idx].fg_color);
				}
			});
		}
	});
})(jQuery);