
	function doBlockLoading(id) {
		
		var mt = ($('#'+id).height() / 2)-12;
		//Hide all content of target
		$('#'+id+' *').hide();
		//Append div with some width and height of target
		$('#'+id).append('<div style="height:'+ $('#'+id).height() +'px; width:'+ $('#'+id).width() +'px; padding:0; margin:0; text-align:center;"><img src="images/ajax-loader.gif" border="0" style=margin-top:'+ mt +'px;" /></div>');
	}

	function doAjax(ajaxId, ajaxPath, ajaxCallBack) {

		doBlockLoading(ajaxId);
		
		$.ajax({
			url: ajaxPath,
			type: 'POST',
			data: $('form').serialize(), 
			success: function(data) {
				
				//Animation set invisible
				//$('#'+ajaxId).fadeTo(0, 0);

				//Animation in
				//$('#'+ajaxId).fadeTo('slow', 1);

				$('#'+ajaxId).html(data);
				
				if((ajaxCallBack != undefined) && (ajaxCallBack != null) && (ajaxCallBack != ''))
					eval(ajaxCallBack); 
			}
		});
	}
	
	function doAjaxProc(ajaxPath, ajaxCallBack) {
		
		$.ajax({
			url: ajaxPath,
			type: 'POST',
			data: $('form').serialize(),
			success: function(ajaxReturn) {
				eval(ajaxReturn);
				if((ajaxCallBack != undefined) && (ajaxCallBack != null))
					eval(ajaxCallBack); 
			}
		});
	} 

	function doShowProd(id, url, linha, produto, link_linha, url_menu) {
	
		$('#linha').style.backgroundImage = linha;
		$('#produto').style.backgroundImage = produto;
		$('#link_linha').href = link_linha;
		//window.scrollTo(0, 0);
		doAjax(id, url);
		doAjax('menu-box-b', url_menu);
	}
	
	function doShowProdImg(path){
		$('#imagem_produto').html("<image src='" + path + "'>");
	} 

	function doShowMsg(){
		$('#msg-sended').show();
		$('#conteudo').hide();
	}
	
	function doHideMsg(){
		$('#msg-sended').hide();
		$('#conteudo').show();
	}
	
	function doValidate() {
		
		if(!$('#nome').val()) { 
			alert("Informe seu nome"); 
			$('#nome').focus(); 
			return false; 
		} 
		if(!$('#cidade').val()) { 
			alert("Informe sua cidade"); 
			$('#cidade').focus(); 
			return false; 
		} 
		if(!$('#uf').val()) { 
			alert("Informe a sigla do seu estado"); 
			$('#uf').focus(); 
			return false; 
		} 
		if(!$('#email').val()) { 
			alert("Informe o seu email"); 
			$('#email').focus(); 
			return false;
		}
		else {

			thisExp = new RegExp(/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/);
			
			if(!thisExp.test($('#email').val())) {
				alert("O formato do e-mail esta incorreto"); 
				$('#email').focus(); 
				return false;
			}
		} 
		if(!$('#mensagem').val()) { 
			alert("Descreva a sua mensagem"); 
			$('#mensagem').focus(); 
			return false; 
		} 
	}
