$(document).ready(function() {
	//adiciona o efeito fancyBox
	$("a.gallery_image").fancybox({
		'transitionIn':		'elastic',
		'transitionOut':	'elastic',
		'titlePosition':	'over',
		'titleFormat':		function(title, currentArray, currentIndex, currentOpts) {
			var href	= this.href;
            
			var html	= '';
			html		+= '<span style="float:left; margin-right:10px; line-height: 18px;">(' + (currentIndex + 1) + '/' + currentArray.length + (title.length ? ')  ' + title : '') + '</span>';
			
			if( href ) {
				html	+= '<span style="color:#fff;; line-height: 18px;">(<a href="'+href+'" target="_blank" title="Abrir imagem original" style="color: #fff;">ver&nbsp;original</a>)</span>';
			}
			
			return '<span id="fancybox-title-over">' + html + '</span>';
		}
	});
	
	//tooltip
	$('*:not(input, select, textarea, .gallery_image, #map_canvas *)').tipsy({gravity: $.fn.tipsy.autoNS, delayIn: 0, delayOut: 0, fade: true, live:true});
	$('input, select').tipsy({trigger: 'focus', gravity: $.fn.tipsy.autoWE, fade: true});
	$('textarea').tipsy({trigger: 'focus', gravity: $.fn.tipsy.autoNS, fade: true});
	
	//ao focar um campo, mudar cor da borda
//	$("input, select, textarea").unbind("focus");
	$("input, select, textarea").bind("focus", function() {
		//remove classe focus dos outros elementos
		$("input, select, textarea").removeClass( "focus" );
		
		//adiciona classe focus apenas para o elemento atual
		$(this).addClass( "focus" );
	});
	
	//ao tirar o foco um campo, mudar cor da borda
//	$("input, select, textarea").unbind("blur");
	$("input, select, textarea").bind("blur", function() {
		$(this).removeClass("focus");
	});
	
	/*
	//esconder depoimento
	$("#content .left #hide_depoimento").unbind("click");
	$("#content .left #hide_depoimento").bind("click", function() {
		$("#content .left #depoimento").hide("fast");
	});
	*/
	
	//deixa o tamanho do conteudo da esquerda igual ao da direita
//	var alturaLeft	= $("#content .left").css("height");
//	var alturaRight	= $("#content .right").css("height");
//	if( alturaRight>alturaLeft ) {
//		$("#content .left").css("height", alturaRight );
//		$("#content .right").css("height", alturaRight );
//	} else {
//		$("#content .left").css("height", alturaLeft );
//		$("#content .right").css("height", alturaLeft );
//	}
	
	//
//	$("#content2 .left:has(#bloco_banner_big)").css("margin", 0);
});
