﻿//Send to server.
function SubmitComps() {
   var i, obj, hid, sv, wt, svs, wts, cst;
   var srCtrl = "SelectResults1_";
   showBusy("Comps");

   //Load search values.
   svs = "";
   wts = "";
   cst = "";

   for (i = 0; i < 20; i++) {
      //Criteria.
      obj = $get("Comps1_C" + i)
      if (obj) {
         sv = obj.value;
         if (sv == undefined) {
            sv = obj.innerHTML;
         }
         wt = $get("Comps1_W" + i).value;

         if (svs != "") {
            svs += ",";
            wts += ",";
         }
         svs += sv;
         wts += wt;
      }

      //Constraints.
      obj = $get("Comps1_X" + i)
      if (obj) {
         sv = obj.value;
         if (cst != "") {
            cst += ",";
         }
         cst += sv;
      }
   }

   $get(srCtrl + "TaskName_hid").value = "Comps";
   $get(srCtrl + "GeomStr_hid").value = "-";

   hid = $get("Comps1_pin_hid").value;
   $get(srCtrl + "Command_hid").value = hid;

   hid = svs + "|" + wts + "|" + cst;
   $get(srCtrl + "SearchValues_hid").value = hid;

   obj = $get(srCtrl + "SelectableLayers_DropDownList");
   hid = $get(srCtrl + "SelectLayer_hid");
   hid.value = obj.value;

   obj = $get(srCtrl + "SelectMode_DropDownList");
   hid = $get(srCtrl + "SelectMode_hid");
   hid.value = obj.value;

   //Submit.
   obj = $get(srCtrl + "CallbackButton1");
   obj.click();
}
//Load comps menu.
function LoadCompsMenu(pin) {
   $get("Comps1_pin_hid").value = pin;
   __doPostBack('Comps1$Button1', '');
   CompsMenuLoaded = true;
   showTask('Comparable Properties');
}
