var HELPER = {
	
	//------------------------------------------------------------------------
	
	loadFlashMovie:function( filename, placeholder, width, height, flashvars, params, attributes ) {
		filename = filename + '?fs=1&amp;hl=de_DE&amp;rel=0&color1=0x000000&color2=0x333333&border=0';
		flashvars = flashvars || {
			
		};
		params = params || {
			wmode:'transparent',
			bgcolor:'#000000',
			allowFullScreen:'true',
			allowscriptaccess:'always'
		};
		attributes = attributes || {
			
		};
		$(placeholder).style.height = height + 'px';
		swfobject.embedSWF(filename, placeholder, width, height, "9.0.0","expressInstall.swf", flashvars, params, attributes);
	},
	
	//------------------------------------------------------------------------
	
	fix_extensionBugs:function() {
		// comments
		try { tx_comments_pi1_setUserData(); }
		catch (e) { tx_comments_pi1_setUserData = function(){} }
	},
	
	//------------------------------------------------------------------------
	
	animateRSSFeed:function() {
		var timeOut = 5000; // 3 seconds;
		var animationTime = 500; // 0.5 seconds
		var feedHeight = 40; // in pixel
		
		(function loop(){
   			setTimeout(function(){
				// need to be checked because function would be called on every page instead of homepage only
				if(!$('rssFeed')) return false;
				var fx = new Fx.Morph($('rssFeedWrap'),{duration:animationTime, onComplete:function() {
					// Coping latest news to the end
					var node = $('rssFeedWrap').getElementsByTagName('div')[0];
					var clone= node.cloneNode(true);
					node.parentNode.appendChild(clone);
					node.parentNode.removeChild(node);
					// Resetting the top because first node will be deleted
					$('rssFeedWrap').style.top = '0px';
					delete node;
				}});
				fx.start({top:$('rssFeedWrap').offsetTop-feedHeight});
    	  		loop();
  			}, timeOut);
		})();
	}
	
	//------------------------------------------------------------------------
	
	
};

HELPER.fix_extensionBugs();

// animationRSSFeed function is called directly in TYPO3 because of AJAX requests
/*
window.addEvent('load',function(){
	if($('rssFeed')) HELPER.animateRSSFeed();
});
*/


