
var timeIDstopScroll = null; //usado no evento scroll

$(window).scroll(function(){
	if (timeIDstopScroll != null) clearTimeout(timeIDstopScroll)
	timeIDstopScroll = setTimeout(onscrollstop, 50)
})
onscrollstop = function() {
	try{
		$("#alertSite").animate({
			'top': ($(window).height()/3)+$(window).scrollTop()
		}, 400)
	}catch(e){}

	try{
		var conteudoAjax = $('#conteudoHtml')
		conteudoAjax.animate({
			'top': (parseInt($(window).height()/2)-parseInt(conteudoAjax.height()/2))+parseInt($(window).scrollTop())
		}, 400)
	}catch(e){}

	try{	
		var sucessoAtendimento = $('#sucessoAtendimento')
		sucessoAtendimento.animate({
			'top': (($(window).height()/2)-(sucessoAtendimento.height()/2))+$(window).scrollTop()
		})
	}catch(e){}		
}

$(window).resize(function() {
	$('#bgConteudoHtml').css('height', $(document).height()-5)
	//$('#bgSite').css({'height':$(document).height()})

	try{
		var loadingAjax = $('#loading')
		loadingAjax.css({
			'left': $(window).width()/2-loadingAjax.width()/2, 
			'top': (($(window).height()/2)-(loadingAjax.height()/2))+$(window).scrollTop()
		})
	}catch(e){}

	try{	
		var conteudoAjax = $('#conteudoHtml')
		conteudoAjax.css({
			'left': $(window).width()/2-conteudoAjax.width()/2,
			'top': (($(window).height()/2)-(conteudoAjax.height()/2))+$(window).scrollTop()
		})
	}catch(e){}

	try{	
		var sucessoAtendimento = $('#sucessoAtendimento')
		sucessoAtendimento.css({
			'left': $(window).width()/2-sucessoAtendimento.width()/2,
			'top': (($(window).height()/2)-(sucessoAtendimento.height()/2))+$(window).scrollTop()
		})
	}catch(e){}		
})
