
// 'stacks' is the Stacks global object.
// All of the other Stacks related Javascript will 
// be attatched to it.
var stacks = {};


// this call to jQuery gives us access to the globaal
// jQuery object. 
// 'noConflict' removes the '$' variable.
// 'true' removes the 'jQuery' variable.
// removing these globals reduces conflicts with other 
// jQuery versions that might be running on this page.
stacks.jQuery = jQuery.noConflict(true);

// Javascript for stacks_in_19_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_19_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_19_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

//-- InfoBar Stack v1.0.6 by Joe Workman --//
/* Activebar2 is free software http://www.westhoffswelt.de */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(d($){$.7.4=d(a){p a=$.7.1b({},$.7.4.G,a);i($.7.4.8==q){$.7.4.8=H(a)}I($.7.4.8,a);$.7.4.y();$(\'.r\',$.7.4.8).1c();$(m).1d(d(){$(\'.r\',$.7.4.8).s(m)});$.7.4.8.J(\'z\');i(a.n!=q){$.7.4.8.z(d(){j.1e.1f=a.n})}$.7.4.8.9(\'e\',\'-\'+$.7.4.8.k()+\'o\');$.7.4.K()};$.7.4.G={\'l\':\'1g\',\'L\':\'#1h\',\'M\':\'1i\',\'N\':\'1j 1k 1l,1m,1n-1o\',\'O\':\'1p\',\'A\':\'1q\',\'t\':\'P/4-1r.Q\',\'R\':\'P/4-1s.Q\',\'n\':q};$.7.4.g=0;$.7.4.8=q;$.7.4.K=d(){i($.7.4.g>1){B}$.7.4.g=2;$.7.4.8.9(\'C\',\'1t\');p a=$.7.4.8.k();$.7.4.8.S({\'e\':\'+=\'+a+\'o\'},a*T,\'U\',d(){$.7.4.g=3})};$.7.4.y=d(){i($.7.4.g<2){B}$.7.4.g=1;p a=$.7.4.8.k();$.7.4.8.S({\'e\':\'-=\'+a+\'o\'},a*T,\'U\',d(){$.7.4.8.9(\'C\',\'V\');$.7.4.1u=1v})};d H(b){p c=$(\'<f></f>\').u(\'1w\',\'4-8\');c.9({\'C\':\'V\',\'W\':\'1x\',\'1y\':\'1z\',\'e\':\'X\',\'v\':\'X\',\'1A\':\'1B\'});$(j).1C(\'Y\',d(){c.w($(m).w())});$(j).1D(\'Y\');i($.D.1E&&($.D.Z.10(0,1)==\'5\'||$.D.Z.10(0,1)==\'6\')){c.9(\'W\',\'1F\');$(j).1G(d(){c.1H(11,11);i($.7.4.g==3){c.9(\'e\',$(j).12()+\'o\')}1I{c.9(\'e\',($(j).12()-c.k())+\'o\')}})}c.s($(\'<f></f>\').u(\'E\',\'t\').9({\'13\':\'v\',\'w\':\'x\',\'k\':\'x\',\'F\':\'14 h h h\'}));c.s($(\'<f></f>\').u(\'E\',\'15\').9({\'13\':\'1J\',\'F\':\'14 h h h\',\'w\':\'x\',\'k\':\'x\'}).z(d(a){$.7.4.y();a.1K()}));c.s($(\'<f></f>\').u(\'E\',\'r\').9({\'F\':\'1L 16 h 16\'}));$(\'1M\').1N(c);B c};d I(a,b){a.9({\'l\':b.l,\'1O\':\'1P 1Q \'+b.L});a.J(\'1R 1S\');a.1T(d(){$(m).9(\'17\',b.M)},d(){$(m).9(\'17\',b.l)});$(\'.t\',a).9(\'l\',\'18 n( \\\'\'+b.t+\'\\\' ) e v 19-1a\');$(\'.15\',a).9(\'l\',\'18 n( \\\'\'+b.R+\'\\\' ) e v 19-1a\');$(\'.r\',a).9({\'1U\':b.O,\'1V\':b.N,\'A\':b.A})}})(1W);',62,121,'||||activebar|||fn|container|css||||function|top|div|state|4px|if|window|height|background|this|url|px|var|null|content|append|icon|attr|left|width|16px|hide|click|fontSize|return|display|browser|class|margin|defaults|initializeActivebar|setOptionsOnContainer|unbind|show|border|highlight|font|fontColor|images|png|button|animate|20|linear|none|position|0px|resize|version|substring|true|scrollTop|float|6px|close|28px|backgroundColor|transparent|no|repeat|extend|empty|each|location|href|InfoBackground|c8c8c8|Highlight|Bitstream|Vera|Sans|verdana|sans|serif|InfoText|12px|information|closebtn|block|visible|false|id|fixed|zIndex|9999|cursor|pointer|bind|trigger|msie|absolute|scroll|stop|else|right|stopPropagation|8px|body|prepend|borderBottom|1px|solid|mouseenter|mouseleave|hover|color|fontFamily|jQuery'.split('|'),0,{}))

$(document).ready(function() {
    $('#infobar_stacks_in_19_page0').activebar({  button:'index_files/infobar-close.png',
                                    icon:'index_files/infobar-close.png',
                                    url:null,
                                    background:'#CC0000',
                                    highlight:'#E50000',
                                    font:'sans-serif, verdana',
                                    fontColor:'#FFFFFF',
                                    fontSize:'10pt'
    });
});
//-- End InfoBar Stack --//

	return stack;
})(stacks.stacks_in_19_page0);


// Javascript for stacks_in_21_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_21_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_21_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
$(document).ready(function(){
	$('#fadeInStackstacks_in_21_page0').fadeIn(2000);
});
	return stack;
})(stacks.stacks_in_21_page0);


// Javascript for stacks_in_33_page0
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_33_page0 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_33_page0 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

//-- RSS Stream Stack v1.5.2 by Joe Workman --//
/* liScroll v1.0.2.1 (22 April 2011) - http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html */
jQuery.fn.liScroll = function(settings) {
		settings = $.extend({travelocity: 0.07}, settings);		
		return this.each(function(){
				var $strip = jQuery(this);
				$strip.addClass("newsticker")
				var stripWidth = 100;
				$strip.find("li").each(function(i){
					stripWidth += jQuery(this, i).outerWidth(true); // thanks to Michael Haszprunar and Fabien Volpi
				});				
				var $mask = $strip.wrap("<div class='mask'></div>");
				var $tickercontainer = $strip.parent().wrap("<div class='tickercontainer'></div>");								
				var containerWidth = $strip.parent().parent().width();	//a.k.a. 'mask' width 	
				$strip.width(stripWidth);			
				var totalTravel = stripWidth+containerWidth;
				var defTiming = totalTravel/settings.travelocity;	// thanks to Scott Waye		
				function scrollnews(spazio, tempo){
					$strip.animate({left: '-='+ spazio}, tempo, "linear", function(){$strip.css("left", containerWidth); scrollnews(totalTravel, defTiming);});
				}
				scrollnews(totalTravel, defTiming);				
				$strip.hover(function(){
					jQuery(this).stop();
					if ($().tipTip) { $(".tiptip").tipTip(); } //JW - Added this line to integrate with TipTip
				},function(){
					var offset = jQuery(this).offset();
					var residualSpace = offset.left + stripWidth;
					var residualTime = residualSpace/settings.travelocity;
					scrollnews(residualSpace, residualTime);
				});			
		});	
};
//---------------------------
// Start Common RSS Code
//---------------------------
formatString = function(str) {
	str = str.replace(/<[^>]+>/ig,'');
	str=' '+str;
	return $.trim(str);
}

enrichString = function(str) {
	str = str.replace(/((ftp|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>');
	str = str.replace(/([^\w])\@([\w\-]+)/gm,'$1@<a href="http://twitter.com/$2" target="_blank">$2</a>');
	str = str.replace(/([^\w])\#([\w\-]+)/gm,'$1<a href="http://twitter.com/search?q=%23$2" target="_blank">#$2</a>');
	return $.trim(str);
}

parse_date = function(str) {
    if (str.match(/^\d+\-\d+\-\d+T/)) {
        str = str.replace(/T.+$/,'');
    }
	var d = new Date(str);
	var m = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];
	if (d.getUTCDate()) {
		return d.getUTCDate() + ' ' + m[d.getUTCMonth()] + ' ' + d.getFullYear();
    }
    return str;
};

find_link = function(obj) {
    var default_string = '#';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.origLink == 'string') {
        return obj.origLink;
    }
    else if ($.isArray(obj.link)) {
        var mylink = obj.link[0].href;
        $.each(obj.link,function(index, value){
            if (value.rel === 'alternate') {
                mylink = value.href;
            }
		})
        return mylink;
    }
    else if (typeof obj.link == 'object') {
        return obj.link.href;
    }
    else if (typeof obj.link == 'string') {
        return obj.link;
    }
    else if (typeof obj.enclosure == 'object' && typeof obj.enclosure.url == 'string') {
        return obj.enclosure.url;
    }
    return default_string;
};

find_title = function(obj) {
    var default_string = 'No Items in RSS Feed';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.title.content == 'string') {
        return formatString(obj.title.content);
    }
    else if (typeof obj.title == 'string') {
        return formatString(obj.title);
    }
    return default_string;
};

find_date = function(obj) {
    var default_string = 'Date Unknown';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.pubDate == 'string') {
		return parse_date(obj.pubDate);
    }
    else if (typeof obj.date == 'string') {
		return parse_date(obj.date);
    }
    else if (typeof obj.published == 'string') {
		return parse_date(obj.published);
    }
    else if (typeof obj.updated == 'string') {
		return parse_date(obj.updated);
    }
    return default_string;
};

find_descr = function(obj) {
    var default_string = 'RSS Feed Invalid. No Description Found.';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.description == 'string') {
		return formatString(obj.description);
    }
    else if (typeof obj.encoded == 'string') {
		return formatString(obj.encoded);
    }
    else if (typeof obj.content == 'object' && typeof obj.content.content == 'string') {
		return formatString(obj.content.content);
    }
    return default_string;
};

find_author = function(obj) {
    var default_string = 'Unknown Author';
    if (obj == null || obj == undefined) {
        return default_string;
    }	
    else if (typeof obj.creator == 'string') {
		return obj.creator;
    }
    else if ($.isArray(obj.author)) {
        return obj.author[0];
    }
    else if (typeof obj.author == 'object' && typeof obj.author.email == 'string') {
		return obj.author.email;
    }
    else if (typeof obj.author == 'string') {
		return obj.author;
    }
    return default_string;
};

$(document).ready(function() {
	/* Forming the query: */
	var feed = "feed://www.schwollen.de/aktuelles_files/feed.xml";
	feed = feed.replace(/feed:\/\//,'http://'); // Replace feed:// with http://
	var query = 'select * from feed where url="' + feed + '" LIMIT 7';

	/* Forming the URL to YQL: */
	var url = "http://query.yahooapis.com/v1/public/yql?q="+encodeURIComponent(query)+"&format=json&callback=?";

	$.getJSON(url,function(data){
		if (data.query == null || data.query == undefined || data.query.results == null || data.query.results == undefined) {
			// Invalid or Empty RSS Feed - Add Blank/Default Entries
			add_feed_item();
	 	}
	 	else if ($.isArray(data.query.results.item || data.query.results.entry) ) {  //item exists in RSS and entry in ATOM feeds
			$.each(data.query.results.item || data.query.results.entry,function(){
	       		//Normal RSS Feed
	       		add_feed_item(this);
			})
		}
		else {
		    // RSS Feed with only one item in it
			add_feed_item(data.query.results.item || data.query.results.entry || null);
		}
		post_process_feed(this);
	});
});
//---------------------------
// End Common RSS Code
//---------------------------

function add_feed_item(obj) {
    var maxLength = 150;
	$('#rss-stream-list-stacks_in_33_page0').append('<li><span class="tickerdate">' + find_date(obj) + 
		'</span><a class="tiptip" title="'+ find_date(obj) +  
		' - ' + find_descr(obj).substring(0, maxLength) + 
		'" href="' + find_link(obj) + 
		'" target="_blank">' + find_title(obj) + '</a></li>'
	);
	return;    	        
};
function post_process_feed(obj) {
	$('#rss-stream-list-stacks_in_33_page0').liScroll({travelocity: 0.05});
	return;    	        
};
//-- End RSS Stream Stack --//


	return stack;
})(stacks.stacks_in_33_page0);



