function mudaAtendimento(doc)
{
	doc.images.atendimento.src = "images/bot_01b.gif";
	doc.images.empresa.src = "images/bot_02a.gif";
	doc.images.fale.src = "images/bot_03a.gif";
	doc.images.home.src = "images/bot_04a.gif";
	doc.images.regulares.src = "images/bot_05a.gif";
	doc.images.encomenda.src = "images/bot_06a.gif";
	if (doc.form_carrinho.categoria.value != "0")
	{
		imagem_bullet_normal = doc.getElementById(doc.form_carrinho.categoria.value);
		imagem_bullet_normal.src = "images/bulleta.gif";
	}
	if (doc.form_carrinho.linha.value != "0")
	{
		linha_normal = doc.getElementById(doc.form_carrinho.linha.value);
		linha_normal.className = "branco";
	}
	doc.form_carrinho.categoria.value = "0";
	if (doc.form_carrinho.unidades.value == "0")
	{
		doc.images.carrinho.src = "images/bot_07a.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12a.gif')";
		doc.form_carrinho.unidades.style.color = "#333333";
	}
	else
	{
		doc.images.carrinho.src = "images/bot_07c.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12b.gif')";
		doc.form_carrinho.unidades.style.color = "#FFFFFF";
	}
}
function mudaEmpresa(doc)
{
	doc.images.atendimento.src = "images/bot_01a.gif";
	doc.images.empresa.src = "images/bot_02b.gif";
	doc.images.fale.src = "images/bot_03a.gif";
	doc.images.home.src = "images/bot_04a.gif";
	doc.images.regulares.src = "images/bot_05a.gif";
	doc.images.encomenda.src = "images/bot_06a.gif";
	if (doc.form_carrinho.categoria.value != "0")
	{
		imagem_bullet_normal = doc.getElementById(doc.form_carrinho.categoria.value);
		imagem_bullet_normal.src = "images/bulleta.gif";
	}
	if (doc.form_carrinho.linha.value != "0")
	{
		linha_normal = doc.getElementById(doc.form_carrinho.linha.value);
		linha_normal.className = "branco";
	}
	doc.form_carrinho.categoria.value = "0";
	if (doc.form_carrinho.unidades.value == "0")
	{
		doc.images.carrinho.src = "images/bot_07a.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12a.gif')";
		doc.form_carrinho.unidades.style.color = "#333333";
	}
	else
	{
		doc.images.carrinho.src = "images/bot_07c.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12b.gif')";
		doc.form_carrinho.unidades.style.color = "#FFFFFF";
	}
}
function mudaFale(doc)
{
	doc.images.atendimento.src = "images/bot_01a.gif";
	doc.images.empresa.src = "images/bot_02a.gif";
	doc.images.fale.src = "images/bot_03b.gif";
	doc.images.home.src = "images/bot_04a.gif";
	doc.images.regulares.src = "images/bot_05a.gif";
	doc.images.encomenda.src = "images/bot_06a.gif";
	if (doc.form_carrinho.categoria.value != "0")
	{
		imagem_bullet_normal = doc.getElementById(doc.form_carrinho.categoria.value);
		imagem_bullet_normal.src = "images/bulleta.gif";
	}
	if (doc.form_carrinho.linha.value != "0")
	{
		linha_normal = doc.getElementById(doc.form_carrinho.linha.value);
		linha_normal.className = "branco";
	}
	doc.form_carrinho.categoria.value = "0";
	if (doc.form_carrinho.unidades.value == "0")
	{
		doc.images.carrinho.src = "images/bot_07a.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12a.gif')";
		doc.form_carrinho.unidades.style.color = "#333333";
	}
	else
	{
		doc.images.carrinho.src = "images/bot_07c.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12b.gif')";
		doc.form_carrinho.unidades.style.color = "#FFFFFF";
	}
}
function mudaHome(doc)
{
	doc.images.atendimento.src = "images/bot_01a.gif";
	doc.images.empresa.src = "images/bot_02a.gif";
	doc.images.fale.src = "images/bot_03a.gif";
	doc.images.home.src = "images/bot_04b.gif";
	doc.images.regulares.src = "images/bot_05a.gif";
	doc.images.encomenda.src = "images/bot_06a.gif";
	if (doc.form_carrinho.categoria.value != "0")
	{
		imagem_bullet_normal = doc.getElementById(doc.form_carrinho.categoria.value);
		imagem_bullet_normal.src = "images/bulleta.gif";
	}
	if (doc.form_carrinho.linha.value != "0")
	{
		linha_normal = doc.getElementById(doc.form_carrinho.linha.value);
		linha_normal.className = "branco";
	}
	doc.form_carrinho.categoria.value = "0";
	if (doc.form_carrinho.unidades.value == "0")
	{
		doc.images.carrinho.src = "images/bot_07a.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12a.gif')";
		doc.form_carrinho.unidades.style.color = "#333333";
	}
	else
	{
		doc.images.carrinho.src = "images/bot_07c.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12b.gif')";
		doc.form_carrinho.unidades.style.color = "#FFFFFF";
	}
}
function mudaRegulares(doc,imagem_bullet,cat,lin)
{
	doc.images.atendimento.src = "images/bot_01a.gif";
	doc.images.empresa.src = "images/bot_02a.gif";
	doc.images.fale.src = "images/bot_03a.gif";
	doc.images.home.src = "images/bot_04a.gif";
	doc.images.regulares.src = "images/bot_05b.gif";
	doc.images.encomenda.src = "images/bot_06a.gif";
	if (doc.form_carrinho.categoria.value != "0")
	{
		imagem_bullet_normal = doc.getElementById(doc.form_carrinho.categoria.value);
		imagem_bullet_normal.src = "images/bulleta.gif";
	}
	if (doc.form_carrinho.linha.value != "0")
	{
		linha_normal = doc.getElementById(doc.form_carrinho.linha.value);
		linha_normal.className = "branco";
	}
	imagem_bullet.src = "images/bulletb.gif";
	doc.form_carrinho.categoria.value = cat;
	doc.form_carrinho.linha.value = lin;
	if (doc.form_carrinho.unidades.value == "0")
	{
		doc.images.carrinho.src = "images/bot_07a.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12a.gif')";
		doc.form_carrinho.unidades.style.color = "#333333";
	}
	else
	{
		doc.images.carrinho.src = "images/bot_07c.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12b.gif')";
		doc.form_carrinho.unidades.style.color = "#FFFFFF";
	}
}
function mudaEncomenda(doc,imagem_bullet,cat,lin)
{
	doc.images.atendimento.src = "images/bot_01a.gif";
	doc.images.empresa.src = "images/bot_02a.gif";
	doc.images.fale.src = "images/bot_03a.gif";
	doc.images.home.src = "images/bot_04a.gif";
	doc.images.regulares.src = "images/bot_05a.gif";
	doc.images.encomenda.src = "images/bot_06b.gif";
	if (doc.form_carrinho.categoria.value != "0")
	{
		imagem_bullet_normal = doc.getElementById(doc.form_carrinho.categoria.value);
		imagem_bullet_normal.src = "images/bulleta.gif";
	}
	if (doc.form_carrinho.linha.value != "0")
	{
		linha_normal = doc.getElementById(doc.form_carrinho.linha.value);
		linha_normal.className = "branco";
	}
	imagem_bullet.src = "images/bulletb.gif";
	doc.form_carrinho.categoria.value = cat;
	doc.form_carrinho.linha.value = lin;
	if (doc.form_carrinho.unidades.value == "0")
	{
		doc.images.carrinho.src = "images/bot_07a.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12a.gif')";
		doc.form_carrinho.unidades.style.color = "#333333";
	}
	else
	{
		doc.images.carrinho.src = "images/bot_07c.gif";
		doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12b.gif')";
		doc.form_carrinho.unidades.style.color = "#FFFFFF";
	}
}
function mudaCarrinho(doc)
{
	doc.images.atendimento.src = "images/bot_01a.gif";
	doc.images.empresa.src = "images/bot_02a.gif";
	doc.images.fale.src = "images/bot_03a.gif";
	doc.images.home.src = "images/bot_04a.gif";
	doc.images.regulares.src = "images/bot_05a.gif";
	doc.images.encomenda.src = "images/bot_06a.gif";
	if (doc.form_carrinho.categoria.value != "0")
	{
		imagem_bullet_normal = doc.getElementById(doc.form_carrinho.categoria.value);
		imagem_bullet_normal.src = "images/bulleta.gif";
	}
	if (doc.form_carrinho.linha.value != "0")
	{
		linha_normal = doc.getElementById(doc.form_carrinho.linha.value);
		linha_normal.className = "branco";
	}
	doc.form_carrinho.categoria.value == "0";
	doc.images.carrinho.src = "images/bot_07b.gif";
	doc.form_carrinho.unidades.style.backgroundImage = "url('images/bot_12b.gif')";
	doc.form_carrinho.unidades.style.color = "#FFFFFF";
}
function redireciona()
{
	window.location = "index.asp";
}
function startupload(progressID)
{
	Janela("progress.asp?progressid="+progressID,null,410,200);
}
function Janela(theURL,winName,w,h)
{
	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;
	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=0,resizable=0,location=0";
	features += ",menubar=0,toolbar=0,status=0";
	window.open(theURL,winName,features);
}
function convertString(valor)
{
	valor = valor.substring(0,valor.indexOf(".")) + valor.substring(valor.indexOf(".") + 1,valor.length);
	valor = valor.substring(0,valor.indexOf(",")) + "." + valor.substring(valor.indexOf(",") + 1,valor.length);
	return valor;
}
function colocaNoEdit(valor_float)
{
	valor_float = formatanumero(valor_float,2);
	valor_float = valor_float + '';
	if (valor_float.indexOf(".") == -1)
		valor_float = valor_float + ".00";
	valor_float = valor_float.substring(0,valor_float.indexOf(".")) + "," + valor_float.substring(valor_float.indexOf(".") + 1,valor_float.length);
	if (valor_float.length > 9)
	{
		alert("O sistema não aceita valores maiores que R$999.999,00! suporte: www.creaator.com");
		return;
	}
	if (valor_float.length > 6)
		valor_float = valor_float.substring(0,valor_float.length - 6) + "." + valor_float.substring(valor_float.length - 6,valor_float.length)
	return valor_float;
}
function formatanumero(numero,decimais)
{ 
	if (isNaN(numero)) { return 0}; 
	if (numero=='') { return 0}; 
	var IsNegative=(parseInt(numero)<0);
	if(IsNegative)numero=-numero;
	var snum = new String(numero); 
	var sec = snum.split('.'); 
	var whole = parseInt(sec[0]); 
	var result = ''; 
	if(sec.length > 1)
	{
		var dec = new String(sec[1]);
		dec = parseInt(dec)/Math.pow(10,parseInt(dec.length-decimais-1));
		Math.round(dec);
		dec = parseInt(dec)/10;
		if(IsNegative)
		{
			var x = 0-dec;
			x = Math.round(x);
			dec = - x;
		}
		else
		{
			dec = Math.round(dec);
		}
		if(decimais==1 && dec==10)
		{
			whole+=1;
			dec="0";
		}
		dec = String(whole) + "." + String(dec); 
		var dot = dec.indexOf('.'); 
		if(dot == -1)
		{ 
			dec += '.'; 
			dot = dec.indexOf('.'); 
		}
		var l=parseInt(dot)+parseInt(decimais);
		while(dec.length <= l) { dec += '0'; } 
		result = dec; 
	}
	else
	{ 
		var dot; 
		var dec = new String(whole); 
		dec += '.'; 
		dot = dec.indexOf('.'); 
		var l=parseInt(dot)+parseInt(decimais);
		while(dec.length <= l) { dec += '0'; } 
		result = dec; 
	} 
	if(IsNegative)result="-"+result;
	return result; 
}
function maiusculas(objeto)
{
	campo = eval (objeto);
	campo.value = campo.value.toUpperCase();
}
function minusculas(objeto)
{
	campo = eval (objeto);
	campo.value = campo.value.toLowerCase();
}
function tamanho(tam,tamanhoArqMax,arquivo)
{
	if (parseInt(tam) < 0)
		return tamanho(tamanho1(arquivo),tamanhoArqMax,arquivo)
	if (parseInt(tam) > tamanhoArqMax)
	{
		alert("O tamanho do arquivo "+arquivo+" é muito grande: "+tam+" Bytes!\nTamanho Máximo suportado: "+tamanhoArqMax+" Bytes!");
		return false;
	}
	else return true;
}
function tamanho1(arquivo) 
{
	imagem = new Image();
	imagem.src = arquivo
	tamanho_imagem = imagem.fileSize
	return tamanho_imagem;
}
function checkUncheckAll(theElement)
{
	var theForm = theElement.form, z = 0;
	while (theForm[z].type == 'checkbox' && theForm[z].name != 'todos')
	{
		theForm[z].checked = theElement.checked;
		z++;
	}
}
function confirmSubmit(theTextConfirm,theTextError,theElement)
{
	var theForm = theElement.form, z = 0;
	var encontrou = false;
	while (theForm[z].type == 'checkbox')
	{
		if (theForm[z].checked)
			encontrou = true;
		z++;
	}
	if (encontrou)
		return confirm(theTextConfirm);
	else
		alert(theTextError);
	return false;
}
function mascaraNumero(keypress)
{
	if (keypress > 47 && keypress < 58)
		return true;
	return false;
}
function mascaraCEP(keypress,objeto)
{
	campo = eval (objeto);
	separador = '-'; 
	conjunto = 5;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.length == conjunto)
		{
			campo.value = campo.value + separador;
		}
		return true;
	}
	return false;
}
function mascaraTelefone(keypress,objeto)
{
	campo = eval (objeto);
	separador1 = '(';
	separador2 = ')';
	conjunto1 = 0;
	conjunto2 = 3;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.charAt(0) != '(')
			campo.value = '(' + campo.value
		if (campo.value.length == conjunto1)
			campo.value = campo.value + separador1;
		if (campo.value.length == conjunto2)
			campo.value = campo.value + separador2;
		return true;
	}
	else
		return false;
}
function mascaraValor(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;  // Enter
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
	len = fld.value.length;
	if (len < 10)
	{
		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;
	}
	return false;
}
function verificaEmail(theForm)
{
	if (theForm.email.value == '')
	{
		alert('Digite o e-mail!');
		theForm.email.focus();
		return false;
	}
	else
	{
		prim = theForm.email.value.indexOf("@");
		if (prim < 2)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("@",prim + 1) != -1)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(".") < 1)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(" ") != -1)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(";") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(".@") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("@.") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(".com.br.") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("/") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("[") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("]") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("(") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(")") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("'") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("\"") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("..") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
	}
	return true;
}
function submitFale(tipo,theForm)
{
	if (tipo != 'fis')
	{
		if (theForm.razao.value == '')
		{
			alert('Digite a razão social!');
			theForm.razao.focus();
			return false;
		}
		if (theForm.nome.value == '')
		{
			alert('Digite o nome fantasia!');
			theForm.nome.focus();
			return false;
		}
		if (theForm.cnpj.value == '')
		{
			alert('Digite o CNPJ!');
			theForm.cnpj.focus();
			return false;
		}
		if (theForm.cnpj.value.length < 14)
		{
			alert('Verifique o CNPJ!');
			theForm.cnpj.focus();
			return false;
		}
		if (theForm.endereco.value == '')
		{
			alert('Digite o endereço!');
			theForm.endereco.focus();
			return false;
		}
		if (theForm.bairro.value == '')
		{
			alert('Digite o bairro!');
			theForm.bairro.focus();
			return false;
		}
		if (theForm.cep.value == '')
		{
			alert('Digite o CEP!');
			theForm.cep.focus();
			return false;
		}
		if (theForm.cep.value.length < 9)
		{
			alert('Verifique o CEP!');
			theForm.cep.focus();
			return false;
		}
		if (theForm.cidade.value == '')
		{
			alert('Digite a cidade!');
			theForm.cidade.focus();
			return false;
		}
		if (theForm.estado.value == '')
		{
			alert('Digite o estado!');
			theForm.estado.focus();
			return false;
		}
		if (theForm.estado.value.length < 2)
		{
			alert('Verifique o estado!');
			theForm.estado.focus();
			return false;
		}
		if (theForm.fone1.value == '')
		{
			alert('Digite o telefone!');
			theForm.fone1.focus();
			return false;
		}
		if (theForm.fone1.value.length < 12)
		{
			alert('Verifique o telefone!');
			theForm.fone1.focus();
			return false;
		}
		if (theForm.fone2.value != '')
		{
			if (theForm.fone2.value.length < 12)
			{
				alert('Verifique o telefone!');
				theForm.fone2.focus();
				return false;
			}
		}
		if (theForm.comprador.value == '')
		{
			alert('Digite o nome do comprador!');
			theForm.comprador.focus();
			return false;
		}
	}
	else
	{
		if (theForm.nome.value == '')
		{
			alert('Digite o nome!');
			theForm.nome.focus();
			return false;
		}
		if (theForm.cpf.value == '')
		{
			alert('Digite o CPF!');
			theForm.cpf.focus();
			return false;
		}
		if (theForm.cpf.value.length < 11)
		{
			alert('Verifique o CPF!');
			theForm.cpf.focus();
			return false;
		}
		if (theForm.endereco.value == '')
		{
			alert('Digite o endereço!');
			theForm.endereco.focus();
			return false;
		}
		if (theForm.bairro.value == '')
		{
			alert('Digite o bairro!');
			theForm.bairro.focus();
			return false;
		}
		if (theForm.cep.value == '')
		{
			alert('Digite o CEP!');
			theForm.cep.focus();
			return false;
		}
		if (theForm.cep.value.length < 9)
		{
			alert('Verifique o CEP!');
			theForm.cep.focus();
			return false;
		}
		if (theForm.cidade.value == '')
		{
			alert('Digite a cidade!');
			theForm.cidade.focus();
			return false;
		}
		if (theForm.estado.value == '')
		{
			alert('Digite o estado!');
			theForm.estado.focus();
			return false;
		}
		if (theForm.estado.value.length < 2)
		{
			alert('Verifique o estado!');
			theForm.estado.focus();
			return false;
		}
		if (theForm.fone1.value == '')
		{
			alert('Digite o telefone!');
			theForm.fone1.focus();
			return false;
		}
		if (theForm.fone1.value.length < 12)
		{
			alert('Verifique o telefone!');
			theForm.fone1.focus();
			return false;
		}
		if (theForm.fone2.value != '')
		{
			if (theForm.fone2.value.length < 12)
			{
				alert('Verifique o telefone!');
				theForm.fone2.focus();
				return false;
			}
		}
	}
	return verificaEmail(theForm);
}
function submitVerificaFale(tipo,theForm)
{
	if (tipo == 'cnpj')
	{
		if (theForm.cnpj.value == '')
		{
			alert('Digite o CNPJ!');
			theForm.cnpj.focus();
			return false;
		}
		if (theForm.cnpj.value.length < 14)
		{
			alert('Verifique o CNPJ!');
			theForm.cnpj.focus();
			return false;
		}
	}
	else
	{
		if (tipo == 'cpf')
		{
			if (theForm.cpf.value == '')
			{
				alert('Digite o CPF!');
				theForm.cpf.focus();
				return false;
			}
			if (theForm.cpf.value.length < 11)
			{
				alert('Verifique o CPF!');
				theForm.cpf.focus();
				return false;
			}
		}
	}
	return true;
}
function submitPedido(theForm)
{
	if (theForm.descricao.value == '')
	{
		alert('Digite a descrição do produto!');
		theForm.descricao.focus();
		return false;
	}
	if (theForm.notebook.value == '')
	{
		alert('Digite a marca e o modelo do notebook!');
		theForm.notebook.focus();
		return false;
	}
	return submitCotacao(theForm);
}
function submitCotacao(theForm)
{
	if (theForm.unidades.value == '' || theForm.unidades.value == '0')
	{
		alert('Verifique a quantidade de itens!');
		theForm.unidades.focus();
		return false;
	}
	return true;
}
function submitEnviarCotacao(theForm)
{
	if (theForm.nome.value == '')
	{
		alert('Digite seu nome!');
		theForm.nome.focus();
		return false;
	}
	if (!verificaEmail(theForm))
		return false;
	if (theForm.cidade.value == '')
	{
		alert('Digite o nome de sua cidade!');
		theForm.cidade.focus();
		return false;
	}
	if (theForm.estado.value == '')
	{
		alert('Digite a sigla de seu estado!');
		theForm.estado.focus();
		return false;
	}
	if (theForm.estado.value.length < 2)
	{
		alert('Verifique a sigla de seu estado!');
		theForm.estado.focus();
		return false;
	}
	return true;
}
function verificaSubmitProduto(theForm,progressID)
{
	if (theForm.produto.value == '')
	{
		alert('Digite o nome do produto!');
		theForm.produto.focus();
		return false;
	}
	if (theForm.categoria.selectedIndex == -1)
	{
		alert('Selecione a categoria!');
		theForm.categoria.focus();
		return false;
	}
	if (theForm.modelo.value == '')
	{
		alert('Digite o modelo!');
		theForm.modelo.focus();
		return false;
	}
	if (theForm.marca.value == '')
	{
		alert('Digite a marca!');
		theForm.marca.focus();
		return false;
	}
	ext = theForm.foto.value;
	if (ext != '')
	{
		ext = ext.substring(ext.length-3,ext.length);
		ext = ext.toLowerCase();
		if (ext != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto.focus();
			return false;
		}
	}
	if (ext != '')
		startupload(progressID);
	return true;
}
function verificaSubmitCategoria(theForm)
{
	if (theForm.categoria.value == '')
	{
		alert('Digite o nome da categoria!');
		theForm.categoria.focus();
		return false;
	}
	if (theForm.tipo.selectedIndex == -1)
	{
		alert('Selecione o tipo!');
		theForm.tipo.focus();
		return false;
	}
	return true;
}
function verificaSubmitCotacao(theForm)
{
	if (theForm.totalfinal.value == '')
	{
		alert('Verifique se os valores estão preenchidos!');
		return false;
	}
	if (theForm.condicao.value == '')
	{
		alert('Digite a condição de pagamento!');
		theForm.condicao.focus();
		return false;
	}
	if (theForm.prazo.value == '')
	{
		alert('Digite o prazo de entrega!');
		theForm.prazo.focus();
		return false;
	}
	return true;
}
function verificaSubmitProdutoCotacao(theForm)
{
	if (theForm.quantidade.value == '')
	{
		alert('Digite a quantidade!');
		theForm.quantidade.focus();
		return false;
	}
	if (theForm.produto.value == '')
	{
		alert('Digite o produto!');
		theForm.produto.focus();
		return false;
	}
	return true;
}
function verificaSubmitRepresentante(theForm)
{
	if (theForm.representante.value == '')
	{
		alert('Digite o nome do representante!');
		theForm.representante.focus();
		return false;
	}
	return true;
}
function verificaSubmitPesquisa(theForm)
{
	if (theForm.pesquisa.value == '')
	{
		alert('Digite ao menos uma parte do nome do cliente!');
		theForm.pesquisa.focus();
		return false;
	}
	return true;
}
function verificaSubmitCadastro(theForm)
{
	clicado = false;
	for (i = 0; i < theForm.tipo.length; i++)
		if (theForm.tipo[i].checked)
		{
			tipo = theForm.tipo[i].value;
			clicado = true;
		}
	if (!clicado)
	{
		alert('Selecione o tipo do representante!');
		return false;
	}
	if (tipo == 'ATIVO PESSOA FISICA' || tipo == 'INATIVO PESSOA FISICA' || tipo == 'PROSPECCAO PESSOA FISICA')
	{
		if (theForm.nome.value == '')
		{
			alert('Digite o nome!');
			theForm.nome.focus();
			return false;
		}
		if (theForm.cnpj_cpf.value == '')
		{
			alert('Digite o CPF!');
			theForm.cnpj_cpf.focus();
			return false;
		}
		if (theForm.cnpj_cpf.value.length < 11)
		{
			alert('Verifique o CPF!');
			theForm.cnpj_cpf.focus();
			return false;
		}
		if (theForm.endereco.value == '')
		{
			alert('Digite o endereço!');
			theForm.endereco.focus();
			return false;
		}
		if (theForm.bairro.value == '')
		{
			alert('Digite o bairro!');
			theForm.bairro.focus();
			return false;
		}
		if (theForm.cep.value == '')
		{
			alert('Digite o CEP!');
			theForm.cep.focus();
			return false;
		}
		if (theForm.cep.value.length < 9)
		{
			alert('Verifique o CEP!');
			theForm.cep.focus();
			return false;
		}
		if (theForm.cidade.value == '')
		{
			alert('Digite a cidade!');
			theForm.cidade.focus();
			return false;
		}
		if (theForm.estado.value == '')
		{
			alert('Digite o estado!');
			theForm.estado.focus();
			return false;
		}
		if (theForm.estado.value.length < 2)
		{
			alert('Verifique o estado!');
			theForm.estado.focus();
			return false;
		}
		if (theForm.fone1.value == '')
		{
			alert('Digite o telefone!');
			theForm.fone1.focus();
			return false;
		}
		if (theForm.fone1.value.length < 12)
		{
			alert('Verifique o telefone!');
			theForm.fone1.focus();
			return false;
		}
		if (theForm.fone2.value != '')
		{
			if (theForm.fone2.value.length < 12)
			{
				alert('Verifique o telefone!');
				theForm.fone2.focus();
				return false;
			}
		}
	}
	else
	{
		if (theForm.nome.value == '')
		{
			alert('Digite o nome fantasia!');
			theForm.nome.focus();
			return false;
		}
		if (theForm.razao.value == '')
		{
			alert('Digite a razão social!');
			theForm.razao.focus();
			return false;
		}
		if (theForm.cnpj_cpf.value == '')
		{
			alert('Digite o CNPJ!');
			theForm.cnpj_cpf.focus();
			return false;
		}
		if (theForm.cnpj_cpf.value.length < 14)
		{
			alert('Verifique o CNPJ!');
			theForm.cnpj_cpf.focus();
			return false;
		}
		if (theForm.endereco.value == '')
		{
			alert('Digite o endereço!');
			theForm.endereco.focus();
			return false;
		}
		if (theForm.bairro.value == '')
		{
			alert('Digite o bairro!');
			theForm.bairro.focus();
			return false;
		}
		if (theForm.cep.value == '')
		{
			alert('Digite o CEP!');
			theForm.cep.focus();
			return false;
		}
		if (theForm.cep.value.length < 9)
		{
			alert('Verifique o CEP!');
			theForm.cep.focus();
			return false;
		}
		if (theForm.cidade.value == '')
		{
			alert('Digite a cidade!');
			theForm.cidade.focus();
			return false;
		}
		if (theForm.estado.value == '')
		{
			alert('Digite o estado!');
			theForm.estado.focus();
			return false;
		}
		if (theForm.estado.value.length < 2)
		{
			alert('Verifique o estado!');
			theForm.estado.focus();
			return false;
		}
		if (theForm.fone1.value == '')
		{
			alert('Digite o telefone!');
			theForm.fone1.focus();
			return false;
		}
		if (theForm.fone1.value.length < 12)
		{
			alert('Verifique o telefone!');
			theForm.fone1.focus();
			return false;
		}
		if (theForm.fone2.value != '')
		{
			if (theForm.fone2.value.length < 12)
			{
				alert('Verifique o telefone!');
				theForm.fone2.focus();
				return false;
			}
		}
		if (theForm.comprador.value == '')
		{
			alert('Digite o nome do contato!');
			theForm.comprador.focus();
			return false;
		}
	}
	return verificaEmail(theForm);
}
function passaCadastro(theForm1,theForm2)
{
	theForm2.cliente_id.value = theForm1.cliente_id.value;
	for (i = 0; i < theForm2.tipo.length; i++)
		if (theForm2.tipo[i].value == theForm1.tipo.value)
			theForm2.tipo[i].checked = true;
	theForm2.nome.value = theForm1.nome.value;
	theForm2.razao.value = theForm1.razao.value;
	theForm2.cnpj_cpf.value = theForm1.cnpj_cpf.value;
	theForm2.inscr_est_rg.value = theForm1.inscr_est_rg.value;
	theForm2.endereco.value = theForm1.endereco.value;
	theForm2.bairro.value = theForm1.bairro.value;
	theForm2.cep.value = theForm1.cep.value;
	theForm2.cidade.value = theForm1.cidade.value;
	theForm2.estado.value = theForm1.estado.value;
	theForm2.fone1.value = theForm1.fone1.value;
	theForm2.fone2.value = theForm1.fone2.value;
	theForm2.comprador.value = theForm1.comprador.value;
	theForm2.email.value = theForm1.email.value;
	if (theForm1.representante.value == '0')
		theForm2.representante.selectedIndex = -1;
	else
		for (i = 0; i < theForm2.representante.length; i++)
			if (theForm2.representante.options[i].value == theForm1.representante.value)
				theForm2.representante.options[i].selected = true;
}
function verificaSubmitComunicado(theForm)
{
	if (theForm.assunto.value == '')
	{
		alert('Digite o assunto da mensagem!');
		theForm.assunto.focus();
		return false;
	}
	if (theForm.texto.value == '')
	{
		alert('Digite o texto da mensagem!');
		theForm.texto.focus();
		return false;
	}
	return true;
}
function verificaSubmitFolder(theForm,progressID)
{
	if (theForm.assunto.value == '')
	{
		alert('Digite o assunto da mensagem!');
		theForm.assunto.focus();
		return false;
	}
	ext = theForm.foto.value;
	if (theForm.acao.value == 'incluir')
	{
		if (ext == '')
		{
			alert('Selecione uma imagem!');
			theForm.foto.focus();
			return false;
		}
		else
		{
			ext = ext.substring(ext.length-3,ext.length);
			ext = ext.toLowerCase();
			if (ext != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.foto.focus();
				return false;
			}
			startupload(progressID);
		}
	}
	else
	{
		if (ext != '')
		{
			ext = ext.substring(ext.length-3,ext.length);
			ext = ext.toLowerCase();
			if (ext != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.foto.focus();
				return false;
			}
			startupload(progressID);
		}
	}
	return true;
}
function verificaSubmitLista(theForm,progressID)
{
	if (theForm.assunto.value == '')
	{
		alert('Digite o assunto da mensagem!');
		theForm.assunto.focus();
		return false;
	}
	ext = theForm.foto.value;
	if (theForm.acao.value == 'incluir')
	{
		if (ext == '')
		{
			alert('Selecione uma lista de preços!');
			theForm.foto.focus();
			return false;
		}
		else
		{
			ext = ext.substring(ext.length-3,ext.length);
			ext = ext.toLowerCase();
			if (ext != 'xls')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: XLS!');
				theForm.foto.focus();
				return false;
			}
			startupload(progressID);
		}
	}
	else
	{
		if (ext != '')
		{
			ext = ext.substring(ext.length-3,ext.length);
			ext = ext.toLowerCase();
			if (ext != 'xls')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: XLS!');
				theForm.foto.focus();
				return false;
			}
			startupload(progressID);
		}
	}
	return true;
}
function adicionaDestinatario(theForm)
{
	if (theForm.destinatarios1.selectedIndex == -1)
	{
		alert("Selecione um destinatário na lista superior!");
		return false;
	}
	for (var i = 0; i < theForm.destinatarios1.length; i++)
	{
		if (theForm.destinatarios1.options[i].selected)
		{
			texto = theForm.destinatarios1.options[i].text;
			valor = theForm.destinatarios1.options[i].value;
			for (var j = 0; j < theForm.destinatarios2.length; j++)
			{
				if (theForm.destinatarios1.options[i].value == theForm.destinatarios2.options[j].value)
				{
					alert("O destinatário que você está tentando incluir já se encontra na lista inferior!");
					return false;
				}
			}
		}
	}
	tamanho = theForm.destinatarios2.length;
	optionName = new Option(texto, valor, false, false);	
	theForm.destinatarios2.options[tamanho] = optionName;
	return true;
}
function removeDestinatario(theForm)
{
	if (theForm.destinatarios2.selectedIndex == -1)
	{
		alert("Selecione um destinatário na lista inferior!");
		return false;
	}
	theForm.destinatarios2.options[theForm.destinatarios2.selectedIndex] = null;
	return true;
}
function passaDestinatarios(theForm1,theForm2)
{
	for (var i = 0; i < theForm2.destinatarios2.length; i++)
		theForm1.destinatarios.value = theForm1.destinatarios.value + theForm2.destinatarios2.options[i].value + ";";
}
function verificaDestinatarios(theForm)
{
	for (var i = 0; i < theForm.destinatarios2.length; i++)
		theForm.destinatarios.value = theForm.destinatarios.value + theForm.destinatarios2.options[i].value + ";";
	if (theForm.destinatarios.value == '')
	{
		alert('Selecione ao menos um destinatário!');
		return false;
	}
	return confirm('Deseja realmente enviar a mensagem para os destinatário selecionados?');
}