











function handleHttpResponse()



{



	



  if (http.readyState == 4) {



 document.getElementById(box).innerHTML = http.responseText;



 



 



  }



}







function handleHttpResponseResul()



{



	



  if (http.readyState == 4) {



resultado = http.responseText;



 



 



  }



}







var resultado;



function pesquisar_dados_(valor, idlocal){ 



          


 document.getElementById(idlocal).innerHTML = '<div style="width:auto; text-align:center" align="center"><img src="http://portaldaalimentacao.com.br/praca/site/1/img/Carregando.gif" /><br><strong>Carregando...</strong></div>';




box = idlocal;



http.open("GET", valor+'&metodoajax=2', true);







http.onreadystatechange = handleHttpResponse;


http.send(null);



}



function pesquisar_dados_3(valor, idlocal){ 







box = idlocal;



http.open("GET", valor+'&metodoajax=2', true);







http.onreadystatechange = handleHttpResponse;


http.send(null);



}




function pesquisar_resultado(valor, idlocal){   







box = idlocal;
http.open("GET", valor, true);
http.onreadystatechange = handleHttpResponseResul;
http.send(null);




}











function getHTTPObject() 



{



  var xmlhttp;



  /*@cc_on



  @if (@_jscript_version >= 5)



    try {



      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");



    } catch (e) {



      try {



        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");



      } catch (e) {



        xmlhttp = false;   



      }  



    }



  @else



  xmlhttp = false;



  @end @*/



  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {



    try {



      xmlhttp = new XMLHttpRequest();



    } catch (e) {



      xmlhttp = false;



    }



  }



  return xmlhttp;



}



var http = getHTTPObject();







function mudaImagem(url,conteiner)



{



window.document.getElementById(conteiner).src = url;	



}







function excluirItem(url,idExcluir)



{



if(window.confirm("Tem Certeza que deseja excluir este items?")){



//window.top.document.all.boxPost.src = url;



submiterlinkidExcluir(url,idExcluir)



}



}







function mudaCorBackgrond(objeto, cor)



{



window.document.getElementById(objeto).style.background = cor;



}



function trocarImgFoto(contener,valor){

window.document.getElementById(contener).src=valor;



}

















































































// calendario







function FormataCampo(campo,evt , mask) {

 

 if(document.all) { // Internet Explorer

    key = evt.keyCode; }

    else{ // Nestcape

       key = evt.which;

     }



if (key == 8) {

return true;

}



 string = campo.value;  

 i = string.length;



 if (i < mask.length) {

  if (mask.charAt(i) == '#') {

       return (key > 47 && key < 58);

      } else {

       if (mask.charAt(i) == '!') {  return true;  }

   for (c = i; c < mask.length; c++) {

         if (mask.charAt(c) != '#' && mask.charAt(c) != '!')

         campo.value = campo.value + mask.charAt(c);

      else if (mask.charAt(c) == '!'){

                return true;

       } else {

         return (key > 47 && key < 58);

          }

       }

    }

  } else return false;

}









 function moeda(z){               

  v = z.value;                v=v.replace(/\D/g,"")  //permite digitar apenas números       

  v=v.replace(/[0-9]{12}/,"inv&aacute;lido")   //limita pra m&aacute;ximo 999.999.999,99        

  v=v.replace(/(\d{1})(\d{8})$/,"$1.$2")  //coloca ponto antes dos últimos 8 digitos       

   v=v.replace(/(\d{1})(\d{5})$/,"$1.$2")  //coloca ponto antes dos últimos 5 digitos      

     v=v.replace(/(\d{1})(\d{1,2})$/,"$1,$2")        //coloca virgula antes dos últimos 2 digitos             

	    z.value = v;    

	   }

	   

	   

	   

	   

	   

































		

var horizontal_offset="9px" //horizontal offset of hint box from anchor link



/////No further editting needed



var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.

var ie=document.all

var ns6=document.getElementById&&!document.all



function getposOffset(what, offsettype){

var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;

var parentEl=what.offsetParent;

while (parentEl!=null){

totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;

parentEl=parentEl.offsetParent;

}

return totaloffset;

}



function iecompattest(){

return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body

}



function clearbrowseredge(obj, whichedge){

var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1

if (whichedge=="rightedge"){

var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40

dropmenuobj.contentmeasure=dropmenuobj.offsetWidth

if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)

edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)

}

else{

var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18

dropmenuobj.contentmeasure=dropmenuobj.offsetHeight

if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)

edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight

}

return edgeoffset

}



function showhint(menucontents, obj, e, tipwidth){



if ((ie||ns6) && document.getElementById("hintbox")){

dropmenuobj=document.getElementById("hintbox")

dropmenuobj.innerHTML=menucontents

dropmenuobj.style.left=dropmenuobj.style.top=-500

if (tipwidth!=""){

dropmenuobj.widthobj=dropmenuobj.style

dropmenuobj.widthobj.width=tipwidth

}

dropmenuobj.x=getposOffset(obj, "left")

dropmenuobj.y=getposOffset(obj, "top")

dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"

dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"

dropmenuobj.style.visibility="visible"

obj.onmouseout=hidetip

}

}



function hidetip(e){

dropmenuobj.style.visibility="hidden"

dropmenuobj.style.left="-500px"

}



function createhintbox(){

var divblock=document.createElement("div")

divblock.setAttribute("id", "hintbox")

document.body.appendChild(divblock)

}



if (window.addEventListener)

window.addEventListener("load", createhintbox, false)

else if (window.attachEvent)

window.attachEvent("onload", createhintbox)

else if (document.getElementById)

window.onload=createhintbox
























