
var dw = jQuery.noConflict();

var ply = new Array();

/**
 * BANNERS
 */

dw(document).ready(function(){
	var tr = dw('#banners1').find('dd').length;
	dw('#banners1').find('dd').hide();
	var i = -1;
	var tp = setInterval(function(){
		i++;
		dw('#banners1').find('dd').hide('slow');
		dw('#banners1').find('dd').eq(i).show('slow');
		if(i >= (tr - 1)){i = -1;}
	}, 5000);
});

dw(document).ready(function(){
	var tr = dw('#banners4').find('dd').length;
	dw('#banners4').find('dd').hide();
	var i = -1;
	var tp = setInterval(function(){
		i++;
		dw('#banners4').find('dd').hide('slow');
		dw('#banners4').find('dd').eq(i).show('slow');
		if(i >= (tr - 1)){i = -1;}
	}, 5000);
});

dw(document).ready(function(){
	var tr = dw('#banners5').find('dd').length;
	dw('#banners5').find('dd').hide();
	var i = -1;
	var tp = setInterval(function(){
		i++;
		dw('#banners5').find('dd').hide('slow');
		dw('#banners5').find('dd').eq(i).show('slow');
		if(i >= (tr - 1)){i = -1;}
	}, 5000);
});

/**
 *
 */
dw(document).ready(function(){
	dw('#slides1').find('.legenda').css('opacity', 0.8);
	dw('#slides1').find('.nav').css('opacity', 0.8);
	dw('#slides1').cycle(
		{
			fx		: 'fade',
			prev	: '.prev',
			next	: '.next',	
			pager	: '.pager',
			timeout : 5000,
			speed	: 1000
		}
	);
});	
//

dw(document).ready(function(){
	dw('#fpesquisa').submit(function(e){
		e.preventDefault();
		var v = dw(this).find('#ftxt').val();
		window.location = '/noticias/busca/texto/' + v;
	});
});

//
/**
 * ENQUETES
 */
dw(document).ready(function(){
	dw('#enquete-content').load('enquetes');
	dw('#fenquete').live('submit', function(e){
		e.preventDefault();
		dw('#fenquete').find('input[name="voto"]:checked').each(function(){
			voto_id = dw(this).val();
		});
		dw.post('enquetes/votar', { voto : voto_id }, function(data){
			dw('#enquete-content').html(data);
		});
	});
	dw('#eqresultado').live('click', function(e){
		e.preventDefault();
		dw('#enquete-content').load('enquetes/votar');	
	});
	dw('#eqresultadov').live('click', function(e){
		e.preventDefault();
		dw('#enquete-content').load('enquetes');	
	});
});
//
dw(document).ready(function(){
	dw('#aniversariantesCycle').find('a').css('opacity', 0.8);
	dw('#aniversariantesCycle dl').cycle({
		fx: 'fade',
		speed: 1000,
		timeout: 5000,
		prev:'.prev',
		next:'.next'
	});	
});


/***************************************************************************/
dw(document).ready(function(){
	dw('.galeria_aux').find('.foto').css('opacity', 0.6);
	dw('.galeria_aux').find('.foto').mouseover(function(){
		dw(this).css('opacity', 1.0);
	});
	dw('.galeria_aux').find('.foto').mouseout(function(){
		dw(this).css('opacity', 0.6);
	});
});

/***************************************************************************/
dw(document).ready(function(){
	dw('#comments_form').hide();
	dw('#comments_show').click(function(e){
		dw(this).hide();
		dw('#comments_form').show('slow');
	});
	
	dw('#flo').click(function(e){
		dw(this).hide('slow');
	});
});


/*****************************************************************************/


dw(document).ready(function(){
	//dw('#rollvideos_nav').prepend('<a href="javascript:;" class="parar">Parar</a>');
	dw('#rollvideos').cycle({
		fx: 'scrollLeft',
		speed: 'slow',
		timeout: 0,
		pager: '#videosnav'
	});
		
	dw('#rollvideos_nav').find('.parar').live('click', function(){
		dw('#rollvideos').cycle('pause');
		dw(this).replaceWith('<a href="javascript:;" class="rolar">Rolar</a>');
	});
	
	dw('#rollvideos_nav').find('.rolar').live('click', function(){
		dw('#rollvideos').cycle('resume');
		dw(this).replaceWith('<a href="javascript:;" class="parar">Parar</a>');
	});
	
	dw('#rollvideos').mouseover(function(){
		dw(this).cycle('pause');		
	});
	
	dw('#rollvideos').mouseout(function(){
		dw(this).cycle('resume');		
	});
	
});
