
var xmlHttp

/* Essa funo manda a ID selecionada do combo de estados para a pgina que ir filtrar as cidades */
function MandaID(str)
{
xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Este browser não suporta HTTP Request")
		return
	}

var url="linha-produto-int.asp" // o arquivo que ir executar a SQL das cidades
url=url+"?p="+str // recebe o ID do estado para filtrar as cidade
url=url+"&sidjs="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

/* Essa funo ir exibir o resultado na DIV */
function stateChanged()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("foto-fade-produto").innerHTML=xmlHttp.responseText
	}
}

/* Instancia */
function GetXmlHttpObject()
{
var objXMLHttp=null

	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
return objXMLHttp
}

function ExibeIds()
{
var Estado = document.getElementById('foto-fade-produto');
var Cidade = document.getElementById('foto-fade-produto');

if (Estado.value != '' && Cidade.value != '')
alert('ID do estado : ' + Estado.value + ' (' + Estado.options[Estado.options.selectedIndex].text + ')' + '\n\n' + 'ID da cidade : ' + Cidade.value + ' (' + Cidade.options[Cidade.options.selectedIndex].text + ')');
}

function ajaxUpdate(el,url,loader){
// Autor: Júlio Maia

		el = document.getElementById(el);
		if (loader){
			elImg = document.getElementById('loading');
			elImg.style.display = "block";
		}
		
		var xmlHttp;
		try
		  {
		  // Firefox, Opera 8.0+, Safari
		  xmlHttp=new XMLHttpRequest();
		  }
		catch (e)
		  {
		  // Internet Explorer
		  try
			{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		  catch (e)
			{
			try
			  {
			  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
			catch (e)
			  {
			  alert("O seu browser não roda AJAX!");
			  return false;
			  }
			}
		  }
		  xmlHttp.onreadystatechange=function()
			{
			if(xmlHttp.readyState==4)
			  {
				el.innerHTML = xmlHttp.responseText;
				if(loader)	elImg.style.display = "none";
			  }
			}
		  xmlHttp.open("GET",url,true);
		  xmlHttp.send(null);
}