/* MENU DROP DOWN */
	var timeout    = 500;
	var closetimer = 0;
	var ddmenuitem = 0;
	var _this;
	
	function jsddm_open()
	{  
		jsddm_canceltimer();
		jsddm_close();
		if (_this != 'undefined') $(_this).removeClass('hover');
		ddmenuitem = $(this).find('ul').css('visibility', 'visible');
		_this = $(this);
		$(_this).addClass('hover');
	   }
	
	function jsddm_close()
	{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
		if (_this != 'undefined') $(_this).removeClass('hover');
	}
	
	function jsddm_timer()
	{  closetimer = window.setTimeout(jsddm_close, timeout);}
	
	function jsddm_canceltimer()
	{  if(closetimer)
	   {  window.clearTimeout(closetimer);
	      closetimer = null;}}
	
	$(document).ready(function()
	{  $('#jsddm > li').bind('mouseover', jsddm_open)
	   $('#jsddm > li').bind('mouseout',  jsddm_timer)});
	
	document.onclick = jsddm_close;
/* MENU DROP DOWN */


$(document).ready(function() {
	
/* DESABILITAR CLIQUE QUANDO MENU TEM FILHOS */
	$('a, #menu').click(function() {
		if ($(this).next('ul').find('li').get(0)) {
			return false;
		} else {
			return true;
		}
	});
/* DESABILITAR CLIQUE QUANDO MENU TEM FILHOS */

	
/* MUDAR BUSCA ON FOCUS */
	$("input[@name='q']").focus(function() {
		$(this).css("color","#898989");
		$(this).css("background-color","#EBEBEB");
		$(this).parent().find('.btnBusca').attr("src","http://negocios-inteligentes.imdt.com.br/resources/imagens/busca_btnh.jpg");
		$(this).parent().find('.buscaesq').css("background-image","url('http://negocios-inteligentes.imdt.com.br/resources/imagens/busca_esqh.jpg')");
	})
	.blur(function() {
	  $(this).css("color","");
	  $(this).css("background-color","");
	  $(this).parent().find('.btnBusca').attr("src","http://negocios-inteligentes.imdt.com.br/resources/imagens/busca_btn.jpg");
	  $(this).parent().find('.buscaesq').css("background-image","url('http://negocios-inteligentes.imdt.com.br/resources/imagens/busca_esq.jpg')");
	});
/* MUDAR BUSCA ON FOCUS */

/* MUDAR NEWSLETTER ON FOCUS */
	$("input[@name='newsletter']").focus(function() {
		if ($(this).val() == $(this).attr('title')) $(this).val('');
			$(this).css("color","#898989");
			$(this).css("background-color","#EBEBEB");
			//$(this).parent().css("background-color","#EBEBEB");
			$(this).parent().find('.btnBusca').attr("src","http://negocios-inteligentes.imdt.com.br/resources/imagens/busca_btnh.jpg");
	})
	.blur(function() {
	  if ($(this).val() == '') $(this).val($(this).attr('title'));
	  $(this).css("color","");
	  $(this).css("background-color","");
	  $(this).parent().css("background-color","");
	  $(this).parent().find('.btnBusca').attr("src","http://negocios-inteligentes.imdt.com.br/resources/imagens/busca_btn.jpg");
	});
/* MUDAR NEWSLETTER ON FOCUS */

/* Scroll Animado */
	$('a[href*=#]:not([href=#])').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target
			|| $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body')
				.animate({scrollTop: targetOffset}, 1000);
				return false;
			}
		}
	});
/* Scroll Animado */
	
/* Menu Acompanhando Scroll */
	if($(".menuInternas").get(0)) {
		var y_fixo = $(".menuInternas").offset().top;
		var divRelative = $(".conteudoInternas").offset().top;
		
		$(window).scroll(function () {
			alturaScroll = $(document).scrollTop();
			
			if(alturaScroll > y_fixo) {
				$(".menuInternas").animate({
				top: alturaScroll-divRelative-5+"px"
				},{duration:500,queue:false}
				);
			} else if($(".menuInternas").offset().top != y_fixo) {
				$(".menuInternas").animate({
				top: y_fixo-divRelative-12+"px"
				},{duration:500,queue:false}
				);
			}
		});	
	}
	
/* Menu Acompanhando Scroll */

/* Botao Voltar ao topo */	
	$('.btnTopo').click(function() {
		$('html,body').animate({scrollTop: 0}, 1000);
		return false;
	});
/* Botao Voltar ao topo */	

/* Botao Submit */
	$('.btEnviar').click(function(){
		$('.frmContato').submit();
		return false;
	});

/* Botao Submit */




});