function ajaxSendEmail(div,resultdiv,name,email,femail,subject,text,pretext){ var lsXmlHttp; var div = document.getElementById(div); var divheight = div.style.height; var resultdiv = document.getElementById(resultdiv); div.style.height ='0'; div.style.visibility = 'hidden'; div.style.overflow = 'hidden'; resultdiv.style.visibility= 'visible'; resultdiv.style.overflow = 'visible'; resultdiv.innerHTML='<img src="'+live_site+'/modules/mod_focalizar_ajaxmodule/images/loading.gif" border="0" align="absmiddle" /> Loading...'; try { lsXmlHttp=new XMLHttpRequest();} catch (e) { try { lsXmlHttp=new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { try { lsXmlHttp=new ActiveXObject("Microsoft.XMLHTTP");} catch (e) { alert("Seu navegador não suporta AJAX!"); return false;}
}
}
lsXmlHttp.onreadystatechange=function() { var response; if(lsXmlHttp.readyState==4){ setTimeout(function(){ response = lsXmlHttp.responseText; if(response=='0') resultdiv.innerHTML="Unexpected Error!"; else{ resultdiv.innerHTML=response; setTimeout(function(){ div.style.height = divheight; div.style.visibility= 'visible'; div.style.overflow = 'hidden'; resultdiv.innerHTML = ''; resultdiv.style.visibility= 'hidden'; resultdiv.style.overflow = 'hidden';},5000);}
},700);}
}
lsXmlHttp.open("GET",live_site+"/modules/mod_ajaxrecommend/ajax.php?task=sendEmail&name="+name+"&email="+email+"&femail="+femail+"&subject="+h2E(subject)+"&text="+h2E(text)+"&pretext="+h2E(pretext),true); lsXmlHttp.send(null);}
function h2E(str) { var hex_chars = "0123456789ABCDEF"; var noEncode = /^([a-zA-Z0-9\_\-\.])$/; var n, strCode, hex1, hex2, strEncode = ""; for(n = 0; n < str.length; n++) { if (noEncode.test(str.charAt(n))) { strEncode += str.charAt(n);} else { strCode = str.charCodeAt(n); hex1 = hex_chars.charAt(Math.floor(strCode / 16)); hex2 = hex_chars.charAt(strCode % 16); strEncode += "%" + (hex1 + hex2);}
}
return strEncode;}