function MwcDiv(div){
	var div=document.getElementById(div);
	if(div.style.display=='block' ){
		div.style.display='none';
	}else{
		div.style.display='block';
	}
}

function showMenuRM(obj){
	var div = document.getElementById(obj);
	if(div.style.display == 'none') div.style.display = 'block';
}
function hideMenuRM(obj){
	var div = document.getElementById(obj);
	if(div.style.display == 'block') div.style.display = 'none';
}

function MwcRefresh(pg){
	window.location.href('index.php?pg='+pg);
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

function initOver(div){
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();	
	
	var fundo = document.getElementById(div);
	fundo.style.height = arrayPageSize[1];
}
initOver('mwcover');

function MwcValidacao(MwcForm){
	if(MwcForm.nome_a.value == ""){
		alert("O nome está vazio!");
		MwcForm.nome_a.focus();
		MwcForm.nome_a.style.border='1px solid #FF0000';
		return(false);
	}
	if(MwcForm.nascimento_a.value == ""){
		alert("A data de nascimento do aluno não pode ser vazio!");
		MwcForm.nascimento_a.focus();
		MwcForm.nascimento_a.style.border='1px solid #FF0000';
		return(false);
	}
	if(MwcForm.end_a.value == ""){
		alert("O endereço do aluno não pode ser vazio!");
		MwcForm.end_a.focus();
		MwcForm.end_a.style.border='1px solid #FF0000';
		return(false);
	}
	
	if(MwcForm.pai_a.value == "" &&  MwcForm.mae_a.value == "" && MwcForm.resp_a.value == ""){
		alert("Os nomes dos pais estão vazios, porem se o responsavel pelo aluno não forem os pais, voce deve preencher o nome do responsável");
		MwcForm.pai_a.focus();
		MwcForm.pai_a.style.border='1px solid #FFCC00';
		MwcForm.mae_a.style.border='1px solid #FFCC00';
		MwcForm.resp_a.style.border='1px solid #FFCC00';
		return(false);
	}
	
	if(MwcForm.login_a.value == ""){
		alert("Você deve informar um login");
		MwcForm.login_a.focus();
		MwcForm.login_a.style.border='1px solid #FF0000';
		return(false);
	}
	
	if(MwcForm.senha_a.value == ""){
		alert("Você deve informar uma senha");
		MwcForm.senha_a.focus();
		MwcForm.senha_a.style.border='1px solid #FF0000';
		return(false);
	}

return(true);
}

function MwcValidacao2(MwcForm){
	if(MwcForm.nome_p.value == ""){
		alert("O nome está vazio!");
		MwcForm.nome_p.focus();
		MwcForm.nome_p.style.border='1px solid #FF0000';
		return(false);
	}
	if(MwcForm.nascimento_p.value == ""){
		alert("A data de nascimento não pode ser vazio!");
		MwcForm.nascimento_p.focus();
		MwcForm.nascimento_p.style.border='1px solid #FF0000';
		return(false);
	}
	if(MwcForm.ende_p.value == ""){
		alert("O endereço não pode ser vazio!");
		MwcForm.ende_p.focus();
		MwcForm.ende_p.style.border='1px solid #FF0000';
		return(false);
	}
	
	if(MwcForm.login_p.value == ""){
		alert("Você deve informar um login");
		MwcForm.login_p.focus();
		MwcForm.login_p.style.border='1px solid #FF0000';
		return(false);
	}
	
	if(MwcForm.senha_p.value == ""){
		alert("Você deve informar uma senha");
		MwcForm.senha_p.focus();
		MwcForm.senha_p.style.border='1px solid #FF0000';
		return(false);
	}

return(true);
}
