  var str=new String(window.location); if (str.indexOf("www") == -1)  {   index=str.indexOf("//");  str=str.substr(0, index + 2) + "www." + str.substr(index+2);  window.location.href=str; }    function GetServerRoot()  {   var str=new String(window.location);  var index=str.lastIndexOf("/");  str=str.substr(0, index);  index=str.lastIndexOf("/");  str=str.substr(0, index+1);    return str; }      var CSS_DISPLAY_MAX=10;    var NO_CSS_DISPLAY_DATA=1000;      function send_request(obj)  {   var newMessage=new fromserv(obj);  pendingTX.push(newMessage);    newMessage.TX(); }        qwer.prototype.constructor=new qwer(); qwer.prototype.Logon=qwer_Logon; qwer.prototype.Logoff=qwer_Logoff; qwer.prototype.rar=qwer_rar; qwer.prototype.SendRequest=qwer_SendRequest; qwer.prototype.DebugRequest=qwer_DebugRequest;     qwer.prototype.get_request=qwer_GetRequest; qwer.prototype.ParseResponse=qwer_ParseResponse;       qwer.prototype.LB=qwer_LB; qwer.prototype.tic=qwer_tic; qwer.prototype.tss=qwer_tss; qwer.prototype.tssDisplay=qwer_tssDisplay; qwer.prototype.Scroll=qwer_Scroll; qwer.prototype.scul=qwer_scul; qwer.prototype.gai=qwer_gai;       function qwer()  {      this.object_name='';    this.phpStr='';  this.rty=new Array();  this.ppo=null;    this.diw=new Array();    this.debug_me=false;  this.scroll_selected_colour='#00ff00';  this.scroll_not_selected_colour='#ffffff'; }    function qwer_Logon(name, pwd)  {   this.request='action_request=LOGON&user_name='+name+'&pwd='+pwd; alert(this.request);  send_request(this); }    function qwer_Logoff()  {   this.request='action_request=LOGOFF';  send_request(this); }    function qwer_SendRequest(request)  {   this.request='action_request='+request;  send_request(this);  }      function qwer_rar(ar)  {   var i=0;  this.request="";  for (i=0;i < ar.length;i+=2)   {    if (i > 0 )     this.request += '&';   this.request += ar[i] + "=" + ar[i+1];  }  }                function qwer_ParseResponse(db_str)  {   this.rty.length=0;  this.phpStr=db_str;      var psa=new Array();  psa=this.phpStr.split("}");    if (psa.length < 1)      {     alert('parse error ' + this.phpStr);   return;    }       for (var i=0;i < psa.length-1;i++)   {    psa[i] += '}';   this.rty[i]=psa[i].parseJSON();    }   if (this.rty[0].action == "error")    alert("ERROR RECEIVED FROM SERVER \n TABLE " + this.rty[0].table + " \n  " + this.rty[0].error_data);  if (this.rty[0].action == undefined)    alert("no action defined error \n" + db_str);  if (this.rty[0].action == 'report_duplicate')       alert("error - that item already exists in the database");     }    function qwer_GetRequest()  {   return this.request; }      function qwer_tic()  {       if (this.diw[0])     {        this.tssDisplay(this.gsi());            for (var i=0;i < CSS_DISPLAY_MAX;i++)        {                 if (i + this.gso() < this.car.length)     {     this.wcd(this.car[i + this.gso()], i);   }           else     {        this.wcd(this.car[i + this.gso()], i-NO_CSS_DISPLAY_DATA);   }      }             if (document.getElementById(this.db_name + '_scroll_left'))      {                  if (this.gss() == 0 )            document.getElementById(this.db_name + '_scroll_left').firstChild.nodeValue='page   ';           else       document.getElementById(this.db_name+'_scroll_left').firstChild.nodeValue='prev   ';      document.getElementById(this.db_name+'_scroll_left').style.visibility='visible';     }                             if (document.getElementById(this.db_name + '_scroll_right'))     {      if ((this.gss() + CSS_DISPLAY_MAX ) * CSS_DISPLAY_MAX >= (this.car.length) )      {       document.getElementById(this.db_name + '_scroll_right').firstChild.nodeValue='';            document.getElementById(this.db_name + '_scroll_right').style.visibility='hidden';     }      else      {       document.getElementById(this.db_name + '_scroll_right').firstChild.nodeValue='next';            document.getElementById(this.db_name + '_scroll_right').style.visibility='visible';     }     }                                         for (i=0;i < 10;i++)         {           str=this.db_name + '_scroll_' + (i+1);    if (document.getElementById(str))     {      if( (i+this.gss())*CSS_DISPLAY_MAX < (this.car.length))      {      document.getElementById(str).firstChild.nodeValue=(i+1+this.gss());                 document.getElementById(str).style.visibility='visible';     }      else      {      document.getElementById(str).firstChild.nodeValue='';                 document.getElementById(str).style.visibility='hidden';     }     }        }                     var id=this.db_name + '_scroll_';       var elem='';       for(i=0;i < CSS_DISPLAY_MAX;i++)        {            elem=id + (i+1);     if (document.getElementById(elem))     document.getElementById(elem).style.backgroundColor=this.scroll_not_selected_colour;       }          elem=(this.gso()/CSS_DISPLAY_MAX) - this.gss()+1;       if (elem > 0 )     {    if (document.getElementById(id+elem))            document.getElementById(id+elem).style.backgroundColor=this.scroll_selected_colour;    }     }     }    function qwer_tssDisplay(sel)  {      if (this.diw[0])      {          if (this.display_type == 'dropdown_display')              return;         for (i=0;i < CSS_DISPLAY_MAX;i++)             this.diw[i].style.background='white';         if (sel >= 0 && sel < CSS_DISPLAY_MAX)              this.diw[sel].style.background='#f7f7f7';     }  }    function qwer_tss(sel)  {     if (sel >= 0 && sel < this.car.length)      this.Childtss(sel);    this.tic(); }    function qwer_Scroll(offset)  {     if (offset >= 0 && offset < this.car.length -9 )          this.css_get_class((offset + this.gss()) * CSS_DISPLAY_MAX);           this.tic(); }    function qwer_scul(val)  {     var css_ini_style=this.gss();    if (val == -100)     {    if (css_ini_style > 10)     this.Childscul(css_ini_style-10);   else     this.Childscul(0);    }       if (val == -200)     {    if (css_ini_style < this.car.length - 10)     this.Childscul(css_ini_style + 10);   else     this.Childscul(this.car.length - 10);    }          this.tic()  }    function qwer_gai()  {   return this.gsi() + this.gso(); }          function qwer_DebugRequest()  {   rq_ar=this.request.split('&');  var dbg_str="";  for (var i=0;i < rq_ar.length;i++)     dbg_str +=  rq_ar[i] + '\r\n';  alert(dbg_str); }            function qwer_LB(str)  {   var myStr=new String(str);  return myStr.replace(/\|/g, "\n"); }      