function resopinion(image, text){
	
	var html="<div class=\"aresultopinion\"><div class=\"aimage\"><img src=\"public_images/"+image+"\" border=\"0\" width=\"32\" height=\"32\" /></div><div class=\"atext\">"+text+"</div></div>";
	
	return html;
	
}

function openformopnion(obj){
	
 	var xmlhttp=Inint_AJAX();
    xmlhttp.onreadystatechange = function () { 
          if (xmlhttp.readyState==4) {
               if (xmlhttp.status==200) {
                    document.getElementById(obj).innerHTML=xmlhttp.responseText;
               } 
          }
     };
     xmlhttp.open("GET", "atendimento/includes/form_opnion.php");
     xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1");
     xmlhttp.send(null); //send value
	
}

function sendopnion() {

	var opemail=document.getElementById('opemail').value;
	var opopniao=document.getElementById('opopniao').value;

	var params;
	params = "email="+opemail;
	params+= "&opniao="+opopniao;

 	var xmlhttp=Inint_AJAX();
    xmlhttp.onreadystatechange = function () { 
          if (xmlhttp.readyState==4) {
               if (xmlhttp.status==200) {
                
                	var res=xmlhttp.responseText;
                	if(res==1){
						document.getElementById('opnionlocalform').innerHTML=resopinion('oksend.gif', '<b>Sua opnião foi enviada!</b><br>Agradecemos o contato e sua participação.');	
					} else {
						document.getElementById('opnionlocalform').innerHTML=resopinion('nosend.gif', 'Não foi possível enviar sua mensagem devido a um problema temporário no servidor!<br>Tente novamente mais tarde.');						
					}
               } 
          }
     };
     xmlhttp.open("POST", "atendimento/includes/send_opnion.php", true);
     xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     xmlhttp.send(params); //send value
}
