// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function setfocus() {
    document.form1.text1.focus();
}

function popup(mylink, windowname, ww, hh, id)
{
  if (! window.focus)return true;
  var href;
  if (typeof(mylink) == 'string')
     href=mylink;
  else
     href=mylink.href;

  if(id){
      href = href + "?" + id + "=" + document.getElementById(id).value;
  }
  calor = window.open(href, "calor", 'width='+ww+',height='+hh+',scrollbars=yes');
  return false;
}

function popup2(mylink, windowname, ww, hh, id)
{
  if (! window.focus)return true;
  var href;
  if (typeof(mylink) == 'string')
     href=mylink;
  else
     href=mylink.href;

  if(id){
      href = href + "?" + "id=" + id;
  }
  calor = window.open(href, "calor", 'width='+ww+',height='+hh+',scrollbars=yes');
  return false;
}

function cambio(valor)
{
    opener.$('calculo_minutos_de_renovacion').value = valor;
    window.close();
}

function cambio2(valor)
{
    opener.$('calculo_cambios_de_aire').value = valor;
    window.close();
}

function cambio_calor(valor)
{
    opener.$('calculo_qs').value = valor;
    window.close();
}

function cerrar_ventana()
{
    window.close();
}


Event.addBehavior({
   '.modelo_check': function(){
      this.observe('click', function(){
         var hay = $$('.modelo_check').detect(function(v){return true==v.checked;});
         if(hay){
            $('agregar_a_cotizacion').enable();
         }else{
            $('agregar_a_cotizacion').disable();
         }
      });
  }
});



