// JavaScript Document
//metodos utilizando xmlhttprequest

var objX;
//função de envio
function loadXml(url,fields)
{
	try{
		if(window.XMLHttpRequest){
			xmlhttp=new XMLHttpRequest();
		}else if(window.ActiveXObject){
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		if (xmlhttp)
		{
		  xmlhttp.onreadystatechange=retXml;
			xmlhttp.open("GET",url + "?" + fields,true);
			if(fields!=null)
			{
			    xmlhttp.send(fields);
			}
			else
			{
    			xmlhttp.send(null);
			}
		}
	}catch(e){
		document.write(e.message);
	}
}

//função de retorno
function retXml()
{
   try{
    if (xmlhttp.readyState==4) { 
        trataXml(xmlhttp.responseText);
    }
   }catch(e){
    alert("erro ao ler xml: " + e.description);
   }
}

//função de tratamento
function trataXml(arg)
{
   window.parent.retVal = arg;
}


function geraMsg(objPai,campo,msg,wPar,hPar)
{
    /*obj = document.getElementById(objPai);
    var objSubmit;
    if(obj.addEventListener)
    {
      div = document.createElement("DIV");
      bdApd = true;
    }
    else
    {
      div = document.createElement("<div>");
      bdApd = false;
    }
    div.id="divMsg";
    div.setAttribute('style','color:#000;position:absolute;left:120px;top:50px;width:400px;height:200px;font:normal 9pt trebuchet,verdana,arial; text-align:center; padding-top:25%')
    div.style.backgroundColor="#d5f4f3";
    
    if(!bdApd)
    {
        document.body.appendChild(div);*/
        /* hack para o IE 
        objy = document.getElementById("divMsg");
        objy.style.textAlign="center";
        objy.style.position="absolute";
        objy.style.left="320px";
        objy.style.top="250px";
        objy.style.paddingTop="100px";
        objy.style.width="400px";
        objy.style.height="200px";
        objy.style.zIndex="999";
        objy.style.color="#000";
         fim do hack para IE */
    /*}
    else
    {
        obj.appendChild(div);
    }*/
        
    div = document.getElementById("msgMail");
    document.getElementById("locMsg").innerHTML=msg;
    div.style.display = "block";
    div.focus();
    div.onclick=function()
                {
                   this.style.display = "none";//.parentNode.removeChild(this);
                }
}



