// Ajax gererica
function get(tI) { // Esta funcao pega o elemento pelo ID
  if (document.getElementById) { return document.getElementById(tI); }
  else if (document.all) { return document.all[tI]; } else return false;
}

function ajax(valor,url,div,valor2,valor3){ 
	req = null; 
	get(div).innerHTML = "<img src='img/ajax-loader.gif' style='padding-left:20px; padding-top: 6px' />";
	if (window.XMLHttpRequest){ 
		req = new XMLHttpRequest(); 
		req.onreadystatechange = function() {
			if(req.readyState == 4){
				if (req.status == 200){
					get(div).innerHTML = req.responseText;
				} else{ 
					alert("Houve um problema ao obter os dados:\n" + req.statusText);
				}
			}
		}
		req.open("GET", url+'?valor='+valor+'&valor2='+valor2+'&valor3='+valor3, true); 
		req.send(null);
	} else if (window.ActiveXObject){ 
				req = new ActiveXObject("Microsoft.XMLHTTP"); 
				if (req){ 
					req.onreadystatechange = function() {
						if(req.readyState == 4){
							if (req.status == 200){
								get(div).innerHTML = req.responseText;
							} else{ 
								alert("Houve um problema ao obter os dados:\n" + req.statusText);
							}
						}
					}
					req.open("GET", url+'?valor='+valor+'&valor2='+valor2+'&valor3='+valor3, true); 
					req.send();
				}
		}
}

function senhasAjax(valor,url,div){ 
	if(valor.length == 6){
		ajax(valor,url,div);
	}
}
