
function objetoAjax(){
	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 optionMuni(){
	divResultado = document.getElementById('city_show');//this is the div wich will change
	language=document.getElementById('language').value;
	ajax=objetoAjax();
	ajax.open("POST", "get_cities_ajax.php",true);
	ajax.onreadystatechange=function() {
	if (ajax.readyState==4) {
		divResultado.innerHTML = ajax.responseText
			//alert(ajax.responseText);
			//for loading icon
			var loading=document.getElementById("advice");
			loading.innerHTML="";
			var to=document.getElementById("city_combo");
			to.style.visibility='visible';
			//var to=document.getElementById("citylabel");
			//to.innerHTML="City:";
	
		}
	}
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send("language="+language)
}

function optionMuni_load_faqs(){
	divResultado2 = document.getElementById('faqs_container');//this is the div wich will change
	 language_2=document.getElementById('language_faq').value;
	 city_2=document.getElementById('city_faq').value;
	ajax2=objetoAjax();
	ajax2.open("POST", "get_faqs_ajax.php",true);
	ajax2.onreadystatechange=function() {
	if (ajax2.readyState==4) {
		divResultado2.innerHTML = ajax2.responseText
			//alert(ajax.responseText);
			 
	
		}
	}
ajax2.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax2.send("language="+language_2+"city="+city_2)
}

function optionMuni_load_questions_faqs(){
	divResultado = document.getElementById('faqs_questions_container');//this is the div wich will change
	  
	ajax=objetoAjax();
	ajax.open("POST", "get_faqs_questions_ajax.php",true);
	ajax.onreadystatechange=function() {
	if (ajax.readyState==4) {
		divResultado.innerHTML = ajax.responseText
			//alert(ajax.responseText);
	
		}
	}
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send("")
}


function optionMuni_load_faqs_dropdown(){
	divResultado2 = document.getElementById('faqs_container');//this is the div wich will change
	 language_2=document.getElementById('language_faq').value;
	 city_2=document.getElementById('city_faq').value;
	ajax2=objetoAjax();
	ajax2.open("POST", "get_faqs_ajax_dropdown.php",true);
	ajax2.onreadystatechange=function() {
	if (ajax2.readyState==4) {
		divResultado2.innerHTML = ajax2.responseText
			//alert(ajax.responseText);
			 
	
		}
	}
ajax2.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax2.send("language="+language_2+"city="+city_2)
}

function optionMuni_load_testimonial_name(){
	divResultado3 = document.getElementById('name_container');//this is the div wich will change
	 testimonial_name= document.getElementById('testimonial_name').value;//this is the div wich will change
	ajax3=objetoAjax();
	ajax3.open("POST", "get_testimonial_name_ajax.php",true);
	ajax3.onreadystatechange=function() {
	if (ajax3.readyState==4) {
		divResultado3.innerHTML = ajax3.responseText
			//alert(ajax.responseText);
			 
	
		}
	}
	 
ajax3.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax3.send("name="+testimonial_name)
}


function SendMail2(formul){
	
	var form=document.getElementById(formul);
	//alert('bla');
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return
	} 
	if((document.getElementById("txtMail").value == '')||(document.getElementById("txtMail").value != document.getElementById("txtMail2").value)){
		document.getElementById("errEmail").style.visibility = 'visible'; 
		document.getElementById("errEmail").style.display = 'block'; 
		return
	}
	url='/util/enviarMail.php';
	url_to_send="name="+document.getElementById("txtName").value+"&email="+document.getElementById("txtMail").value+"&tel="+document.getElementById("txtTele_phone").value+"&comments="+document.getElementById("txtComments").value+"&language="+document.getElementById("slctLanguage").value+"&from="+document.getElementById("hidFrom").value+"&zip="+document.getElementById("txtZip").value;
	
	ajax=objetoAjax();
	ajax.open("POST", url,true);
	
	//alert(url);
	ajax.onreadystatechange=function() {
	if (ajax.readyState==4) {
		//divResultado.innerHTML = ajax.responseText
			//alert(ajax.responseText);
			//for loading icon
			//var loading=document.getElementById("advice");
			//loading.innerHTML="";
			//var to=document.getElementById("city");
			//to.style.visibility='visible';
			//var to=document.getElementById("citylabel");
			//to.innerHTML="City:";
	
		}
	}
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send(url_to_send);
}

