// JavaScript Document

//funcao para gravar endereco de email no banco de newsletter
function GravaNewsletter(){

	if(document.getElementById('camponews').value != '' && document.getElementById('camponews').value != 'digite seu e-mail'){

		valor = document.getElementById('camponews').value;

		var tempIFrame=document.createElement('iframe');
		tempIFrame.setAttribute('id','iframe_newsletter');
		tempIFrame.setAttribute('name','iframe_newsletter');
		tempIFrame.style.border = '0px';
		tempIFrame.style.width = '0px';
		tempIFrame.style.height = '0px';
		tempIFrame.setAttribute('src','inc/inc_gravanewsletter.asp?email='+valor);
		IFrameObj = document.body.appendChild(tempIFrame);
	
		texto = '<span style="color:#0059bd; font-size:12px; font-weight:bold;">Assine nossa newsletter</span><br /><br />Seu cadastro foi efetuado com sucesso!';
		document.getElementById('newsletter').innerHTML = texto;
	
	}

}

//funcao para limpar o campo da nesw somente caso seja valor default
function LimpaNewsletter(){
	if(document.getElementById('camponews').value == 'digite seu e-mail') document.getElementById('camponews').value = '';
}

//funcao para cadastrar a newsletter ao se pressionar enter

function EnviaNewsletter(){
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	if(keycode == "13"){
		GravaNewsletter()
	}
}


