<!-- script_zectric01.js beg -->

<!-- global variables required -->
<!-- var zhomepage    = '£HOMEPAGE£';    -->
<!-- var zhomepath    = '£HOMEPATH£';    -->
<!-- var zhomebase    = '£HOMEBASE£';    -->
<!-- var zhomeroot    = '£HOMEROOT£';    -->
<!-- var zdriver      = '£DRIVER£';      -->
<!-- var zpoolname    = '£POOLNAME£';    -->
<!-- var zwebcookieid = '£WEBCOOKIEID£'; -->
<!-- var zwebclientid = '£WEBCLIENTID£'; -->
<!-- var zwebusercode = '£WEBUSERCODE£'; -->

<!-- local variables -->

<!-- global script_zectric01 -->

<!-- display error in an identified paragraph -->
function seterror(errnumb,errtext)
{
 var errorid = 'iderror' + errnumb;
 if ( document.getElementById(errorid) != undefined )
  errorobj = document.getElementById(errorid);
 else
  errorobj = document.getElementById('iderror');
 if ( errorobj != undefined )
 {
  if ( errorobj.innerHTML != "") { errorobj.innerHTML = errorobj.innerHTML + '<br>'; }
  errorobj.innerHTML = errorobj.innerHTML + errtext;
 }
}

<!-- set focus to an identified control -->
function setfocus(focusid)
{
 if ( focusid != "")
 {
  var focusobj = document.getElementById(focusid);
  if ( focusobj != undefined )
  {
   if ( focusobj.disabled == false )
   {
    focusobj.focus();
    focusobj.select();
   }
  }
  else
  {
   if ( String(focusid).substring(0,3) == 'buy' )
   {
    if ( focusid != 'buy1' )
    {
     setfocus('buy1');
    }
   }
   else
   {
    seterror('','Cannot find control ' + focusid);
   }
  }
 }
}

<!-- display help in an identified paragraph from an identified control -->
function sethelp(hlpnumb,focusid)
{
 var focusobj = document.getElementById(focusid);
 if ( focusobj != undefined )
 {
  focusobj.select();
  if ( focusobj.title != "" )
  {
   var helpid = 'idhelp' + hlpnumb;
   if ( document.getElementById(helpid) != undefined )
    helpobj = document.getElementById(helpid);
   else
    helpobj = document.getElementById('idhelp');
   if ( helpobj != undefined )
    helpobj.innerHTML = 'Tip: ' + focusobj.title;
  }
 }
}

<!-- initialise help in an identified patagraph -->
function clrhelp(hlpnumb)
{
 var helpid = 'idhelp' + hlpnumb;
 var helpobj = document.getElementById('idhelp');
 if ( document.getElementById(helpid) != undefined )
 {
  helpobj = document.getElementById(helpid);
 }
 if ( helpobj != undefined )
 {
  helpobj.innerHTML = '&nbsp;';
 }
}

<!-- redirect client to new form -->
function zfm(formn)
{
 if ( typeof(formn) == 'string' )
 {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + formn;
  location.href = locationhref;
 }
}

<!-- redirect client to new action -->
function zfa(forma)
{
 if ( typeof(forma) == 'string' )
 {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formaction=' + forma;
  location.href = locationhref;
 }
}

<!-- redirect client to new form & new action -->
function zfma(formn,forma)
{
 if ( typeof(formn) == 'string' && typeof(forma) == 'string' )
 {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + formn + '&formaction=' + forma;
  location.href = locationhref;
 }
}

<!-- redirect client to new form & new usercode -->
function zfmu(formn,formu)
{
 if ( typeof(formn) == 'string' && typeof(formu) == 'string' )
 {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + formn + '&usercode=' + formu;
  location.href = locationhref;
 }
}

<!-- redirect client to new form & new category -->
function zfmc(formn,formc)
{
 if ( typeof(formn) == 'string' && typeof(formc) == 'string' )
 {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + formn + '&catsel=' + formc;
  location.href = locationhref;
 }
}

<!-- submit an identified form -->
function zsub(formid)
{
 var formobj = document.getElementById(formid);
 if ( formobj != undefined )
 {
  formobj.submit();
 }
 else
 {
  seterror('','Cannot find form ' + formid);
 }
}

<!-- submit an identified form with an action -->
function zsuba(formid,forma)
{
 var formobj = document.getElementById(formid);
 if ( formobj != undefined )
 {
  formobj.formaction.value = forma;
  formobj.submit();
 }
 else
 {
  seterror('','Cannot find form ' + formid + ', action ' + forma);
 }
}

<!-- submit an identified form with a paging action -->
function zsubp(formid,pagea)
{
 var formobj = document.getElementById(formid);
 if ( formobj != undefined )
 {
  formobj.paging.value = pagea;
  formobj.submit();
 }
 else
 {
  seterror('','Cannot find form ' + formid + ', action ' + pagea);
 }
}

<!-- submit an identified form with a selection action -->
function zdet(formid,forma,bbasketkey)
{
 var formobj = document.getElementById(formid);
 if ( formobj != undefined )
 {
  formobj.formaction.value = forma;
  formobj.bbasketkey.value = bbasketkey;
  formobj.submit();
 }
 else
 {
  seterror('','Cannot find form ' + formid + ', action ' + forma + ', bbasketkey ' + bbasketkey);
 }
}

<!-- order detail -->
function odetails(docno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'orderdetail' + '&docno=' + docno;
  location.href = locationhref;
}

<!-- order basket -->
function obasket(bskno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'orderdetail' + '&bskno=' + bskno;
  location.href = locationhref;
}

<!-- submit an identified form with basket action -->
function zbsk(formid,bseq,bact)
{
 var formobj = document.getElementById(formid);
 if ( formobj != undefined )
 {
  formobj.bseq.value = bseq;
  formobj.formaction.value = 'bsk' + bact;
  formobj.submit();
 }
 else
 {
  seterror('','Cannot find form ' + formid + ', bseq ' + bseq + ', action bsk' + bact);
 }
}

<!-- submit an identified form with favourites action -->
function zfav(formid,fseq,fact)
{
 var formobj = document.getElementById(formid);
 if ( formobj != undefined )
 {
  formobj.fseq.value = fseq;
  formobj.formaction.value = 'fav' + fact;
  formobj.submit();
 }
 else
 {
  seterror('','Cannot find form ' + formid + ', fseq ' + fseq + ', action fav' + fact);
 }
}

<!-- redirect client to new category -->
function cat(catag)
{
 if ( typeof(catag) == 'string' )
 {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'category' + '&catsel=' + catag;
  location.href = locationhref;
 }
}

<!-- redirect client to new product -->
function prod1(prodg)
{
 if ( typeof(prodg) == 'string' )
 {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'product' + '&prodsel=' + prodg;
  location.href = locationhref;
 }
}

<!-- redirect client to new product with category -->
function prod2(prodg,catag)
{
 if ( typeof(prodg) == 'string' && typeof(catag) == 'string' )
 {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'product' + '&catsel=' + catag + '&prodsel=' + prodg;
  location.href = locationhref;
 }
}

<!-- redirect client to new product with category and associated category -->
function prod3(prodg,catag,catas)
{
 if ( typeof(prodg) == 'string' && typeof(catag) == 'string' && typeof(catas) == 'string' )
 {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'product' + '&catsel=' + catag + '&prodsel=' + prodg + '&assoccat=' + catas;
  location.href = locationhref;
 }
}

<!-- popup a new child window -->
function popup(mylink,windowname)
{
 if (! window.focus) return true;
 var href;
 if (typeof(mylink) == 'string')
  href=mylink;
 else
  href=mylink.href;
 window.open(href,windowname,'width=500,height=600,scrollbars=no');
 return false;
}

<!-- sales ledger invoice detail -->
function sldetails(seqno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'docdetail' + '&seqno=' + seqno;
  location.href = locationhref;
}

<!-- popup printer friendly invoice detail -->
function pfriendly()
{
  if (! window.focus)return true;
  var href;
  pfseq = document.docdetail.seqno.value;
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'docdetailpf' + '&seqno=' + pfseq;
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- blank the search box in viewsl -->
function blankit() {
 if (document.viewsl.searchinv.value == "Enter invoice no. to search") {
  document.viewsl.searchinv.value = "";
 }
}

<!-- blank the search box in joblist -->
function blankjob() {
 if (document.joblist.searchord.value == "Enter your order no. to search") {
  document.joblist.searchord.value = "";
 }
}

<!-- blank the search box in consjoblist -->
function consblankjob() {
 if (document.consjoblist.searchord.value == "Enter your order no. to search") {
  document.consjoblist.searchord.value = "";
 }
}

<!-- joblist job detail -->
function jobdetails(seqno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'jobdetail' + '&seqno=' + seqno;
  location.href = locationhref;
}

<!-- consjoblist job detail -->
function consjobdetails(prodno,seqno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'consjobdetail' + '&prodno=' + prodno + '&seqno=' + seqno;
  location.href = locationhref;
}

<!-- joblist individual job detail -->
function indjob(seqno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'jobdoc' + '&seqno=' + seqno;
  location.href = locationhref;
}

<!-- popup printer friendly invoice detail from job list -->
function jobpfriendly()
{
  if (! window.focus)return true;
  var href;
  pfseq = document.jobdoc.seqno.value;
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'jobdocpf' + '&seqno=' + pfseq;
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- quotation detail -->
function qdetails(docno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'quotedetail' + '&docno=' + docno;
  location.href = locationhref;
}

<!-- popup printer friendly quote detail -->
function qpfriendly()
{
  if (! window.focus)return true;
  var href;
  pfdoc = document.quoteprintoptions.docno.value;
  pfformat='';
  custquote='';
  if ( document.getElementById('format1').checked == true ) { pfformat = document.getElementById('format1').value; }
  if ( document.getElementById('format2').checked == true ) { pfformat = document.getElementById('format2').value; }
  if ( document.getElementById('format3').checked == true ) { pfformat = document.getElementById('format3').value; }
  if ( document.getElementById('format4').checked == true ) { pfformat = document.getElementById('format4').value; }
  if ( document.getElementById('custquote1').checked == true ) { custquote = document.getElementById('custquote1').value; }
  mymargperc = document.quoteprintoptions.mymargperc.value
  trademargperc = document.quoteprintoptions.trademargperc.value
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'quoteprint' + '&docno='+ pfdoc + '&format=' + pfformat + '&mymargperc=' + mymargperc + '&trademargperc='+ trademargperc + '&custquote=' + custquote;
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- popup printer friendly order detail -->
function opfriendly()
{
  if (! window.focus)return true;
  var href;
  pfdoc = document.orderdetail.docno.value;
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'orderprint' + '&docno=' + pfdoc;
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- consignment detail -->
function consdetails(prodno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'consstockdetail' + '&prodno=' + prodno;
  location.href = locationhref;
}


<!-- consignment book out product validation-->

var globalTakeFocus=null;

function conssetFocus(ref) {
globalTakeFocus=ref;
setTimeout("globalTakeFocus.focus();globalTakeFocus.select()",100);
}

function consprodval(prodbox,lineno,nextlineno) {
  valprod = prodbox.value.toUpperCase();
  descid = 'desc' + lineno;
  unitid = 'unit' + lineno;
  qtyid = 'qty' + lineno;
  var descobj = document.getElementById(descid);
  var unitobj = document.getElementById(unitid);
  var qtyobj = document.getElementById(qtyid);
  valid = false;
  for (aa=0; aa < maxprods; aa++ ) {
   checkprod = prodlist[aa];
   if ( valprod == checkprod ) {
      valid = true;
      descobj.value = desclist[aa];
      unitobj.value = unitlist[aa];
      qtyobj.value = defqtylist[aa];
      var nextprodboxid = 'product' + nextlineno;
      var nextobj = document.getElementById(nextprodboxid);
      if ( nextobj != undefined ) {
        conssetFocus(nextobj);
        return false;
      }
      break;
   }
  }
  if ( valid == false ) {
    if (valprod == "") {
    } else {
       alert(valprod + ' is not a valid product!');
       prodbox.value = '';
    }
    descobj.value = '';
    unitobj.value = '';
    qtyobj.value = '';
    conssetFocus(prodbox);
    return false;
  } 
}

function isInteger(qtybox,lineno) {
      var i;
      var z;
      qtyval = qtybox.value;
      if (qtyval == "") {
	 if (lineno == 0) {
           return true;
         } else {
           prodid = 'product' + lineno;
           var prodobj = document.getElementById(prodid);
           if (prodobj.value == "") {
             return true;
           } else {
             alert('quantity must be input');
             conssetFocus(qtybox);
             return false;
           }
         }
      } else {
        if (qtyval.charAt(0) == '-') {
          z = 1;
        } else {
          z = 0;
        }
        for (i = z; i < qtyval.length; i++)
        {
           var c = qtyval.charAt(i);
           if (isNaN(c)) 
	     {
		  alert(qtyval + ' is not an integer');
                  qtybox.value = '';
                  conssetFocus(qtybox);
	          return false;
	     }
        }
        return true;
     }
}

<!-- popup printer friendly consignment bookout detail -->
function conspfriendly(consref)
{
  if (! window.focus)return true;
  var href;
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'consbookoutpf' + '&consref=' + consref;
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- blank the search box in consorderlist -->
function consblankorder() {
 if (document.consorderlist.searchord.value == "Enter your order no. to search") {
  document.consorderlist.searchord.value = "";
 }
}

<!-- consorderlist order detail -->
function consorderdetails(orderno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'consorderdetails' + '&orderno=' + orderno;
  location.href = locationhref;
}

<!-- popup printer friendly consignment order detail -->
function consorderdetailspfriendly()
{
  if (! window.focus)return true;
  var href;
  orderno = document.consorderdetails.orderno.value;
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'consorderdetailspf' + '&orderno=' + orderno;
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- consorderdetails product detail -->
function consorderproddetails(orderno,prodno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'consorderproddetails' + '&orderno=' + orderno + '&prodno=' + prodno;
  location.href = locationhref;
}

<!-- calconsorderlist month detail -->
function calconsorderlist(yrmon) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'calconsorderlist' + '&yrmon=' + yrmon;
  location.href = locationhref;
}

<!-- blank the search box in calconsorderlist -->
function calconsblankorder() {
 if (document.calconsorderlist.searchord.value == "Enter your order no. to search") {
  document.calconsorderlist.searchord.value = "";
 }
}

<!-- calconsorderlist order detail -->
function calconsorderdetails(yrmon,orderno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname  + '&formname=' + 'calconsorderdetails' + '&yrmon=' + yrmon + '&orderno=' + orderno;
  location.href = locationhref;
}

<!-- popup printer friendly calconsignment order detail -->
function calconsorderdetailspfriendly()
{
  if (! window.focus)return true;
  var href;
  yrmon = document.calconsorderdetails.yrmon.value;
  orderno = document.calconsorderdetails.orderno.value;
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'calconsorderdetailspf' + '&yrmon=' + yrmon + '&orderno=' + orderno;
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- popup printer friendly calconsignment order list -->
function calconsorderlistpfriendly()
{
  if (! window.focus)return true;
  var href;
  yrmon = document.calconsorderlist.yrmon.value;
  searchord = document.calconsorderlist.searchord.value;
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'calconsorderlistpf' + '&yrmon=' + yrmon + '&searchord=' + searchord;
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- calconsorderdetails product detail -->
function calconsorderproddetails(yrmon,orderno,prodno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'calconsorderproddetails' + '&yrmon=' + yrmon + '&orderno=' + orderno + '&prodno=' + prodno;
  location.href = locationhref;
}

<!-- calconsorderdetailslist month detail -->
function calconsorderdetailslist(orderno) {
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname  + '&formname=' + 'calconsorderdetailslist' + '&orderno=' + orderno;
  location.href = locationhref;
}


<!-- popup printer friendly consignment barcode list -->
function barcodepfriendly()
{
  if (! window.focus)return true;
  var href;
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'barcodepf';
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- popup printer friendly consignment barcode list -->
function barcodeprint()
{
  if (! window.focus)return true;
  var href;
  locationhref = zhomebase + '?w3exec=' + zdriver + '&w3serverpool=' + zpoolname + '&formname=' + 'barcodeprint';
  window.open(locationhref, 'printfriendly', 'width=800,height=600,scrollbars=yes,resizable=1');
  return false;
}

<!-- script_zectric01.js end -->
