function DinamizeValidateForm(form){
DinamizeLimpaAvisos(); var enviar = true; var elem = form.elements; var dateElements = new Array(); var floatElements = new Array();
for(var i = 0; i < elem.length; i++){
if( elem[i].type != "hidden" ){
var classList = elem[i].className.split(" ");
removeClass("field-error", elem[i]);
elem[i].value = elem[i].value.trim();
if(classList.indexOf("type_EMAIL") != -1){
if(!validateEmail(elem[i].value) ){
addClass("field-error", elem[i]);
enviar = false;
}
}
if( classList.indexOf("field-required") != -1 ){
if(classList.indexOf("type_LVM") != -1){
var nameChks = elem[i].getAttribute("id");
var ok = false;
var checkboxes = document.getElementsByClassName("chk_"+nameChks);
removeClass("field-error", document.getElementById("containerMultiple_"+nameChks) );
if (checkboxes.length != 0){
for(var j=0; j < checkboxes.length; j++){
if(checkboxes[j].checked == true){
ok = true;
break;
}
}
}
if(!ok){
addClass("field-error", document.getElementById("containerMultiple_"+nameChks) );
enviar = false;
}
}else{
if( elem[i].value.trim() == "" ){
addClass("field-error", elem[i]);
enviar = false;
}
}
}
}
}
var isMsg = document.getElementById("isMsg").value;
if(enviar && isMsg == "true"){
DinamizeLoadingForm(form);
enviar = false;
}
return enviar;
}
function DinamizeLoadingForm(form) {
var elem = form.elements;
recaptcha = elem["g-recaptcha-response"];
var ifrm = document.createElement("iframe");
ifrm.setAttribute("id", "iframeFormIntegration");
ifrm.setAttribute("name", "iframeFormIntegration");
ifrm.style.display = "none";
document.body.appendChild(ifrm);
if (DinamizeGetCookie('dinTrafficSource')) {
if (document.getElementById("__dinTrafficSource") != null) {
document.getElementById("__dinTrafficSource").setAttribute("value", DinamizeGetCookie('dinTrafficSource'));
} else {
var ts = document.createElement('input');
ts.type = 'hidden';
ts.name = '__dinTrafficSource';
ts.id = '__dinTrafficSource';
ts.value = DinamizeGetCookie('dinTrafficSource');
form.appendChild(ts);
}
}
var imgReq = document.createElement("img");
imgReq.setAttribute("id", "DinamizeImgResponse");
imgReq.src = "https://receiver.emkt.dinamize.com/in/306172/45/45a14/0/?" + serialize(form) + "&a=" + Math.floor((Math.random()*99999)+1);
imgReq.style.display = "none";
document.body.appendChild(imgReq);
imgReq.onload = function () {
DinamizePostSuccess()
}
imgReq.onerror = function () {
document.getElementById("DinamizeDivMessageAlert").style.display = "block";
}
}
function DinamizeGetCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i