//JS SCRIPT
try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

ajaxocupado = function() {
    estadoAtual = this.xmlhttp.readyState;
    return (estadoAtual && (estadoAtual < 4));
}

function indicar(){
	
	form = document.compartilheForm;
	div = document.getElementById('indique');
	
	mensagem = form.mensagem.value;
	amigos = form.amigos.value;
	nome = form.nome.value;
	seguranca = form.seguranca.value;
	
	if(amigos=='' || amigos=='Separar os endereços de email por ponto e vírgula'){
		alert('Para enviar suas indicações é necessário que você escreva os e-mails dos seus amigos na lista, separando-os com ponto-vírgula, ex:\n\nfulano@provedor.com.br;ciclano@provedor.com.br');
		return false;
	} else{}
	
	if(nome==''){
		alert("Para enviar suas indicações é necessário que você escreva o seu nome");
		return false;
	} else{}
	
	if(seguranca==''){
		alert("Para enviar suas indicações é necessário que você informe o que está escrito na imagem de segurança abaixo do campo nome!");
		return false;
	} else{}
			  
	
	div.innerHTML='<div style="padding:20px; padding-top:100px "><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="20"><img src="/imagens/load.gif" width="16" height="16" /></td><td class="compartilheDiv">Aguarde enquanto enviamos sua indicação!</td></tr></table></div>'
	
	//Abre a url
    xmlhttp.open("GET", "/enviar_indicacao.php?mensagem="+mensagem+"&amigos="+amigos+"&nome="+nome,true);
	xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4){
		div.innerHTML = xmlhttp.responseText;
    }
}
xmlhttp.send(null)
	
}

function NLCadastrarEmail(){

	email = document.boletimForm.email;
	nome = document.boletimForm.nome;
	
	if(nome.value.length<1){
		alert('Digite seu nome');
		nome.focus();
		return false;
	} else{
		//Abre a url
    	xmlhttp.open("GET", "/newsletter_ajax.php?email="+email.value+"&nome="+nome.value,true);
		div = document.getElementById('divNewsletter');
		div.innerHTML='<div style="padding-top:64px; padding-left:14px "><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="20"><img src="/imagens/load.gif" width="16" height="16" /></td><td>Aguarde enquanto o aplicativo é carregado!</td></tr></table></div>';
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				div.innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.send(null)
		}
		
		return false;

}

function iniciarChat(){
	window.open('http://www.10mb.com.br/atendimento-chat/livezilla.php?reset=true','','width=590,height=550,left=0,top=0,resizable=yes,menubar=no,location=yes,status=yes,scrollbars=yes');
}