var xmlHttp
var baseporc
var idelem
var elemento
var elenombre


// ***********************************************************************************************************************************************

function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

//********* AGUAAGREGA ***************************************************************************
function calculaaguaagre(str,val)
{ 
//alert(val)

  if (isNaN(val)) {   
 	 document.getElementById(str).select()
     alert("inserta un numero"); 
	 return false;
 }else{ 
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null) 
  {
    alert ("Browser does not support HTTP Request")
    return
  }  
  else
  {      
  
  url="aguaagregarevaporarcal.php"
  url=url+"?s="+str
  url=url+"&v="+val
  url=url+"&sid="+Math.random()
  xmlHttp.onreadystatechange=function () {
       if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
       { 
 		  document.getElementById("calculo").innerHTML=xmlHttp.responseText 
     }
  }  
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
  }

 }
}
 

function aguagreencero()
{// alert('hola')
    document.getElementById("denmosto").value = 0
    document.getElementById("denaobtener").value =0
    document.getElementById("volmosto").value =0
 
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) 
    {
        alert ("Browser does not support HTTP Request")
        return
    }else{      
       url="aguaagregarevaporarcal.php"
       url=url+"?s=denaobtener"
       url=url+"&v=0"
       url=url+"&sid="+Math.random()
     //  alert(url)
  
       xmlHttp.onreadystatechange=function () {
          if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
          { 
		  document.getElementById("calculo").innerHTML=xmlHttp.responseText 
          }
       }  
       xmlHttp.open("GET",url,true)
       xmlHttp.send(null)
    }
}
 
 
// ********DILUCION *************************************************************************************************************************************

function calculamezcla(str,val)
{ 
  if (isNaN(val)) {   
      document.getElementById(str).select()
       alert("inserta un numero"); 
	   return false;
  }else{ 
      if(str=='denaobtener' && document.getElementById("denaobtener").value >= document.getElementById("denmosto").value)
      {
          alert("Densidad a Obtener MAYOR a la del mosto"); 
	      return false;
      }else{
          xmlHttp=GetXmlHttpObject()
          if (xmlHttp==null) 
          {
             alert ("Browser does not support HTTP Request")
             return
          }else{      
             url="mezclavolumendetermincal.php"
             url=url+"?s="+str
             url=url+"&v="+val
             url=url+"&sid="+Math.random()

             xmlHttp.onreadystatechange=function () {
                   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
                   { 
		                 document.getElementById("calculo").innerHTML=xmlHttp.responseText 
                   }
             }  
             xmlHttp.open("GET",url,true);
             xmlHttp.send(null);
         }		
      }

  }
}

function mezclaencero()
{// alert('hola')
    document.getElementById("denmosto").value = 0
    document.getElementById("denaobtener").value =0
    document.getElementById("volaobtener").value =0
 
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) 
    {
        alert ("Browser does not support HTTP Request")
        return
    }else{      
       url="mezclavolumendetermincal.php"
       url=url+"?s=denaobtener"
       url=url+"&v=0"
       url=url+"&sid="+Math.random()
     //  alert(url)
  
       xmlHttp.onreadystatechange=function () {
          if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
          { 
		  document.getElementById("calculo").innerHTML=xmlHttp.responseText 
          }
       }  
       xmlHttp.open("GET",url,true)
       xmlHttp.send(null)
    }
}

// ********RENDIMIENTO *************************************************************************************************************************************

function calcularendimiento(str,val)
{ 
  if (isNaN(val)) {   
      document.getElementById(str).select()
       alert("inserta un numero"); 
	   return false;
  }else{ 
          xmlHttp=GetXmlHttpObject()
          if (xmlHttp==null) 
          {
             alert ("Browser does not support HTTP Request")
             return
          }else{      
             url="rendimientocal.php"
             url=url+"?s="+str
             url=url+"&v="+val
             url=url+"&sid="+Math.random()

             xmlHttp.onreadystatechange=function () {
                   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
                   { 
		                 document.getElementById("calculo").innerHTML=xmlHttp.responseText 
                   }
             }  
             xmlHttp.open("GET",url,true);
             xmlHttp.send(null);
         }		
      
  }
}

function rendimientocero()
{// alert('hola')

	document.getElementById("denanthervor").value = 0
    document.getElementById("mostoanthervor").value =0
    document.getElementById("cantmalta").value =0
	 
	
 
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) 
    {
        alert ("Browser does not support HTTP Request")
        return
    }else{      
       url="rendimientocal.php"
       url=url+"?s=denaobtener"
       url=url+"&v=0"
       url=url+"&sid="+Math.random()
     //  alert(url)
  
       xmlHttp.onreadystatechange=function () {
          if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
          { 
		  document.getElementById("calculo").innerHTML=xmlHttp.responseText 
          }
       }  
       xmlHttp.open("GET",url,true)
       xmlHttp.send(null)
    }
}

// ********EVAPORACION *************************************************************************************************************************************

function calculaevaporacion(str,val)
{ 
  if (isNaN(val)) {   
      document.getElementById(str).select()
       alert("inserta un numero"); 
	   return false;
  }else{ 
          xmlHttp=GetXmlHttpObject()
          if (xmlHttp==null) 
          {
             alert ("Browser does not support HTTP Request")
             return
          }else{      
             url="evaporacioncal.php"
             url=url+"?s="+str
             url=url+"&v="+val
             url=url+"&sid="+Math.random()

             xmlHttp.onreadystatechange=function () {
                   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
                   { 
		                 document.getElementById("calculo").innerHTML=xmlHttp.responseText 
                   }
             }  
             xmlHttp.open("GET",url,true);
             xmlHttp.send(null);
         }		
      
  }
}

function evaporacioncero()
{// alert('hola')
    
    document.getElementById("denanthervor").value = 0
	document.getElementById("dendeshervor").value = 0
    document.getElementById("mostoanthervor").value =0
    document.getElementById("hervormin").value =0
	
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) 
    {
        alert ("Browser does not support HTTP Request")
        return
    }else{      
       url="evaporacioncal.php"
       url=url+"?s=denaobtener"
       url=url+"&v=0"
       url=url+"&sid="+Math.random()
     //  alert(url)
  
       xmlHttp.onreadystatechange=function () {
          if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
          { 
		  document.getElementById("calculo").innerHTML=xmlHttp.responseText 
          }
       }  
       xmlHttp.open("GET",url,true)
       xmlHttp.send(null)
    }
}

// ******** DENSIDAD INICIAL  ***************************************************************************************************************************

function calculadensidadini(str,val)
{ 
  if (isNaN(val)) {   
      document.getElementById(str).select()
       alert("inserta un numero"); 
	   return false;
  }else{ 
          xmlHttp=GetXmlHttpObject()
          if (xmlHttp==null) 
          {
             alert ("Browser does not support HTTP Request")
             return
          }else{      
             url="densidadinicialcal.php"
             url=url+"?s="+str
             url=url+"&v="+val
             url=url+"&sid="+Math.random()

             xmlHttp.onreadystatechange=function () {
                   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
                   { 
		                 document.getElementById("calculo").innerHTML=xmlHttp.responseText 
                   }
             }  
             xmlHttp.open("GET",url,true);
             xmlHttp.send(null);
         }		
      
  }
}

function densidadinicero()
{// alert('hola')
    
    document.getElementById("denanthervor").value = 0
	document.getElementById("evaporacion").value = 0
    document.getElementById("mostoanthervor").value =0
    document.getElementById("hervormin").value =0
	
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) 
    {
        alert ("Browser does not support HTTP Request")
        return
    }else{      
       url="densidadinicialcal.php"
       url=url+"?s=denaobtener"
       url=url+"&v=0"
       url=url+"&sid="+Math.random()
     //  alert(url)
  
       xmlHttp.onreadystatechange=function () {
          if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
          { 
		  document.getElementById("calculo").innerHTML=xmlHttp.responseText 
          }
       }  
       xmlHttp.open("GET",url,true)
       xmlHttp.send(null)
    }
}


// ******** MEZCLAS DE MOSTOS  ***********************************************************************************************************************

function calculamezclamosto(str,val)
{ 
  if (isNaN(val)) {   
      document.getElementById(str).select()
       alert("inserta un numero"); 
	   return false;
  }else{ 
          xmlHttp=GetXmlHttpObject()
          if (xmlHttp==null) 
          {
             alert ("Browser does not support HTTP Request")
             return
          }else{      
             url="mezclamostocal.php"
             url=url+"?s="+str
             url=url+"&v="+val
             url=url+"&sid="+Math.random()

             xmlHttp.onreadystatechange=function () {
                   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
                   { 
		                 document.getElementById("calculo").innerHTML=xmlHttp.responseText 
                   }
             }  
             xmlHttp.open("GET",url,true);
             xmlHttp.send(null);
         }		
      
  }
}

function mezclamostocero()
{// alert('hola')
    
    document.getElementById("volumen1").value = 0
	document.getElementById("densidad1").value = 0
    document.getElementById("volumen2").value = 0
	document.getElementById("densidad2").value = 0
    document.getElementById("volumen3").value = 0
	document.getElementById("densidad3").value = 0
	document.getElementById("densifinal").value = 0
 
	
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) 
    {
        alert ("Browser does not support HTTP Request")
        return
    }else{      
       url="mezclamostocal.php"
       url=url+"?s=denaobtener"
       url=url+"&v=0"
       url=url+"&sid="+Math.random()
     //  alert(url)
  
       xmlHttp.onreadystatechange=function () {
          if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
          { 
		  document.getElementById("calculo").innerHTML=xmlHttp.responseText 
          }
       }  
       xmlHttp.open("GET",url,true)
       xmlHttp.send(null)
    }
}

//******************************************



