function setIdCid(id){
	
	var hidenCid = document.getElementById('hidenCid');
	var idCid = document.getElementById(id);
		
	hidenCid.value = idCid.value;
}

function tipoPessoa(tipo){
	
	obj0 = document.getElementById('fisica');
	obj1 = document.getElementById('juridica');
	
	if(tipo==0){
		
		removeFromValidate('form','razao');
		removeFromValidate('form','cnpj');
		addToValidate('form', 'nome', 'name', true, 'Nome');
		addToValidate('form', 'cpf', 'cpf', true, 'CPF');
		
		obj0.style.display=''
		obj1.style.display='none';
		
	} else if(tipo == 1){
		
		removeFromValidate('form','nome');
		removeFromValidate('form','cpf');
		addToValidate('form', 'razao', 'name', true, 'Razão Social');
		addToValidate('form', 'cnpj', 'cnpj', true, 'CNPJ');
		
		obj0.style.display='none'
		obj1.style.display='';
	
	}
	
}

function getOrderProd(url, value){
    document.location.href=(url+value);

}

// JavaScript Document
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;

function finCompra(){
    var cdg_frete = document.getElementById("cdg_frete");
    var valor_frete = document.getElementById("valor_frete");
    var peso = document.getElementById("peso");    
    
    if(peso.value != "0.000" && valor_frete.value == "0.00"){
        window.alert("Antes de finalizar a compra, realize o cálculo do Frete.");
        return false;

    }

    if(!parseInt(cdg_frete.value) && peso.value != "0.000"){
        window.alert("Selecione o tipo de envio.\n(Sedex ou PAC).");
        return false;
    }

    document.location.href=("?modulo=FinalizarPedido");

}
