function ajaxObject(){var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
return xmlhttp;}
function sendProblemsToBravoByEmail(){var questions_div=document.getElementById('questions_div');var nick=document.getElementById('Nick').value;var edad=document.getElementById('Edad').value;var email=document.getElementById('Email').value;var pregunta=document.getElementById('Pregunta').value;var consultant=document.getElementById('Consultant').value;ajax=ajaxObject();ajax.open("GET","/wp-content/themes/bravo/sendProblemsByEmail.php?nick="+nick+"&edad="+edad+"&email="+email+"&pregunta="+pregunta+"&consultant="+consultant);ajax.onreadystatechange=function(){if(ajax.readyState==4){questions_div.innerHTML=ajax.responseText;}}
ajax.send(null)}
function check_form(){var Nick_label=document.getElementById('Nick_label');var errorNick;if(Nick_label.firstChild.nodeValue.indexOf('*')==-1)
errorNick=0;else
errorNick=1;if((document.questions_form.Nick.value.length==0)&&(errorNick==0)){Nick_label.firstChild.nodeValue='*'+ Nick_label.firstChild.nodeValue;Nick_label.style.color='#FF0000';errorNick=1;}else if((document.questions_form.Nick.value.length>0)&&(errorNick==1)){Nick_label.firstChild.nodeValue=Nick_label.firstChild.nodeValue.substr(1,Nick_label.firstChild.nodeValue.length-1);Nick_label.style.color='#0066CC';errorNick=0;}
var Edad_label=document.getElementById('Edad_label');var errorEdad;if(Edad_label.firstChild.nodeValue.indexOf('*')==-1)
errorEdad=0;else
errorEdad=1;var RegExPattern=/^[0-9]{2}$/;if((!document.questions_form.Edad.value.match(RegExPattern))&&(errorEdad==0)){Edad_label.firstChild.nodeValue='*'+ Edad_label.firstChild.nodeValue;Edad_label.style.color='#FF0000';errorEdad=1;}else if((document.questions_form.Edad.value.match(RegExPattern))&&(errorEdad==1)){Edad_label.firstChild.nodeValue=Edad_label.firstChild.nodeValue.substr(1,Edad_label.firstChild.nodeValue.length-1);Edad_label.style.color='#0066CC';errorEdad=0;}
var Email_label=document.getElementById('Email_label');var errorEmail;if(Email_label.firstChild.nodeValue.indexOf('*')==-1)
errorEmail=0;else
errorEmail=1;var RegExPattern=/^[_\.0-9a-z-]+@[0-9a-z\._\-]+\.[a-z]{2,4}$/;if(((document.questions_form.Email.value.length==0)||(!document.questions_form.Email.value.match(RegExPattern)))&&(errorEmail==0)){Email_label.firstChild.nodeValue='*'+ Email_label.firstChild.nodeValue;Email_label.style.color='#FF0000';errorEmail=1;}else if((document.questions_form.Email.value.length>0)&&(document.questions_form.Email.value.match(RegExPattern))&&(errorEmail==1)){Email_label.firstChild.nodeValue=Email_label.firstChild.nodeValue.substr(1,Email_label.firstChild.nodeValue.length-1);Email_label.style.color='#0066CC';errorEmail=0;}
var Pregunta_label=document.getElementById('Pregunta_label');var errorPregunta;if(Pregunta_label.firstChild.nodeValue.indexOf('*')==-1)
errorPregunta=0;else
errorPregunta=1;if((document.questions_form.Pregunta.value.length==0)&&(errorPregunta==0)){Pregunta_label.firstChild.nodeValue='*'+ Pregunta_label.firstChild.nodeValue;Pregunta_label.style.color='#FF0000';errorPregunta=1;}else if((document.questions_form.Pregunta.value.length>0)&&(errorPregunta==1)){Pregunta_label.firstChild.nodeValue=Pregunta_label.firstChild.nodeValue.substr(1,Pregunta_label.firstChild.nodeValue.length-1);Pregunta_label.style.color='#0066CC';errorPregunta=0;}
var AvisoErrores=document.getElementById('AvisoErrores');tdChild=AvisoErrores.firstChild;if(tdChild&&tdChild.nodeValue)
AvisoErrores.removeChild(tdChild);if(errorNick+ errorEdad+ errorEmail+ errorPregunta>0)
AvisoErrores.appendChild(document.createTextNode('Los campos con * son obligatorios'));else
sendProblemsToBravoByEmail();}
