
function createRequestObject(){var ro;var browser=navigator.appName;if(browser=="Microsoft Internet Explorer"){ro=new ActiveXObject("Microsoft.XMLHTTP");}else{ro=new XMLHttpRequest();}
return ro;}
var http=createRequestObject();function handleResponse(){if(http.readyState==4){var response=http.responseText;var update=new Array();if(response.indexOf('|'!=-1)){update=response.split('|');document.getElementById(update[0]).innerHTML=update[1];}}}
function check_phone_form(form){var input_name=form.name.value;var input_phone=form.phone.value;var input_phone_number=/^\d+$/.test(input_phone);if(input_name==null||input_name==""||input_name=="numele tau"){alert("Introdu numele!");form.name.focus();form.name.select();form.name.style.backgroundColor='yellow';return false;}else if(input_phone==null||input_phone==""||input_phone=="telefonul tau"){alert("Introdu numarul de telefon!");form.phone.style.backgroundColor='yellow';form.phone.focus();form.phone.select();return false;}else{if(!input_phone_number){alert("Introdu numarul de telefon valid !\nIntroduceti numai numere!");form.phone.style.backgroundColor='red';form.phone.focus();form.phone.select();}else{send_phone(form,input_name,input_phone);}}}
function send_phone(form,c_name,c_phone){document.getElementById('send').disabled=true;document.getElementById('send').value='Trimite ...';http.open('get','inc/contact.php?name='+c_name+'&phone='+c_phone+'&paction=send_phone');http.onreadystatechange=handleResponse;http.send(null);}
function check_test_form(){var f_button=document.getElementById('t_Trimite');var f_name=document.getElementById('numele_tau').value;var f_company=document.getElementById('compania').value;var f_address=document.getElementById('adresa').value;var f_phone=document.getElementById('telefon').value;var f_phone_number=/^\d+$/.test(f_phone);var f_email=document.getElementById('email').value;var apos=f_email.indexOf("@");var dotpos=f_email.lastIndexOf(".");if(f_name==null||f_name==""){alert("Introduceti numele!");document.getElementById('numele_tau').focus();document.getElementById('numele_tau').style.backgroundColor='yellow';return false;}else if(f_company==null||f_company==""){alert("Introduceti numele companiei!");document.getElementById('compania').focus();document.getElementById('compania').style.backgroundColor='yellow';return false;}else if(f_address==null||f_address==""){alert("Introduceti adresa!");document.getElementById('adresa').focus();document.getElementById('adresa').style.backgroundColor='yellow';return false;}else if(f_phone==null||f_phone==""){alert("Introduceti numarul de telefon!");document.getElementById('telefon').focus();document.getElementById('telefon').style.backgroundColor='yellow';return false;}else if(f_email==null||f_email==""){alert("Introduceti adresa de email!");document.getElementById('email').focus();document.getElementById('email').style.backgroundColor='yellow';return false;}else{if(!f_phone_number){alert("Introdu numarul de telefon valid !\nIntroduceti numai numere!");document.getElementById('telefon').focus();document.getElementById('telefon').select();document.getElementById('telefon').style.backgroundColor='red';return false;}else if(apos<1||dotpos-apos<2){alert("Introduceti un email valid!");document.getElementById('email').focus();document.getElementById('email').style.backgroundColor='red';return false;}else{send_test(f_button,f_name,f_company,f_address,f_phone,f_email);}}}
function send_test(f_button,f_name,f_company,f_address,f_phone,f_email){f_button.disabled=true;f_button.value='Trimite ...';http.open('get','inc/contact.php?name='+f_name+'&company='+f_company+'&address='+f_address+'&phone='+f_phone+'&email='+f_email+'&paction=send_test');http.onreadystatechange=handleResponse;http.send(null);}
function check_recomand_form(){var f_button=document.getElementById('pTrimite');var f_name=document.getElementById('nume').value;var f_company=document.getElementById('companie').value;var f_email=document.getElementById('email').value;var apos=f_email.indexOf("@");var dotpos=f_email.lastIndexOf(".");var f_phone=document.getElementById('telefon').value;var f_phone_number=/^\d+$/.test(f_phone);var f_name_p=document.getElementById('nume_p').value;var f_company_p=document.getElementById('companie_p').value;var f_address_p=document.getElementById('adresa_p').value;var f_email_p=document.getElementById('email_p').value;var apos_p=f_email_p.indexOf("@");var dotpos_p=f_email_p.lastIndexOf(".");var f_phone_p=document.getElementById('telefon_p').value;var f_phone_number_p=/^\d+$/.test(f_phone_p);if(f_name==null||f_name==""){alert("Introduceti numele!");document.getElementById('nume').focus();document.getElementById('nume').style.backgroundColor='yellow';return false;}else if(f_company==null||f_company==""){alert("Introduceti numele companiei!");document.getElementById('companie').focus();document.getElementById('companie').style.backgroundColor='yellow';return false;}else if(f_email==null||f_email==""){alert("Introduceti adresa de email!");document.getElementById('email').focus();document.getElementById('email').style.backgroundColor='yellow';return false;}else if(f_phone==null||f_phone==""){alert("Introduceti numarul de telefon!");document.getElementById('telefon').focus();document.getElementById('telefon').style.backgroundColor='yellow';return false;}else if(f_name_p==null||f_name_p==""){alert("Introduceti numele!");document.getElementById('nume_p').focus();document.getElementById('nume_p').style.backgroundColor='yellow';return false;}else if(f_company_p==null||f_company_p==""){alert("Introduceti numele companiei!");document.getElementById('companie_p').focus();document.getElementById('companie_p').style.backgroundColor='yellow';return false;}else if(f_address_p==null||f_address_p==""){alert("Introduceti adresa companiei!");document.getElementById('adresa_p').focus();document.getElementById('adresa_p').style.backgroundColor='yellow';return false;}else if(f_email_p==null||f_email_p==""){alert("Introduceti adresa de email!");document.getElementById('email_p').focus();document.getElementById('email_p').style.backgroundColor='yellow';return false;}else if(f_phone_p==null||f_phone_p==""){alert("Introduceti numarul de telefon!");document.getElementById('telefon_p').focus();document.getElementById('telefon_p').style.backgroundColor='yellow';return false;}else{if(!f_phone_number){alert("Introdu numarul de telefon valid !\nIntroduceti numai numere!");document.getElementById('telefon').focus();document.getElementById('telefon').select();document.getElementById('telefon').style.backgroundColor='red';return false;}else if(apos<1||dotpos-apos<2){alert("Introduceti un email valid!");document.getElementById('email').focus();document.getElementById('email').style.backgroundColor='red';return false;}else if(!f_phone_number_p){alert("Introdu numarul de telefon valid !\nIntroduceti numai numere!");document.getElementById('telefon_p').focus();document.getElementById('telefon_p').select();document.getElementById('telefon_p').style.backgroundColor='red';return false;}else if(apos_p<1||dotpos_p-apos_p<2){alert("Introduceti un email valid!");document.getElementById('email_p').focus();document.getElementById('email_p').style.backgroundColor='red';return false;}else{send_recomand(f_button,f_name,f_company,f_phone,f_email,f_name_p,f_company_p,f_address_p,f_phone_p,f_email_p);}}
function send_recomand(f_button,f_name,f_company,f_phone,f_email,f_name_p,f_company_p,f_address_p,f_phone_p,f_email_p){f_button.disabled=true;f_button.value='Trimite ...';http.open('get','inc/contact.php?name='+f_name+'&company='+f_company+'&phone='+f_phone+'&email='+f_email+'&name_p='+f_name_p+'&company_p='+f_company_p+'&address_p='+f_address_p+'&phone_p='+f_phone_p+'&email_p='+f_email_p+'&paction=send_recomand');http.onreadystatechange=handleResponse;http.send(null);}}