/*
Name: Javascript Functions
Version: 1.0
Description: BJavascript Functions para o site
Author: Alex Koti
Author URI: http://alexkoti.com
 */


jQuery(document).ready(function($){
	
	/**
	 * RESET SEARCH INPUT
	 * remover o value 'busca' do campo de busca
	 */
	$('#ipt_search_term').focus(function(){
		var ipt = $(this).val();
		if( ipt == 'busca' ){$(this).val('');}
	}).blur(function(){
		var ipt = $(this).val();
		if( ipt == '' ){$(this).val('busca');}
	});
	
	
	/**
	 * LIGHTBOX
	 * aplicar lighbox no elementos
	 */
	var lcss = document.getElementById('site_css').href;
	var fim = lcss.lastIndexOf('/');
	var css = lcss.substring(0, fim + 1) + "/lightbox/";
	if($('.lightbox').length > 0 ){
		$('.lightbox').lightBox(
			{
			imageLoading:css + 'lightbox-ico-loading.gif',
			imageBtnClose:css + 'lightbox-btn-close.gif',
			imageBtnPrev:css + 'lightbox-btn-prev.gif',
			imageBtnNext:css + 'lightbox-btn-next.gif',
			txtImage:'Imagem',
			txtOf:'de',
			imageBlank:css + 'lightbox-blank.gif'
			}
		);
	}
	
	
	/**
	 * HIGHLIGHT MENU
	 * seleção do menu ao mouseover das imagens correspondentes na entrada de coleção
	 */
	// MENU
	$(".highlight a").hover(
		function (e) {
			var rel = $(this).attr('rel');
			$('#'+rel).addClass('mouseover');
		},
		function (e) {
			var rel = $(this).attr('rel');
			$('#'+rel).removeClass('mouseover');
		}
	);

	
});
