function $(id) { return document.getElementById(id) }

function AbreJanela(destino,titulo,x,y,prt1) {
 var prt = prt1.split(",");
 var prt2 = 'width='+x+', height='+y+', toolbar='+prt[0]+',directories='+prt[1]+',status='+prt[2]+',location='+prt[3]+', menubar='+prt[4]+', resizable='+prt[5]+', scrollbars='+prt[6];
 var janela = window.open(destino,titulo,prt2);
 if (janela == false) { window.alert("Este site utiliza popups!\nPor favor desabilite seu bloqueador de popups e tente novamente!"); }
}

function LimpaForm(id) { 
 for (i=0; i<$(id).length; i++) { 
  if ($(id).elements[i].type == "text" || $(id).elements[i].type == "hidden" || $(id).elements[i].type == "textarea") $(id).elements[i].value = "";  
  if ($(id).elements[i].type == "select-one") $(id).elements[i].item(0).selected = true;  
 }  
} 

function Iluminar(id) { 
 $(id).style.backgroundColor = "#c6d2df";
 $(id).style.color = "#FFFFFF"; 
}

function Normal(id) { 
 $(id).style.backgroundColor = "#FFFFFF";  
 $(id).style.color = "#000000"; 
}

function Excluir(id) { 
 window.opener.$(id).style.display = "none"; 
}

function Liberar(id) { 
 var e = "img"+id;
 window.opener.$(e).src = "imagens/liberado.gif"; 
 window.opener.$(e).alt = "Registro liberado"; 
}

function Centralizar(id,w,h) { 
 $(id).style.width = w+"px";
 $(id).style.height = h+"px";
 $(id).style.marginLeft = (Math.round(w/2)*-1)+"px";
 $(id).style.marginTop = (Math.round(h/2)*-1)+"px";
 $(id).style.top = "50%";
 $(id).style.left = "50%";
 $(id).style.position = "absolute";
 window.status = w+" x "+h;
}

function addEvent(obj, evType, fn) {
 if (obj.addEventListener) { obj.addEventListener(evType, fn, true); }
 if (obj.attachEvent) { obj.attachEvent("on" + evType, fn); }
}

