$(document).ready(function(){
	
	function getURL(){
		var d = 'coopatos.com.br';
		var e = '';
		if( location.hostname == 'localhost' )
			e = 'http://localhost/' + d + '/';
		else e = 'http://www.' + d + '/';
		return e;
	}

	
	/* FOOTER */
	/*var _top = $(window).scrollTop();
	
	$(window).scroll(function() {
		var _cur_top = $(window).scrollTop();
		if(_top < _cur_top)
			$('#footer').slideDown('slow');
		else
			$('#footer').slideUp('slow');
		_top = _cur_top;
	});
	
	$('#footer').keypress(function() {
		$('div#footer').slideUp('slow');
	 });*/
	 
	 /* SHADOW */
	/*$('#main #content .box_racoes .tit').each(function(){
		$(this).textDropShadow();
	});*/
	
	/* MENU DROP DOWN */
	//$('.a_subnav').parent().find("ul").css('margin-left', '-' + $(this).width() / 2 + 'px');
	$('a.a_subnav').click(function(){
		return false
	});

	$("a.a_subnav").hover(function() { 
	
		$(this).addClass('hover');
		
		$(this).parent().find("ul").slideDown().show(); 

		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul").slideUp(400, function(){
				$("a.a_subnav").removeClass('hover');
			});
		});

	});

	$('.subnav').css('margin-left', '-' + parseInt( $('a.a_subnav').width() / 2 - 5) + 'px');
	
	
	/* REDES SOCIAIS */
	$('.link_redes_sociais').click(function(){
		var div = '#' + $(this).attr('href');
		$('.redes_sociais').not(div).slideUp('slow', function(){
			$(div).slideDown('slow');
		});
		return false
	});
	
	/* ABRE FORMS */
	$('.link_form').click(function(){
		$('#fale_conosco').slideToggle('slow', function(){
			$('#fale_conosco label.error').hide()
			$('#fale_conosco').resetForm();
		});
		return false
	});
	
	/* FECHA FORMS */
	$('.close_form').click(function(){
		$('#fale_conosco').slideUp('slow', function(){
			$('#fale_conosco').resetForm();
			$('#fale_conosco label.error').hide();
		});
		return false
	});
	
	/* FECHA FORMS */
	$('.fechar').click(function(){
		$( $(this).attr('href') ).slideUp('slow').resetForm();
		$('label.error').hide(); 
		return false;
	});
	
	//CONTATO
	function response(data){
		$('#f_enviar').removeAttr("disabled");
		$('#f_enviando').hide();
		if(data.replace(/\s/g,"") == ''){
			$("#fale_conosco").resetForm();
			alert( 'Obrigado pelo contato. Em breve retornaremos.' );
		}
		else 
			alert( data );
	}
	$("#fale_conosco").validate({
		submitHandler: function(form) {
			$("#f_enviar").attr("disabled", true); 
			$('#f_enviando').show();
			$(form).ajaxSubmit({
				dataType: 'html',
				success: response
			});
			return false
		}
	});
	//mascara
	$('#f_telefone').mask('(99) 9999-9999');
			
});

/*$(document).ready(function(){
	$.get("cotacoes.php",
	function(data){
		$('#cotacoes').html(data);
		$('#cotacoes table tr').find('th:last, td:last').remove();
	});
});
*/

$(document).ready(function(){
	$('#cotacoes table').find('th:last, td:last').remove();
});
