//*** <Form.js> ***
function clsVEGAForm(frmName,wnd)
{
 this.Name;
 this.wnd;
 this.Form;
 this.Parameters;
  switch(arguments.length)
        {
         case 1:
              this.wnd=window;
              break;
         case 2:
              this.Name=frmName;
              this.wnd=wnd;
              this.Form=this.wnd.document[this.Name];
              break;
              break;
        }
//***
 this.Reset=function()
 {
  this.Form.reset();
 }
//***
 this.Save=function(fld)
 {
  var q=new Array();
   if(arguments.length != 0) q=fld;
      else
     {
      for(var i=0;i<this.Form.length;i++) q[i]=this.Form[i].name;;
     }
   this.Parameters="";
   for(var i=0;i<q.length;i++)
      {
       if(this.Form[q[i]].tagName == "INPUT")
         {
          switch(this.Form[q[i]].type.toUpperCase())
                {
                 case "RADIO":
                 case "CHECKBOX":
                      if(this.Form[q[i]].checked) this.Parameters+=(this.Parameters.length == 0 ? "?" : "&" )+(this.Form[q[i]].name+"="+this.Form[q[i]].value);
                      break;
                 default:
                      this.Parameters+=(this.Parameters.length == 0 ? "?" : "&" )+(this.Form[q[i]].name+"="+escape(this.Form[q[i]].value));
                      break;
                }
         }
          else
         {
          if(this.Form[q[i]].tagName == "TEXTAREA") this.Parameters+=(this.Parameters.length == 0 ? "?" : "&" )+(this.Form[q[i]].name+"="+escape(this.Form[q[i]].value));
         }
     }
   return this.Parameters;
 }
//***
 this.Fill=function(prm)
 {
  var q;
   if(arguments.length != 0) q=prm.substr(1).split("&");
      else q=this.Parameters.substr(1).split("&");
   for(var i=0;i<q.length;i++)
      {
  var x=q[i].split("=");
       this.Form[x[0]].value=x[1];
      }
 }
//***
 this.Request=function(query)
 {
   this.Parameters="";
   for(var i=0;i<this.Form.length;i++)
      {
       if(this.Form[i].name != "")
         {
          switch(this.Form[i].tagName)
                {
                 case "INPUT":
                      switch(this.Form[i].type.toUpperCase())
                            {
                             case "RADIO":
                             case "CHECKBOX":
                                  if(this.Form[i].checked) this.Parameters+=(this.Parameters.length == 0 ? "?" : "&" )+(this.Form[i].name+"="+escape(this.Form[i].value));
                                  break;
                             default:
  var xep=escape(this.Form[i].value);
                                  while(xep.indexOf("+") >= 0) xep=xep.replace("+","%2B");
                                  this.Parameters+=(this.Parameters.length == 0 ? "?" : "&" )+(this.Form[i].name+"="+xep);
                                  break;
                            }
                      break;
                 case "SELECT":
  var o=this.Form[i].options;
  var prm="";
                      for(var j=0;j<o.length;j++)
                         {
                          if(o[j].selected)
                            {
                             if(prm.length != 0) prm+=",";
                             prm+=o[j].value;
                            }
                         }
//                      while(prm.indexOf("+") >= 0) prm=prm.replace("+","%2B");
                      this.Parameters+=(this.Parameters.length == 0 ? "?" : "&" )+(this.Form[i].name+"="+prm);
                      break;
                 case "TEXTAREA":
  var xep=escape(this.Form[i].value);
                      while(xep.indexOf("+") >= 0) xep=xep.replace("+","%2B");
                      this.Parameters+=(this.Parameters.length == 0 ? "?" : "&" )+(this.Form[i].name+"="+xep);
                      break;
                }
         }
      }
   if(arguments.length && this.Parameters.length != 0 && query) this.Parameters=this.Parameters.substring(1);
   return this.Parameters;
 }
}
//*** </Form.js> ***