function pre_checkbox(obj,valores){
	var indexes=new Array();
	var valores=valores.split(',');
	for(j=0;j<obj.length && valores.length>0;j++){
		for(i=0;i<valores.length;i++){
			if (+obj[j].value==+valores[i]){
				valores.splice(i,1);
				obj[j].checked=1;
				indexes.push(j);
			}
		}
	}
	return indexes;
}
function pre_select(obj,valor_selecionado){
	for(i=0;i<obj.length;i++){
		if (obj.options[i].value==valor_selecionado){
			obj.options[i].selected=1;
			return obj.options[i].value;
		}
	}
	return obj.options[0].value
}
function sysLogon(){
	var xmlhttp=false;
	try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
	catch (e){
		try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
		catch (E){xmlhttp = false;}
	}
	if (!xmlhttp) xmlhttp = new XMLHttpRequest();
	var username=document.getElementById('log_username').value;
	var password=document.getElementById('log_password').value;
	xmlhttp.open("POST","/log/ajaxLogin.asp",true);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", 2);
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4){
			switch(xmlhttp.responseText){
			case '1':alert('Sistema inativo. Verifique seu e-mail para ativar o sistema, ou entre em contato.');break;
			case '2':alert('Campo em branco.');break;
			case '3':alert('Usuário ou senha não encontrados.');break;
			case '4':alert('Usuário excluído.');break;
			case '5':
				var obj=document.getElementById('topoLogin');
				var pai=obj.parentNode
				pai.removeChild(obj);
				pai.innerHTML+='<div class="log" style="width:160px;padding-top:5px;"><div>Login realizado</div><div style="width:100%;"><a href="/usuario/editProfile.asp" style="text-decoration:none;color:#666;">administra&ccedil;&atilde;o</a> / <a href="/log/logout.asp" style="text-decoration:none;color:#666;">logout</a> </div></div>';
				break;
			default:alert(xmlhttp.responseText);break;
			}
		}
	};
	xmlhttp.send("username="+username+"&password="+password);
	return false;
}
