$(document).ready(function(){

	$('.menu li').last().addClass('last');
	$('#custom_cf7-3, .page #wrapper #container, .single #wrapper #container').addClass('borderTop');
	$('<span>&nbsp;&nbsp;</span><a title="Conhe&ccedil;a Barcarena" href="?page_id=9">[+]</a>').appendTo('.lh');
	$('#text-4 .textwidget').prepend('<div id="menu-tools" class=""><ul></ul></div>');
	$('<li class="act"><a href="javascript:void(0);" class="mapa">Localiza&ccedil;&atilde;o</a></li>').appendTo('#menu-tools ul');
	$('<li><a href="javascript:void(0);" class="como-chegar">Como Chegar</a></li>').appendTo('#menu-tools ul');
	$('<li><a href="javascript:void(0);" class="balsa">Hor&aacute;rio da Balsa</a></li>').appendTo('#menu-tools ul');
	$('<li class="last"><a href="javascript:void(0);" class="tempo">Tempo</a></li>').appendTo('#menu-tools ul');
	
	$('#text-4 .textwidget ul li a').click(function(){
		var o = $(this).attr('class');
		$('#display-tools div').hide();
		$('div#'+o+'').show();
		$('#text-4 .textwidget ul li').removeClass('act');
		$(this).parent().addClass('act');
	});
	
	/* Slider */
	var i = $('.slider ul li').length;
	var w = 314;
	var t = i*w;
	var j = 1;
	
	$('.slider ul li:first').addClass('act');
	
	$('.slider').css('width',t);

	$('.next').click(function(){	
		if (j<i) {	
			$('.slider').animate({ left:'-='+w+''});
			j++;
			$('.prev').removeClass('disable');
			if (j==i){
				$(this).addClass('disable');	
			}	
		return j;
		}
	});
	
	$('.prev').click(function(){	
		if (j>1) {
			$('.slider').animate({ left:'+='+w+''});
			j--;
			$('.next').removeClass('disable');	
			if (j==1){
				$(this).addClass('disable');	
			}
		return j;
		} 
	});
	
	// Clear Inputs
	$('input:text').focus(function(){
		var mens = $(this).val();
		
		if ($(this).val() == mens) {
			$(this).attr('value','');
		}
		
		$(this).blur(function() {
			if ($(this).val() == '') {
				$(this).attr('value',mens);				
			}
		})
	});
	
	var inp = $('input:text').length;
	
	//var it = new Array();
	
	//for (f = 0; f < inp; f++){
		
	//	var it[f] = $('input:text').index(f).value();
		
	//	alert(it[f]);
	
	//}
	
	// Tooltip
	$('.tooltip').mouseover(function(){
		var offset = $(this).offset();
		var t = $(this).attr('title');
		$(this).attr('rel',t);
		$(this).attr('title','');
		$('body').append('<div class="ttip">'+t+'</div>');
		$('.ttip').css({
			left:offset.left-$('.ttip').width()/2+10,
			top:offset.top-41, 
			zindex: 999
		});
		$('.ttip').fadeIn(500);
	}).mouseout(function(){
		var r = $(this).attr('rel');
		$(this).attr('title',r);
		$(this).attr('rel','');
		$('.ttip').remove();		
	});
	
	// Bullets
	$('.acorden a').click(function(){
		$('.acorden p, .acorden div, .acorden ul').hide();
		$(this).parent().parent().children().show();	
		$(this).parent().parent().children().children().show();	
		$(this).parent().parent().children().children().children().show();	
		$(this).parent().parent().children().children().children().children().show();	
		$(this).parent().parent().children().children().children().children().children().show();	
	});
});
