<!--

function mFocus(c,p){
	c.bgColor = p;
}

function imgFocus(c,p){
	c.background = p;
}

function closeDiv(div){
	document.getElementById(div).innerText = '';
	document.getElementById(div).style.display = 'none';
}

function abreDiv(url,par,div){
	document.getElementById(div).style.display = '';
	adm_ajax(url, 'GET', 'true', div, par);
}

function divEspere(div){
	if(document.getElementById(div)){
		document.getElementById(div).innerHTML = "<table width='100%' height='100%' border='0' cellspacing='0' cellpadding='0'><tr><td><table align='center' border='0' cellspacing='0' cellpadding='0' class='titulo'><tr><td><img src='img/ajax-loader-8.gif' hspace='6' vspace='6' /></td><td><strong><em>Aguarde...</em></strong></td></tr></table></td></tr></table>";
	}
}

function replaceAll(string, token, newtoken) {
	//txt = replaceAll(txt,' ','[nbsp]');
	while (string.indexOf(token) != -1) {
		string = string.replace(token, newtoken);
	}
	return string;
}

function openPrintBusca(id){
	var tamW = 800;
	var tamH = 500;
	var x = (window.screen.width - tamW) / 2 ;
	var y = (window.screen.height - tamH) / 2 ;
	
	id = id.split('|');
	if(id[0]>0){
		window.open('Comitente_Imprimir_Recolha.asp?id_Estoque='+id[0],'attCabec','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width='+tamW+'px,height='+tamH+'px,top='+y+',left='+x);
	}
	if(id[1]>0){
		window.open('Comitente_Imprimir_Estoque.asp?id_Estoque='+id[1],'attCabec','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width='+tamW+'px,height='+tamH+'px,top='+y+',left='+x);
	}
	
	closeBusca('Buscar');
}

function openBusca(url,div){
	if(url.split('?').length>1){
		var par = url.split('?')[1];
		var url = url.split('?')[0];
	}else{
		var par = 'pTab='+pTab;
	}
	if(url!=''){
		adm_ajax(url,'GET','true',div,par);
		document.getElementById('fundo_principal').style.display = '';
		document.getElementById(div).style.display = '';
	}
}

function closeBusca(div){
		document.getElementById('fundo_principal').innerText = '';
		document.getElementById('fundo_principal').style.display = 'none';
		document.getElementById(div).innerText = '';
		document.getElementById(div).style.display = 'none';
}

function limpaVal(val){
	val = val.replace('R','');
	val = val.replace('$','');
	val = val.replace(' ','');
	val = val.replace('.','');
	val = val.replace('.','');
	val = val.replace('.','');
	val = val.replace('.','');
	val = val.replace('.','');
	val = val.replace('.','');
	val = val.replace('.','');
	val = val.replace('.','');
	val = val.replace(',','.');
	val = val * 1;
	return val;
}

function somaValores(p){
	var L_Lance    = document.addLance.L_Lance.value;
	var L_Despesas = document.addLance.L_Despesas.value;
	var L_Comissao = document.addLance.L_Comissao.value;
	var L_Total    = document.addLance.L_Total.value;
	
	L_Lance    = limpaVal(L_Lance);
	L_Despesas = limpaVal(L_Despesas);
	L_Comissao = limpaVal(L_Comissao);
	L_Total    = limpaVal(L_Total);
	
	// gera porcentagem
	L_Comissao = (L_Lance*(p/100));
	document.addLance.L_Comissao.value = currencyFormate2(L_Comissao);
	
	var L_Lance    = document.addLance.L_Lance.value;
	var L_Despesas = document.addLance.L_Despesas.value;
	var L_Comissao = document.addLance.L_Comissao.value;
	var L_Total    = document.addLance.L_Total.value;
	
	L_Lance    = limpaVal(L_Lance);
	L_Despesas = limpaVal(L_Despesas);
	L_Comissao = limpaVal(L_Comissao);
	L_Total    = limpaVal(L_Total);
	
	L_Total = (L_Lance*1)+(L_Despesas*1)+(L_Comissao*1);
	document.addLance.L_Total.value = currencyFormate2(L_Total);
	
//	alert(limpaVal(L_Lance));
}
-->