function Pooopup(pagina, largura, altura) {
	w = screen.width;
	h = screen.height;
	meio_w = w/2;
	meio_h = h/2;

	altura2 = altura/2;
	largura2 = largura/2;
	meio1 = meio_h-altura2;
	meio2 = meio_w-largura2;

	if(screen.width <= 1024) {
		window.open(pagina,'','height=' + altura + ', width=' + largura + ', top='+meio1+', left='+meio2+'');
	} else {
		window.open(pagina,'','height=' + altura + ', width=' + largura + ', top='+meio1+', left='+meio2+'');
	}
}
function PopupManifestacao(pagina, largura, altura) {
	w = screen.width;
	h = screen.height;
	meio_w = w/2;
	meio_h = h/2;

	altura2 = altura/2;
	largura2 = largura/2;
	meio1 = meio_h-altura2;
	meio2 = meio_w-largura2;

	if(screen.width <= 1024) {
		window.open(pagina,'','height=' + altura + ', width=' + largura + ', top='+meio1+', left='+meio2+', scrollbars=1');
	} else {
		window.open(pagina,'','height=' + altura + ', width=' + largura + ', top='+meio1+', left='+meio2+', scrollbars=1');
	}
}
function MM_jumpMenu(targ,selObj,restore) {
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if(restore) selObj.selectedIndex=0;
}
function validate2(theForm) {
	if(theForm.email.value == "") { alert("Digite seu email!"); theForm.email.focus(); return (false); }
	if(theForm.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) { alert("E-mail inválido!"); theForm.email.focus(); return (false); } 
	return (true);
}
function validate(aaa) {
	if(aaa.busca.value == "") { alert("Digite algo válido para Buscar!"); aaa.busca.focus(); return (false); } 
	return (true);
}
function pesquisar(texto) { 
	url="./areadoacademico/diretorio_resposta.php?texto="+texto
	ajaxGet(url,document.getElementById("resposta"),'true');
}
function Abre(URL){
	var width = 360;
	var height = 255;	
	var left = 99;
	var top = 99;
	window.open(URL, 'Radio_FAIS_Online', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}
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) {
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;

	if(self.innerHeight) {
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	if(yScroll < windowHeight) {
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	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 verifica(v) { return((typeof(v)=='undefined' || v.length==0)? false : true); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function XeYjanela(v) { var z=agent('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth); return(verifica(v)?z[v]:z);  }

function abrelight(x,tam, tipo) {
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var fundo = document.getElementById('over');
	var div = document.getElementById(x);

	fundo.style.display='block';
	div.style.display='block';
	div.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - tam) / 2) + 'px');
	div.style.left = (((arrayPageSize[0] - 20 - tam) / 2) + 'px');
}

function fechalight(div) {
	var fundo = document.getElementById('over');	
	var div2 = document.getElementById(div);

	fundo.style.display='none';
	div2.style.display='none';
}

function vertamanho() {
	var fundo = document.getElementById('over');
	if(fundo.style.display=='block') {
		abreWebMail();
	}
}

function abreWebMail() {
	scrollTo(0,0);
	var div = 'webmail';
	var altu = 158;
	var larg = 308;
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();

	var fundo = document.getElementById('over');
	var div_get = document.getElementById(div);		

	fundo.style.display='block';
	fundo.style.height = arrayPageSize[1];

	div_get.style.display='block';	
	div_get.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - altu) / 2) + 'px');
	div_get.style.left = (((arrayPageSize[0] - 20 - larg) / 2) + 'px');
}

function mascara(o,f) {
	v_obj=o
	v_fun=f
	setTimeout("execmascara()",1)
}

function execmascara() {
	v_obj.value=v_fun(v_obj.value)
}

function leech(v) {
	v=v.replace(/o/gi,"0")
	v=v.replace(/i/gi,"1")
	v=v.replace(/z/gi,"2")
	v=v.replace(/e/gi,"3")
	v=v.replace(/a/gi,"4")
	v=v.replace(/s/gi,"5")
	v=v.replace(/t/gi,"7")
	return v
}

function soNumeros(v) {
	return v.replace(/\D/g,"")
}

function telefone(v) {
	v=v.replace(/\D/g,"")                 //Remove tudo o que não é dígito
	v=v.replace(/^(\d\d)(\d)/g,"($1) $2") //Coloca parênteses em volta dos dois primeiros dígitos
	v=v.replace(/(\d{4})(\d)/,"$1-$2")    //Coloca hífen entre o quarto e o quinto dígitos
	return v
}
function itelefone(v) {
	v=v.replace(/\D/g,"")                 //Remove tudo o que não é dígito
	v=v.replace(/^(\d\d)(\d)/g,"($1) $2") //Coloca parênteses em volta dos dois primeiros dígitos
	v=v.replace(/(\d{4})(\d)/,"$1-$2")    //Coloca hífen entre o quarto e o quinto dígitos
	return v
}

function ddd(v) {
	v=v.replace(/\D/g,"")                 //Remove tudo o que não é dígito
	v=v.replace(/^(\d\d)(\d)/g,"($1)") //Coloca parênteses em volta dos dois primeiros dígitos
	return v
}

function cpf(v) {
	v=v.replace(/\D/g,"")                    //Remove tudo o que não é dígito
	v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
	v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
	//de novo (para o segundo bloco de números)
	v=v.replace(/(\d{3})(\d{1,2})$/,"$1-$2") //Coloca um hífen entre o terceiro e o quarto dígitos
	return v
}

function cep(v) {
	v=v.replace(/D/g,"")                //Remove tudo o que não é dígito
	v=v.replace(/^(\d{5})(\d)/,"$1-$2") //Esse é tão fácil que não merece explicações
	return v
}

function cnpj(v) {
	v=v.replace(/\D/g,"")                           //Remove tudo o que não é dígito
	v=v.replace(/^(\d{2})(\d)/,"$1.$2")             //Coloca ponto entre o segundo e o terceiro dígitos
	v=v.replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3") //Coloca ponto entre o quinto e o sexto dígitos
	v=v.replace(/\.(\d{3})(\d)/,".$1/$2")           //Coloca uma barra entre o oitavo e o nono dígitos
	v=v.replace(/(\d{4})(\d)/,"$1-$2")              //Coloca um hífen depois do bloco de quatro dígitos
	return v
}

function romanos(v) {
	v=v.toUpperCase()             //Maiúsculas
	v=v.replace(/[^IVXLCDM]/g,"") //Remove tudo o que não for I, V, X, L, C, D ou M
	//Essa é complicada! Copiei daqui: http://www.diveintopython.org/refactoring/refactoring.html
	while(v.replace(/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/,"")!="")
	v=v.replace(/.$/,"")
	return v
}

function site(v) {
	//Esse sem comentarios para que você entenda sozinho ;]
	v=v.replace(/^http:\/\/?/,"")
	dominio=v
	caminho=""
	if(v.indexOf("/")>-1)
		dominio=v.split("/")[0]
		caminho=v.replace(/[^\/]*/,"")
		dominio=dominio.replace(/[^\w\.\+-:@]/g,"")
		caminho=caminho.replace(/[^\w\d\+-@:\?&=%\(\)\.]/g,"")
		caminho=caminho.replace(/([\?&])=/,"$1")
		if(caminho!="")dominio=dominio.replace(/\.+$/,"")
			v="http://"+dominio+caminho
	return v
}

function barra(objeto) {
	if (objeto.value.length == 2 || objeto.value.length == 5 ){
		objeto.value = objeto.value+"/";
	}
}

function Atendimento(objeto) {
	if (objeto.value.length == 4){ objeto.value = objeto.value+"/";	}
}