var xmlHttp;



function getProd(prod, lang)

{

	xmlHttp = GetXmlHttpObject();

	

	if(xmlHttp == null)

 	{

 		alert ("O seu Browser não suporta HTTP Request");

 		return;

 	}

	

 	var url  = "selProd.php";

 	    url += "?prod=" + prod + "&lang=" + lang;

 	//alert(url);

 	xmlHttp.onreadystatechange = stateChanged;

 	xmlHttp.open("GET",url,true);

 	xmlHttp.send(null);

}



function stateChanged(){

	if(xmlHttp.readyState == 2){

		document.getElementById("produtos").innerHTML = "...";

		alert("Aguardando informação: prod:" + prod + "lang" + lang);

	}

	

	if(xmlHttp.readyState == 4){

		document.getElementById("produtos").innerHTML = xmlHttp.responseText;

		alert(xmlHttp.responseText);

	}

}



function GetXmlHttpObject()

{

	var xmlHttp = null;

	try

	{

		// Firefox, Opera 8.0+, Safari, Chrome, IE7+;

		xmlHttp = new XMLHttpRequest();

	}

	catch(e)

	{

		//Internet Explorer 6;

		try

		{

			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");

		}

		//Internet Explorer 5;

		catch(e)

		{

			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

		}

	}

	return xmlHttp;

}
