window.addEvent('load', function(){
	new Bubbles($$('#tv-module .thumbnail'), $$('#tv-module a.button'), {distance: 10, bubblePaddingBottom:9});
}); 
window.addEvent('domready', function(event) {
	//Posts
	/*if($('mas-comentados'))
		$('mas-comentados').load(Constants.pathDomain+"blog/masComentados?limit=8");
	if($('mas-recientes'))
		$('mas-recientes').load(Constants.pathDomain+"blog/masRecientes?limit=8");*/
	if($('mas-comentados'))
		$('mas-comentados').load(Constants.pathDomain+"blog/getData?data=top_post&limit=8");
	if($('mas-recientes'))
		$('mas-recientes').load(Constants.pathDomain+"blog/getData?data=posts_recentes&limit=8");
	//Los mas vistos
	if($('masvistos'))
		$('masvistos').load(Constants.pathDomain+"leafs/views");
	var nS5 = new noobSlide({
		mode: 'vertical',
		box: $('featuredModule'),
		size: 260,
		interval: 7000,
		autoPlay:true,
		items: $$('#featuredModule div'),
		addButtons: {
			previous: $('prev'),
			next: $('next')
		}
	});
	if($('banner-collapsed'))
	$('banner-collapsed').addEvent('mouseover', function(e){
			$('banner-expanded').setStyle('z-index','9999');
			$('banner-expanded').morph({
				'right' : '0',
				'opacity' : 1
			});
		}
	);
	if($('banner-expanded'))
	$('banner-expanded').addEvent('mouseout', function(e){
		$('banner-expanded').setStyle('z-index','-9999');
		$('banner-expanded').setStyle('right',(-1)*$('banner-expanded').getSize().x+'px');
		$('banner-expanded').setStyle('opacity',0);
		}
	);
	
	if($('tv-module')){
		
		/**(function(){
			new Bubbles($$('#tv-module .thumbnail'), $$('#tv-module a.button'), {distance: 10, bubblePaddingBottom:9});
		}).delay(3000);*/
		$f("player", {src: "/embebed/flowplayer-3.0.7.swf", wmode: 'transparent'} ,{
			clip: {
				scaling:'fit',
				bgcolor: '#000000',
				// use baseUrl so we can play with shorter file names
				baseUrl: 'http://blip.tv/file/get',

				// use first frame of the clip as a splash screen
				autoPlay: false,
				autoBuffering: false
			}
			
		});

		// get all links that are inside div#clips
		$('firstImage').addEvent('click', function(e){
			$f().play(this.getParent().getAttribute("href", 2));
		});
		$('sndImage').addEvent('click', function(e){
			$f().play(this.getParent().getAttribute("href", 2));
		});
		
		$$('a.button').each(function(btn){
				btn.addEvent('click', function(e){
						e.stop();
						$f().play(btn.getAttribute("href", 2));
					});
			});
	}
		
});
