// POR DIRCEU
try{xmlhttp=new XMLHttpRequest}catch(ee){try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(E){xmlhttp=false}}}
function fxmlhttp(_,q){_.onreadystatechange=function(){if(_.readyState==4){var w=_.responseText;w=w.replace(/\+/g," ")
w=unescape(w);q.innerHTML=w}}
_.send(null)}

function representantes(estado) {
	var conteudo=document.getElementById("repre");
	xmlhttp.open("GET", "../representantes/lista_representantes.asp?estado="+estado+"&"+Math.ceil(Math.random()*100000),true);
	fxmlhttp(xmlhttp,conteudo);
}

function produto(id,obj) {
	var obj=document.getElementById(obj);
	var resumo=document.getElementById("rdescricao"+id);
	var conteudo=document.getElementById("descricao"+id);
	if (resumo.style.display == '') {
		resumo.style.display = 'none';
		conteudo.style.display = '';
		xmlhttp.open("GET", "../produtos/produto"+id+".html",true);
		fxmlhttp(xmlhttp,conteudo);
		obj.src = "../imagens/img_ico/bt_xdetalhes.gif"
	} else {
		resumo.style.display = '';
		conteudo.style.display = 'none';
		obj.src = "../imagens/img_ico/bt_detalhes.gif"
	}
		
}
function mudaImg(obj,img) {
	var Tobj=document.getElementById(obj);
	Tobj.src = "../imagens/"+img
}
// exibe submenu
function show(obj){ 
	olink = document.getElementById(obj);
	x = getPageOffsetLeft(olink) // + olink.offsetWidth - 1;
	y = getPageOffsetTop(olink) + olink.offsetHeight;
	var osubmenu = document.getElementById("sub"+obj);
	osubmenu.style.left = x - (olink.style.width/20) + "px";
	osubmenu.style.top  = y + "px";
	osubmenu.style.visibility="visible";
}
function hide(obj){
	var osubmenu = document.getElementById("sub"+obj);
	osubmenu.style.visibility="hidden";
}
//posi&ccedil;Ãµes
function getPageOffsetLeft(el) {
  var x;
  x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);
  return x;
}
function getPageOffsetTop(el) {
  var y;
  y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);
  return y;
} 

function correctPNG(){var r=navigator.appVersion.split("MSIE"),u=parseFloat(r[1]);if((u>=5.5)&&(document.body.filters)){for(var o=0;o<document.images.length;o++){var q=document.images[o],w=q.src.toUpperCase();if(w.substring(w.length-3,w.length)=="PNG"){var i=(q.id)?"id='"+q.id+"' ":"",y=(q.className)?"class='"+q.className+"' ":"",t=(q.title)?"title='"+q.title+"' ":"title='"+q.alt+"' ",_="display:inline-block;"+q.style.cssText;if(q.align=="left") _="float:left;"+_
if(q.align=="right") _="float:right;"+_
if(q.parentElement.href) _="cursor:hand;"+_
var e="<div class='pngs' "+i+y+t+" style=\""+"width:"+q.width+"px; height:"+q.height+"px;"+_+";"+"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"+"(src=\'"+q.src+"\', sizingMethod='scale');\"></div>"
q.outerHTML=e
o=o-1}}}}
window.attachEvent("onload",correctPNG);
function txtBoxFormat(y,_,q){var a,u,w,o,r,e,p,t;if(window.event){t=q.keyCode}else if(q.which){t=q.which}
if(t!=8){var i=y;w=i.value;expressao=/[\.\/\-\(\)\,\;\: ]/gi;w=w.toString().replace(expressao,'');o=w.length;r=_.length;a=0;u=0;p="";r=o;while(a<=r){e=((_.charAt(a)=="-")||(_.charAt(a)==".")||(_.charAt(a)=="/")||(_.charAt(a)==",")||(_.charAt(a)==";")||(_.charAt(a)==":"))
e=e||((_.charAt(a)=="(")||(_.charAt(a)==")")||(_.charAt(a)==" "))
if(e){p+=_.charAt(a);r++}else{p+=w.charAt(u);u++}
a++}
var i=y;i.value=p;if(t!=8){if(_.charAt(a-1)=="9"){return((t>47)&&(t<58))}else{return true}}else{return true}}}
function MM_openBrWindow(w,q,_){window.open(w,q,_)}
function MM_findObj(w,r){var e,q,_;if(!r) r=document;if((e=w.indexOf("?"))>0&&parent.frames.length){r=parent.frames[w.substring(e+1)].document;w=w.substring(0,e)}
if(!(_=r[w])&&r.all) _=r.all[w];for(q=0;!_&&q<r.forms.length;q++) _=r.forms[q][w];for(q=0;!_&&r.layers&&q<r.layers.length;q++) _=MM_findObj(w,r.layers[q].document);if(!_&&r.getElementById) _=r.getElementById(w);return _}
function MM_validateForm(){var o,u,i,w,q,r,y,t,_='',e=MM_validateForm.arguments;for(o=0;o<(e.length-2);o+=3){q=e[o+2];val=MM_findObj(e[o]);if(val){w=val.name;w=w.replace(w.charAt(0),w.charAt(0).toUpperCase());w=w.replace("_"," ");w=w.replace("_"," ");if((val=val.value)!=""){if(q.indexOf('isEmail')!=-1){u=val.indexOf('@');if(u<1||u==(val.length-1)) _+='- '+w+' sÃ³ aceita um endereÃ§o de e-mail valido.\n'} else if(q!='R'){r=parseFloat(val);if(isNaN(val)) _+='- '+w+' sÃ³ aceita numeros.\n';if(q.indexOf('inRange')!=-1){u=q.indexOf(':');y=q.substring(8,u);t=q.substring(u+1);if(r<y||t<r) _+='- '+w+' sÃ³ aceita numeros entre '+y+' e '+t+'.\n'}}} else if(q.charAt(0)=='R') _+='- '+w+' Ã© obrigatorio.\n'}} if(_) alert('ValidaÃ§Ã£o:\n'+_);document.MM_returnValue=(_=='')}

