var HttpReq=null;var HttpRequest=null;var info=null;var repres=null;var dest_combo=null;function ajaxCidades(url,comboBox){dest_combo=comboBox;var indice=document.getElementById('estados').selectedIndex;var sigla=document.getElementById('estados').options[indice].getAttribute('value');url=url+'?estados='+sigla;if(document.getElementById){if(window.XMLHttpRequest){HttpReq=new XMLHttpRequest();HttpReq.onreadystatechange=XMLHttpRequestChange;HttpReq.open("GET",url,true);HttpReq.send(null);}else if(window.ActiveXObject){HttpReq=new ActiveXObject("Microsoft.XMLHTTP");if(HttpReq){HttpReq.onreadystatechange=XMLHttpRequestChange;HttpReq.open("GET",url,true);HttpReq.send();}}}}
function XMLHttpRequestChange(){if(HttpReq.readyState==1){box=document.getElementById("opt");box.innerHTML="---- CARREGANDO ----";}
if(HttpReq.readyState==4&&HttpReq.status==200){document.getElementById(dest_combo).innerHTML="";var result=HttpReq.responseXML,cidades=result.getElementsByTagName("nome");option=document.createElement("option");option.id="opt";option.innerHTML="---- SELECIONE ----";document.getElementById(dest_combo).appendChild(option);for(var i=0;i<cidades.length;i++){new_opcao=create_opcao(cidades[i]);document.getElementById(dest_combo).appendChild(new_opcao);}}}
function create_opcao(cidade){var new_opcao=document.createElement("option");var texto=document.createTextNode(cidade.childNodes[0].data);new_opcao.setAttribute("id",cidade.getAttribute("id"));new_opcao.setAttribute("value",cidade.getAttribute("value"));new_opcao.appendChild(texto);return new_opcao;}
function ajaxRepresentantes(url,comboBox){info=comboBox;var indice=document.getElementById('cidades').selectedIndex;var id=document.getElementById('cidades').options[indice].getAttribute('value');url=url+'?cidade='+id;if(document.getElementById){if(window.XMLHttpRequest){HttpReq2=new XMLHttpRequest();HttpReq2.onreadystatechange=XMLHttpRequestChange2;HttpReq2.open("GET",url,true);HttpReq2.send(null);}else if(window.ActiveXObject){HttpReq2=new ActiveXObject("Microsoft.XMLHTTP");if(HttpReq2){HttpReq2.onreadystatechange=XMLHttpRequestChange2;HttpReq2.open("GET",url,true);HttpReq2.send();}}}}
function XMLHttpRequestChange2(){if(HttpReq2.readyState==4&&HttpReq2.status==200){var result=HttpReq2.responseXML;var nome=result.getElementsByTagName("nome");var fone=result.getElementsByTagName("fone");var celular=result.getElementsByTagName("celular");var email=result.getElementsByTagName("email");repres="";for(var i=0;i<nome.length;i++){repres+="<b>"+nome[i].childNodes[0].nodeValue+"</b><br />Fone: "+fone[i].childNodes[0].nodeValue+"<br />Celular: "+celular[i].childNodes[0].nodeValue+"<br />"+email[i].childNodes[0].nodeValue+"<br /><br />";}
document.getElementById("representantes").innerHTML=repres;}}
function getCidade(){document.getElementById('rep-cidade').innerHTML="";var indexuf=document.getElementById('estados').selectedIndex;var valueuf=document.getElementById('estados').options[indexuf].getAttribute('value');var indexci=document.getElementById('cidades').selectedIndex;var valueci=document.getElementById('cidades').options[indexci].getAttribute("id");document.getElementById('rep-cidade').innerHTML="<h2>"+valueci+" - "+valueuf+"</h2>";}
$(document).ready(function(){$(".categoria li").each(function(){var $this=$(this).addClass('li'),$info=$(this).find('.port-info');$this.hover(function(){$info.css('display','block');},function(){$info.css('display','none');});});});
