var xmlHttp=null;
try{
	xmlHttp = xmlhttp = new XMLHttpRequest();
}catch(ee){
	try{
	        xmlHttp = xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
	        try{
	                xmlHttp = xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	        }catch(E){
	                xmlHttp = xmlhttp = false;
	        }
	}
}

function popin(ling){
	var antiCache   = Math.round(9999*Math.random());
	var div       = document.createElement("div");
	var body   = document.body;
	div.id="cadastro";
	div.innerHTML="Carregando";
	xmlHttp.open("GET","http://www.sensitiverose.com/m/"+ling+".php?"+antiCache,true);
	xmlHttp.onreadystatechange = function(){
	if (xmlHttp.readyState == '4'&& xmlHttp.status == 200){
			div.innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.send(null);	
	body.appendChild(div);
}

function gravarDados(){
	var email = "";
	if(document.getElementById("email")!=null){
		email   = document.getElementById("email").value;
	}
	var nome    = document.getElementById("nome").value;
	var palavra = document.getElementById("palavra").value; 
	conteudo="nome="+nome+"&email="+email+"&palavra="+palavra;
	xmlHttp.open("POST","http://www.sensitiverose.com/cadastrarPopin.php",true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.setRequestHeader('Content-length',this.conteudo.length );
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == '4'&& xmlHttp.status == 200){
			fecharpopin();
		}	
	}
	xmlHttp.send(conteudo);	
}

function fecharpopin(){
	if(document.getElementById("cadastro")!=null){
		document.body.removeChild(document.getElementById("cadastro"));
	}
}