(function($){
	$.VideoIndex = {
		intervalo : 0,

		indice : 0,

		noticias : {textos:[],ids:[]},

		__constructor : function(){
			var me = this;
			me.initConfig();

			// targets (bind em elementos passando o evento)

		},

		trocarVideo : function(e){
			var me = $.VideoIndex;
			var i = me.indice % me.noticias.textos.length;
			var texto = me.noticias.textos[i];
			var link = 'noticias-det?noticia='+me.noticias.ids[i];
			$('.noticias-noticia').text(texto);
			$('.noticias-noticia-link').attr('href',link);
			me.indice++;
		},

		criarLinks : function(){
			var me = this;
			var html = "";
			$('.video-index').each(function(i, ele){
				var name = ele.id.replace('video-','');
				html += '<a'+(i==0?' class="first ativo"':'')+' href="javascript:;" name="'+name+'">'+(i<10?'0'+(i+1):(i+1))+'</a>';
			});
			$('.videos-botoes').html(html);
			$('.videos-botoes a').click(function(e){
				if($('.videos-botoes a.ativo').attr('name') != $(this).attr('name')){
					$('.video-index').hide();
					$('.videos-botoes a').removeClass('ativo');
					$('#video-'+$(this).attr('name')).show();
					$(this).addClass('ativo');
				}
			});
		},

		initConfig: function() {
			var me = this;
			$('.video-index').eq(0).show();
			me.criarLinks();
		}

	}
})(jQuery);

$(function(){
	$.VideoIndex.__constructor();
})