/**
 * @author jonas
 */

var dataMenu = null;
var dataContent = null;

 function loadMainPage(pageIn)
 {
	var httpReq = httpRequisition();

	httpReq.onreadystatechange = function () {
		if((httpReq.readyState == 4) && (httpReq.status == 200)) {
	 		document.getElementById('corpo').innerHTML = httpReq.responseText;
		}
	}
	
	httpReq.open('GET', pageIn, true);
	httpReq.send(null);
 }
 
 
 function loadInternalPage(templateIn, dataMenuIn, dataContentIn)
{
	dataMenu = dataMenuIn;
	dataContent = dataContentIn;
	
	var httpReq = httpRequisition();

	httpReq.onreadystatechange = function () {
		if((httpReq.readyState == 4) && (httpReq.status == 200)) {
	 		document.getElementById('corpo').innerHTML = httpReq.responseText;

			loadInternalPageMenu(dataMenu);
			loadInternalPageContent(dataContent);
		}
	}
	
	httpReq.open('GET', templateIn, true);
	httpReq.send(null);
} 
 
 
function loadInternalPageMenu(menuIn)
{
	var httpReq = httpRequisition();

	httpReq.onreadystatechange = function () {
		if((httpReq.readyState == 4) && (httpReq.status == 200)) {
	 		document.getElementById('boxMenuE1').innerHTML = httpReq.responseText;
		}
	}
	
	httpReq.open('GET', menuIn, true);
	httpReq.send(null);
}


function loadInternalPageContent(contentIn)
{
	var httpReq = httpRequisition();

	httpReq.onreadystatechange = function () {
		if((httpReq.readyState == 4) && (httpReq.status == 200)) {
	 		document.getElementById('conteudo').innerHTML = httpReq.responseText;
		}
	}
	
	httpReq.open('GET', contentIn, true);
	httpReq.send(null);
}
