// selObj.options[selObj.selectedIndex].value
function goUrl(target,win) {
	if(win) {
		parent[win].location = target;
	} else {
		window.location = target;
	}
}
function selTipo() {
	var f = document.forms.formulario;
	var l = f.elements('recaloc');
	var bol = (f.tipo.value == 'ADM') ? true : false;
	if(l) { 
		if(l.length>0) {
			for (i=0;i<l.length;i++) {
				l[i].disabled = bol;
			}
		} else {
			l.disabled = bol;
		}
	} 
}
function btnCancel(url) {
		window.self.location = url;
}
function exibir (id) {
	if(id) {
		nWin = window.open("exibir.php?id="+parseInt(id),'exibir','toolbar=0,location=0,directories=0,sobrebar=0,scrollbars=yes,resizable=yes,width=540,height=300');
		nWin.focus();
	}
}
function btnRemover (str) {
	var f = window.grid.document.forms.registro;
	if(f) {
		if(!str) {
			var str = 'Deseja realmente remover esses registros?';
		}
		if(confirm(str))
			f.submit();
	}
}

function btnEmail (str) {
	var f = window.grid.document.forms.registro;
	if(f) {
		if(!str) {
			var str = 'Deseja realmente enviar esses registros por e-mail?';
		}
		if(confirm(str))
			f.submit();
	}
}


function btnAddAtividade () {
	var f = window.grid.document.forms.registro;
	if(f) {
		f.submit();
	}
}
function piscar(str,n) {
	var lbsts = window.top.lbsts;
	if(n) {
		lbsts.innerHTML = "";
		setTimeout("piscar('"+str+"',false)",700);
	} else {
		lbsts.innerHTML = str;	
		setTimeout("piscar('"+str+"',true)",700);
	}
}
function currencyFormat(fld, milSep, decSep, e) {var sep = 0;var key = '';var i = j = 0;var len = len2 = 0;var strCheck = '0123456789';var aux = aux2 = '';
var whichCode = (window.Event) ? e.which : e.keyCode;if(whichCode == 13) return true;key = String.fromCharCode(whichCode);if (strCheck.indexOf(key) == -1) return false; 
len = fld.value.length;for(i = 0; i < len; i++)if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;aux = '';for(; i < len; i++) 
if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);aux += key;len = aux.length;if (len == 0) fld.value = '';if (len == 1) fld.value = '0'+ decSep + '0' + aux;
if (len == 2) fld.value = '0'+ decSep + aux;if (len > 2) {aux2 = '';for (j = 0, i = len - 3; i >= 0; i--) {if (j == 3) {aux2 += milSep;j = 0;}aux2 += aux.charAt(i);j++;}fld.value = '';len2 = aux2.length; 
for (i = len2 - 1; i >= 0; i--)fld.value += aux2.charAt(i);fld.value += decSep + aux.substr(len - 2, len);}return false;} 
