function receber_nossa_news(){
	var colar_frame	= document.getElementById("colar_frame");
	if(colar_frame) {colar_frame.style.display="none"}
	var novoBanner= document.getElementById("novoBanner");
	if(novoBanner) {novoBanner.style.display="none"}
	/*****************************/
	bx=document.getElementById("caixa_preta");
	bxi=document.getElementById("caixa_preta_interna");
	movido=xScrollTop();
	bx.style.top=movido;
	bx.style.width=screen.width;
	bx.style.height=screen.height;
	bx.style.display="block";
	/*****************************/
	var nvalortop=((screen.height)/2)-330;
	bxi.style.top=movido+nvalortop;
	bxi.style.left=200;
	bxi.style.display="block";
	/*****************************/
	document.getElementById("img_code").src="verify_imagem2.php";
	document.getElementById('body_geral').style.overflow='hidden';
}
function fechar_news(){
	document.getElementById("caixa_preta").style.display="none";
	document.getElementById("caixa_preta_interna").style.display="none";	
	var colar_frame	= document.getElementById("colar_frame");
	if(colar_frame) {
		colar_frame.style.display="block"
	}
	var novoBanner= document.getElementById("novoBanner");
	if(novoBanner) {novoBanner.style.display="block"}
	document.getElementById('body_geral').style.overflow="auto";
	box='news_corpo_geral';
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="agregados/news_formulario_vazio.html";
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function registrar_pedido_news(){
	verifica_email=validar_email("news_mail");
	verifica_auth=document.getElementById("news_verify").checked;
	verifica_nome=document.getElementById("news_name").value.length;
	var divAl=document.getElementById("news_alerta");
	if(verifica_nome<3){
		divAl.style.display="block";
		divAl.innerHTML="<p>Por favor, preencha a caixa \"nome\" corretamente.</p>";
		return;
	}
	if(!verifica_email){
		divAl.style.display="block";
		divAl.innerHTML="<p>Por favor, preencha a caixa \"e-mail\" corretamente.</p>";
		return;
	}
	if(!verifica_auth){
		divAl.style.display="block";
		divAl.innerHTML="<p>Para registrar pedido &eacute; necess&aacute;rio selecionar a \"checkbox\" de confirma&ccedil;&atilde;o.</p>";
		return;
	}
	/*Enviando*/
	box='news_corpo_geral';
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	}
	nome=document.getElementById("news_name").value;
	email=document.getElementById("news_mail").value;
	codigo=document.getElementById("news_codigo").value;
	var url="news_acidiona.php?nome="+nome+"&email="+email+"&codigo="+codigo;
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	/*Enviando final */
	
}
function validar_email(id){
    var str = document.getElementById(id).value;
    var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    if(filter.test(str))
      valido = true;
    else{
      valido = false;
    }
    return valido;
}
function mostrar_ajuda(campo,status){
	if(status=="on"){
		document.getElementById("explicacao_"+campo).style.display="block";
	}else{
		document.getElementById("explicacao_"+campo).style.display="none";
	}
}
/*
 * AJAX 
*/
function stateChanged(){ 
	if(xmlhttp.responseText=='no'){
		location.href='login.php';
	}
	if (xmlhttp.readyState==4){ 
		document.getElementById(box).innerHTML=xmlhttp.responseText;
	}
}

function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject){
		//code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}
/* Ajax vs Caixa Flutuante */
var xmlhttp;
var box;

