		function GetXmlHttpObject(handler)
		{ 
		var objXmlHttp=null
		
		if (navigator.userAgent.indexOf("Opera")>=0)
		{
		alert("This example doesn't work in Opera") 
		return 
		}
		if (navigator.userAgent.indexOf("MSIE")>=0)
		{ 
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
		strName="Microsoft.XMLHTTP"
		} 
		try
		{ 
		objXmlHttp=new ActiveXObject(strName)
		objXmlHttp.onreadystatechange=handler 
		return objXmlHttp
		} 	
		catch(e)
		{ 
		alert("Error. Scripting for ActiveX might be disabled") 
		return 
		} 
		} 
		if (navigator.userAgent.indexOf("Mozilla")>=0)
		{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
		}
		}

		var url = "getagents.php?param="; // The server-side scripts
		

		function primoaccesso(my_form,column,direc){
				
				var acc = my_form.elements["acciaio"].value;
				//var leg = my_form.elements["leghe"].value;				
				var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET",url + escape(column) + "&acciaio=" + acc + "&mode=list&dir=" + direc + "&rand=" + myRandom, true);
				xmlHttp.send(null);
				
		
		}

		function home(lang) {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","contenutoprincipale.php?lang="+lang, true);
				xmlHttp.send(null);
		}		
		
		function dove(lang) {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","dove.php?lang="+lang, true);
				xmlHttp.send(null);
		}

				function durezza(lang) {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","durezza.php?lang="+lang, true);
				xmlHttp.send(null);
		}
		function pesi(lang) {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","pesi2.php?lang="+lang, true);
				xmlHttp.send(null);
		}

			
				function finiturabordi(lang) {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","finituradeibordi.php?lang="+lang, true);
				xmlHttp.send(null);
		}		
				function crudi(lang) {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","crudi.php?lang="+lang, true);
				xmlHttp.send(null);
		}

				function ricotti(lang) {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","ricotti.php?lang="+lang, true);
				xmlHttp.send(null);
		}

				function normeinternazionali(lang) {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","normeinternazionali.php?lang="+lang, true);
				xmlHttp.send(null);
		}
		
				function acciaiaustenici(lang) {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","acciaiaustenici.php?lang="+lang, true);
				xmlHttp.send(null);
		}		

		
		function magazzino() {
				//var acciaio;
				//var leghe;		
				//var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","dbmodifi.php", true);
				xmlHttp.send(null);
		}
		
		function getagents(column,direc,acc,leg) {
				//var acciaio;
				//var leghe;		
				var myRandom=parseInt(Math.random()*99999999);  // cache buster  ,acciao,leghe
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET",url + escape(column) + "&acciaio=" + acc + "&leghe=" + leg+ "&mode=list&dir=" + direc + "&rand=" + myRandom, true);
				xmlHttp.send(null);
		}


		function saveRecord(mode,id,param,dir,acci,leg)
		{
			
			//lega = "acciaio";
			//qualita = "404";			
			spessore = document.getElementById("txtspessore").value;
			larghezza = document.getElementById("txtlarghezza").value;
			resistenza = document.getElementById("txtresistenza").value;
			kg = document.getElementById("txtkg").value;
			n_rotoli = document.getElementById("txtn_rotoli").value;
			aspetto = document.getElementById("txtaspetto").value;

				var myRandom=parseInt(Math.random()*99999999);  // cache buster
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","getagents.php?id="+id+"&acciaio="+acci+"&leghe="+leg+"&spessore="+spessore+"&larghezza="+larghezza+"&resistenza="+resistenza+"&kg="+kg+"&n_rotoli="+n_rotoli+"&aspetto="+aspetto+"&mode="+mode+"&param=" + escape(param) + "&dir=" + dir + "&rand=" + myRandom, true);
				xmlHttp.send(null);
		}
		
		function saveNewRecord(mode,param,dir,acci,leg)
		{
			
			//lega = "acciaio";
			//qualita = "404";
			spessore = document.getElementById("txtspessore").value;
			larghezza = document.getElementById("txtlarghezza").value;
			resistenza = document.getElementById("txtresistenza").value;
			kg = document.getElementById("txtkg").value;
			n_rotoli = document.getElementById("txtn_rotoli").value;
			aspetto = document.getElementById("txtaspetto").value;
				
		if ( spessore.length == 0 || larghezza.length == 0 || resistenza.length == 0 || kg.length == 0 || n_rotoli.length == 0 ) 
		{
			alert("Please enter value for all the fields");
			
		}
		else
		{
				var myRandom=parseInt(Math.random()*99999999);  // cache buster
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","getagents.php?acciaio="+acci+"&leghe="+leg+"&spessore="+spessore+"&larghezza="+larghezza+"&resistenza="+resistenza+"&kg="+kg+"&n_rotoli="+n_rotoli+"&aspetto="+aspetto+"&mode="+mode+"&param=" + escape(param) + "&dir=" + dir + "&rand=" + myRandom, true);
				xmlHttp.send(null);			
		}
		}
		
		function newRecord(mode,param,dir,acc1,leg1)
		{
				var myRandom=parseInt(Math.random()*99999999);  // cache buster
				xmlHttp=GetXmlHttpObject(handleHttpResponse);
				xmlHttp.open("GET","getagents.php?acciaio="+acc1+"&leghe="+leg1+"&mode="+mode+"&param=" + escape(param) + "&dir=" + dir + "&rand=" + myRandom, true);
				xmlHttp.send(null);
		}
		
		function manipulateRecord(mode,id,param,dir,acc,leg)
		{
		if ( confirm("Are you sure you want to "+mode+" record ?") != 1 )
		{
			return false;	
		}	

				var myRandom=parseInt(Math.random()*99999999);  // cache buster
				xmlHttp=GetXmlHttpObject(handleHttpResponse(tipoDiv));
				xmlHttp.open("GET","getagents.php?id="+id+"&acciaio="+acc+"&leghe="+leg+"&mode="+mode+"&param=" + escape(param) + "&dir=" + dir + "&rand=" + myRandom, true);
				xmlHttp.send(null);
		}	
		
		
		function handleHttpResponse() {
			if (xmlHttp.readyState == 4) {
			  document.getElementById("content").style.visibility="visible"; 		//"hiddenDIV"
			  document.getElementById("content").innerHTML='';
			  document.getElementById("content").innerHTML=xmlHttp.responseText;
			  }
		}
