// JavaScript Document
function blur_senha(){
	senha = document.getElementById("password");
	senha_txt = document.getElementById("password_txt");
	if (senha.value == '') {
		senha_txt.style.display = '';
		senha.style.display = 'none';
	}
}
function focus_senha(){
	senha = document.getElementById("password");
	senha_txt = document.getElementById("password_txt");
	senha_txt.style.display = 'none';
	senha.style.display = '';
	senha.focus();
}
function blur_usuario(obj){
	if (obj.value=='') {
		obj.value = 'Usuário';
	}
}
function focus_usuario(obj){
	if ( ( obj.value == 'Usuário' ) || ( obj.value == 'Usu&aacute;rio' ) ) {
		obj.value = '';
	}
}

function CreateBookmarkLink() {
 title = "Portal Integral"; 
 url = "http://www.integral.inf.br/";
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) {
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) {
		return true; }
}

function open_win(janela, win_w, win_h, url, scrollbar, resizable, status) {
	var w = screen.width;
	var h = screen.height;
	w = w - win_w;
	h = h - win_h;
	w = w/2;
	h = h/2;
	zoom = window.open(url, janela, 'width='+win_w+', height='+win_h+', toolbar=no,copyhistory=no,location=no,status='+status+',menubar=no,scrollbars='+scrollbar+',resizable='+resizable+',top='+h+',left='+w+'');
	zoom.focus();
}

function open_win_indique(janela, win_w, win_h, url, scrollbar, resizable, status) {
	var w = screen.width;
	var h = screen.height;
	w = w - win_w;
	h = h - win_h;
	w = w/2;
	h = h/2;
	zoom = window.open(url, janela, 'width='+win_w+', height='+win_h+', toolbar=no,copyhistory=no,location=no,status='+status+',menubar=no,scrollbars='+scrollbar+',resizable='+resizable+',top='+h+',left='+w+'');
	zoom.focus();
}

function trimAll(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function busca() {
	str = trimAll(document.getElementById("busca").value);
	if (str.length >= 2) {
		document.location = '../busca/index.php?busca='+document.getElementById("busca").value;
	} else {
		alert('Para obter sucesso na busca, digite uma palavra-chave.');
	}
}

function busca2() {
	str = trimAll(document.getElementById("busca2").value);
	if (str.length >= 2) {
		document.location = '../busca/index.php?busca='+document.getElementById("busca2").value;
	} else {
		alert('Para obter sucesso na busca, digite uma palavra-chave.');
	}
}
