 
	var http_request = false;
	var ap_shop = 0;
	var parametrosshop = "";

    function makeRequestListaMoradores(url,ap,ed) {
		momentoAtual = new Date()

		hora = momentoAtual.getHours()

		minuto = momentoAtual.getMinutes()

		segundo = momentoAtual.getSeconds()

		horaImprimivel = hora  + minuto + segundo

		parametrosshop = '?cod='+url+'&ap='+ap+'&ed=Loja&d'+horaImprimivel;
	
		//alert(url);
		if (ap == 1){
			ap_shop = 1;
		}else{
			ap_shop = 0;
		}
		
		//caminho da página em PHP que vai selecionar os dadas a serem exibidos
		url = './includes/lista_moradores.inc.php?cod='+url+'&ap='+ap+'&ed='+ed+'&ap_shop='+ap_shop+'&d'+horaImprimivel;		

		http_request = false;



        if (window.XMLHttpRequest) { // Mozilla, Safari,...

            http_request = new XMLHttpRequest();

            if (http_request.overrideMimeType) {

                http_request.overrideMimeType('text/xml');

                // See note below about this line

            }

        } else if (window.ActiveXObject) { // IE

            try {

                http_request = new ActiveXObject("Msxml2.XMLHTTP");

            } catch (e) {

                try {

                    http_request = new ActiveXObject("Microsoft.XMLHTTP");

                } catch (e) {}

            }

        }



        if (!http_request) {

            alert('Giving up :( Cannot create an XMLHTTP instance');

            return false;

        }

	
		
        http_request.onreadystatechange = alertContentsListaMoradores;

        http_request.open('GET', url, true);

        http_request.send(null);		

    }



    function alertContentsListaMoradores() {



        if(http_request.readyState == 1){
		
		    div_morador.innerHTML = '<table width="100%" height="200"><tr><td align="center" valing="middle"><img src="./img/carregando.png" /></td></tr></table>';
		}
	   
	    if (http_request.readyState == 4) {

            if (http_request.status == 200) {
				div_morador.innerHTML = (http_request.responseText);
				if (ap_shop == 1){
					//div_morador_shop.innerHTML = (http_request.responseText);
					$("#div_morador_shop").load("includes/lista_moradores.inc_shop.php"+parametrosshop, function() {
							$('.usuarioform').each(function()
							{
								$(this).qtip(
								{
									content: {
										text: '<img class="throbber" src="images/loading.gif" alt="carregando..." />',
										url: "includes/form_cnpj.php"+$(this).attr('rel'),
										title: {
											text: 'Formulário - ' + $(this).text(),
											button: 'fechar'
										}
									},
								position: {
									corner: {
									   target: 'topMiddle',
									   tooltip: 'bottomMiddle'
									},
									adjust: {
									   screen: true
									}
								},
								show: { 
									when: 'click', 
									solo: true
								},
								hide: 'unfocus',
								style: {
									tip: true,
									border: {
									   width: 0,
									   radius: 4
									},
									name: 'blue',
									width: 400
								}
								});
							});
							
							$('.usuariocad').each(function()
							{
								$(this).qtip(
								{
									content: {
										text: '<img class="throbber" src="/images/loading.gif" alt="carregando..." />',
										url: $(this).attr('rel'),
										title: {
										   text: 'Informações de Usuário - ' + $(this).text()
										}
									},
								position: {
									corner: {
									   target: 'topMiddle',
									   tooltip: 'bottomMiddle'
									},
									adjust: {
									   screen: true
									}
								},
								show: { 
									when: 'mouseover', 
									solo: true
								},
								hide: 'mouseout',
								style: {
									tip: true,
									border: {
									   width: 0,
									   radius: 4
									},
									name: 'blue',
									width: 400
								}
								});
							});	
					});
				}else{
					div_morador_shop.innerHTML = "";
				}
				
				$('.usuariocad').each(function()
				{
					$(this).qtip(
					{
						content: {
							text: '<img class="throbber" src="/images/loading.gif" alt="carregando..." />',
							url: $(this).attr('rel'),
							title: {
							   text: 'Informações de Usuário - ' + $(this).text()
							}
						},
					position: {
						corner: {
						   target: 'topMiddle',
						   tooltip: 'bottomMiddle'
						},
						adjust: {
						   screen: true
						}
					},
					show: { 
						when: 'mouseover', 
						solo: true
					},
					hide: 'mouseout',
					style: {
						tip: true,
						border: {
						   width: 0,
						   radius: 4
						},
						name: 'blue',
						width: 400
					}
					});
				});	
		
				$('.usuarioformcpf').each(function()
				{
					$(this).qtip(
					{
						content: {
							text: '<img class="throbber" src="images/loading.gif" alt="carregando..." />',
							url: "includes/form_cpf.php"+$(this).attr('rel'),
							title: {
								text: 'Formulário - ' + $(this).text(),
								button: 'fechar'
							}
						},
					position: {
						corner: {
						   target: 'topMiddle',
						   tooltip: 'bottomMiddle'
						},
						adjust: {
						   screen: true
						}
					},
					show: { 
						when: 'click', 
						solo: true
					},
					hide: 'unfocus',
					style: {
						tip: true,
						border: {
						   width: 0,
						   radius: 4
						},
						name: 'blue',
						width: 400
					}
					});
				});

            } else {

                div_morador.innerHTML = ('Página não encontrada!');

            }

        }

    }

