function setDivValue(page, destination){
	
	var doc = null;
	var posTag1 = 0;
	var posTag2 = 0;	
	var html = "";
	
	document.getElementById("DivCarregando").style.top = document.body.scrollTop;
	document.getElementById("DivCarregando").style.display = '';
	
	if (typeof window.ActiveXObject != 'undefined' ) 
	{ 
		doc = new ActiveXObject("Microsoft.XMLHTTP"); 		
	} 
	else 
	{ 		
		doc = new XMLHttpRequest(); 
	}
	
	if (doc){ 	 
		
		doc.open("GET", page);		
				
		doc.onreadystatechange = function() {
			if (doc.readyState == 4) {
				
				html = doc.responseText;
				
				//testa se existe alguma mensagem para ser exibida num alert
				posTag1 = html.indexOf("<@@LOJA@@/>");
				if(posTag1 > -1)
				{
					html = "";
					setDivValue("../int_produto/CorpoComercio.asp", destination);
				}
				
				posTag1 = html.indexOf("<@@MSG_ALERT@@>");		
				if(posTag1 > -1)
				{
					posTag2 = html.indexOf("</@@MSG_ALERT@@>");
					
					var msgAjax = doc.responseText.substring(posTag1 + 15, posTag2).split("-|-");
					for(var x = 0; x <= msgAjax.length -1; x++)
					{
						if(msgAjax[x] != "")
						{
							alert(msgAjax[x]);
						}
					}
					html = html.replace(doc.responseText.substring(posTag1, posTag2 + 16), "");							
				}
				
				destination.innerHTML = html;
				document.getElementById("DivCarregando").style.display = 'none';
			}
		}
		
		doc.send(null);	
	}
	else{
		destination.innerHTML = 'Browser unable to create XMLHttp Object';
	}
}

function alertAjax(html)
{
	//testa se existe alguma mensagem para ser exibida num alert
	posTag1 = html.indexOf("<@@MSG_ALERT@@>");		
	if(posTag1 > -1)
	{
		posTag2 = html.indexOf("</@@MSG_ALERT@@>");
		alert(doc.responseText.substring(posTag1 + 15, posTag2));
		html = html.replace(doc.responseText.substring(posTag1, posTag2 + 16), "");
	}
}

function seeDay(day)
{
	window.open('../int_interface/events.asp?Data='+day,'','SCROLLBARS=yes,RESIZABLE=no, TOOLBAR=no, STATUS=no, MENUBAR=no, width=450, height=350, TOP=185, LEFT=280');
}

function validaNewsletter()
{
	var d = document.formNews;
	if (d.DE_NOME.value == "")
	{
		alert('O campo nome é obrigatório.');
		return false;
	}
	if (d.DE_EMAIL.value == "")
	{
		alert('O campo E-mail é obrigatório.');
		return false;
	}
}


