/*
	Animacao para os submenus
	Apoios: jquery 1.4.1
*/
	$.easing.bouncy = function (x, t, b, c, d) {
		var s = 1.70158;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	}
	// criando efeito tooltip
	$.tools.tooltip.addEffect("bouncy",
		// iniciando animacao
		function(done) {
			this.getTip().animate({top: '+=15'}, 500, 'bouncy', done).show();
		},
		// encerrando animacao
		function(done) {
			this.getTip().animate({top: '-=15'}, 500, 'bouncy', function()  {
				$(this).hide();
				done.call();
			});
		});
	// definindo onde irei mostrar e de onde herdar
	$("#menuTopo a[title]").tooltip({effect: 'bouncy'});
	
/*
	Buscador de informacoes do Twitter
	Apoios: jquery 1.4.1
*
	$('#twitterSearch').liveTwitter('mfrural', {limit: 4, rate: 5000});
	$('#searchLinks a').each(function(){
		var query = $(this).text();
		$(this).click(function(){
			$('#twitterSearch').liveTwitter(query);
			$('#searchTerm').text(query);
			return false;
		});
	});*/
	
/*
	Buscador de imagens do flicker
	Apoios: jquery 1.4.1 - id: '37304598@N02'
*/
	$('#flickrphotos').jflickrfeed({
		limit: 3,
		qstrings: {
			id: '58724371@N07'
		},
		useTemplate: false,
		itemCallback: function(item){
			$(this).append("<li><img src='" + item.image_m + "' alt=''/></li>");
		}
	});
	
/*
	Buscador de videos do youtube
	Apoios: jquery 1.4.1
*/
	$(function(){
		$('a.youtubin').youtubin({ 
			swfWidth : 290, 
			swfHeight : 180 
		});
	});
	
/*
	Envio de informacoes para cadastro de e-mail
	Apoios: jquery 1.4.1
*/
	// identtificando o objeto
	$('#mailling').keypress(function(e){
		// caso o ENTER seja precionado
		if(e.which == 13){
			// recebendo dados do input
			var email = $('#mailling').val();
				// validando se o e-mail e valido
				if (email.search(/\b[\w]+@[\w]+\.[\w]+/) != -1) {
					// enviando o para o CI e retorno o objeto retmailling
					$.post('http://www.deltag.com.br/ajax/mailling/',{email: email}, function(data){
						$('#retmailling').html(data);
					});
				} else {
					alert('Informe um e-mail válido');
				}
			// retornando falso para nao submeter a pagina
			return false;
		}
	});
/*
	scroll de patrocinadores do site
	Apoios: jquery 1.4.1
*/
// Initialize the plugin with no custom options
$(window).load(function() {
	$("div#makeMeScrollable").smoothDivScroll({
			autoScroll: "onstart" , 
			autoScrollDirection: "backandforth", 
			autoScrollStep: 1, 
			autoScrollInterval: 5,	
			startAtElementId: "startAtMe", 
			visibleHotSpots: "always"
		});
});
