/*-------------------------------------------------------------------
  Copyright © 1999 by Integrated Business Technologies, Inc.
  ALL RIGHTS RESERVED, INCLUDING THE RIGHT OF REPRODUCTION
  IN WHOLE OR IN PART IN ANY FORM.

  NOTICE -- PROPRIETARY PROGRAM INFORMATION
  This program, whether in source code or object (compiled) code
  format, is not to be used, reproduced, or disclosed except in
  accordance with an authorized program license, or upon express
  written permission of Integrated Business Technologies, Inc.
-------------------------------------------------------------------*/

function PopAddToCart(passed) {
      window.open ('../oe/oeAddToCart.htm?cv=' + passed, '', "toolbars=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=590,height=100,left=50,top=50");
   }

function shopcartnav4 (passed,val2) {
  this.document.popcartform.qtyReq.focus();
}

function informmsg(passed) {
      alert('Use the edit button to update this field');
}

function informmsg2(passed) {
      alert('Use the edit icon at left to update this field');
}

function dynoform(pass1,pass2) {
var vmsg1 = pass1;
var vmsg2 = pass2;
if (!vmsg2) {document.templateform.stype2.value='begins';}
else {document.templateform.stype2.value='exact';}
document.templateform.searchbox.value=pass1;
document.templateform.navivalue.value='newsearch';
document.templateform.submit();
//navigate5(' ','newsearch');
}

function dynoform2(pass1,pass2) {
//var vmsg1 = pass1;
//var vmsg2 = pass2; 
//alert(pass2);
//input type=text name=searchbox size=22 value="">&nbsp;<input class="btnDisp" type="button" 
//onclick="navigate5(' ','newsearch')" value="Go">
document.templateform.partadd.value=pass1;
document.templateform.partqtyadd.value=pass2;
navigate2(pass1,'quickadd');
}

function commentShow(passed) {
     document.mainform.cmmtShow.value=passed;
     document.mainform.navaction.value='oe/ShoppingCart.w';
     document.mainform.submit();
}

function d3dShow(passed) {
 //    document.orderinfoform.vialist.value=passed;
     var inSH1 = document.getElementById("d3d"); 
//     var sh1 = document.shipbillform.i3pbnote.value;

     var sh1 = passed;
     var shortsh1 = sh1.substring(0,1);

     if (shortsh1 == "3") {
     d3d.style.visibility = "visible" ; } 
     else { d3d.style.visibility = "hidden" ; }   
     }

function shopcartnav2 (passed,val2) {
  this.document.popcartform.submit(); 
}

function shopcartnav3 (passed,val2) {
  this.document.popcartform.scAIN.value='';   
  this.document.popcartform.qtyReq.value='';
  this.document.popcartform.scAIN.focus();
}

function shopcartcmmt2 (passed,val2) {
  this.document.popcmmtform.submit(); }

function poptemplate(passed) 
{LeftPosition = (screen.width) ? (screen.width-690)/2 : 0;
 TopPosition = (screen.height) ? (screen.height-460)/2 : 0; 
 pcwin=window.open(passed,'oetemplate','toolbar=no,directories=no,addressbar=no,resizable=yes,menubar=yes,scrollbars=auto,left='+LeftPosition+',top='+TopPosition+',width=615,height=455');
   pcwin.focus();
}

function popcart(passed) 
{ pcwin=window.open(passed,'oeshopcart','toolbar=no,directories=no,addressbar=no,resizable=yes,menubar=no,scrollbars=auto,left=51,top=80,width=550,height=150');
   pcwin.focus();
}

function popcmmt(passed,val1,val2) 
{LeftPosition = (screen.width) ? (screen.width-770)/2 : 0;
TopPosition = (screen.height) ? (screen.height-55)/2 : 0; 
pcmmtwin=window.open(passed,'oepopcmmt','toolbar=no,directories=no,addressbar=no,resizable=yes,menubar=no,scrollbars=auto,left='+LeftPosition+',top='+TopPosition+',width=770,height=55');
   pcmmtwin.focus();
   //pcmmtwin.document.popcmmtform.itemDetail.value = val1;
}

function popline(passed,val1) 
{LeftPosition = (screen.width) ? (screen.width-520)/2 : 0;
TopPosition = (screen.height) ? (screen.height-40)/2 : 0; 
plinewin=window.open(passed,'oepopline','toolbar=no,directories=no,addressbar=no,resizable=yes,menubar=no,scrollbars=auto,left='+LeftPosition+',top='+TopPosition+',width=520,height=130');
   plinewin.focus();
   }

function popline2(passed,val1) 
{LeftPosition = (screen.width) ? (screen.width-400)/2 : 0;
TopPosition = (screen.height) ? (screen.height-10)/2 : 0; 
plinewin=window.open(passed,'oepopline','toolbar=no,directories=no,addressbar=no,resizable=yes,menubar=no,scrollbars=auto,left='+LeftPosition+',top='+TopPosition+',width=400,height=60');
   plinewin.focus();
   }
function cfgpop(valin)
{ setval = '../af/config.w?cv=' + valin;
window.open(setval,'cfgpop','height=285,width=560,menubar=no,resizable=no,status=no,toolbar=no,left=125,top=80');
}

function popsetshipinfo(pagein) 
{ window.open(pagein,'ssi','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=383,height=310');
}

function popimage(pagein) 
{ window.open(pagein,'pi','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=313,height=290');
}

function popimage2(pagein) 
{ 
window.open(pagein,'pi2','top=160,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=160,width=520,height=520');
}

function OpenWindow(pagein) 
{ window.location.replace(pagein)
}

function ZpenWindow(pagein) 
{ window.open(pagein ,'NewWindow','top=10,toolbar=no,resizable=yes,directories=no,menubar=yes,scrollbars=yes,left=10,width=916,height=730')
}

function navAction(navvalue) {
   document.mainform.navaction.value=navvalue;
   document.mainform.submit();
}   

function aiAction(navvalue,aiaction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.aiprocedure.value=aiaction;
   document.mainform.submit();
}   

function aflogAction(navvalue,aflogaction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.aflogprocedure.value=aflogaction;
   document.mainform.submit();
}   

function aflogDeleteAction(navvalue,aflogdeleteaction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.aflogprocedure.value=aflogdeleteaction;
   if (confirm('You are about to remove the Total Number of Log File Messages in all Pages. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.submit();
         }
      else { 
           this.document.mainform.submit();
           }
}  

function afuserAction(navvalue,afuseraction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.afuserprocedure.value=afuseraction;
   document.mainform.submit();
}  

function afcustomAction(navvalue,afcustomaction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.afcustomprocedure.value=afcustomaction;
   document.mainform.submit();   
}   

function afcustomDelete(navvalue,afcustomDelete,currentrowid) {
   document.mainform.navaction.value=navvalue;
   document.mainform.afcustomprocedure.value=afcustomDelete;
   if (confirm('You are about to remove an application support item. \nYou can damage InWDS. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=currentrowid;
           this.document.mainform.submit();
         }
      else { 
           this.document.mainform.submit();
           }
}  

  function itemDetail2(passed) {
     this.opener.mainform.itemDetail.value=passed;
     this.opener.mainform.sortclause.value='';
     this.opener.mainform.whereclause.value='';
//   this.opener.mainform.queryrow.value=row;
     this.opener.mainform.navaction.value='pl/ProductLookupItemDetail.w';
     this.opener.mainform.submit();
}

  function cartDetail(passed, row) {
     document.mainform.cartDetail.value=passed;
     document.mainform.cartrowid.value=row;
     document.mainform.navaction.value='oe/ShoppingCart.w';
     document.mainform.submit();
}

function sidemenuShow(passed) {
 var viz = document.getElementById("basessm").style.visibility;
// alert(viz);
//     document.mainform.sidemenu.value=passed;
//     var inSH1 = document.getElementById("basessm"); 
//     var sh1 = document.mainform.sidemenu.value;
//     var shortsh1 = sh1.substring(0,1);
//     if (shortsh1 == "h") {
//     basessm.style.visibility = "hidden" ; } 
//     else {      basessm.style.visibility = "visible" ; }   
     var shortsh1 = viz.substring(0,1);
     if (shortsh1 == "h") {
     document.mainform.sidemenu.value='visible';
     basessm.style.visibility = "visible" ; } 
     else {      
     document.mainform.sidemenu.value='hidden';
     basessm.style.visibility = "hidden" ; }   
     }

  function TemplateDetail(passed, row) {
     document.mainform.cartDetail.value=passed;
     document.mainform.cartrowid.value=row;
     document.mainform.navaction.value='oe/TemplateCart.w';
     document.mainform.submit();
}

  function invoiceDetail(passed, row) {
     document.mainform.invoiceDetail.value=passed;
     document.mainform.iqueryrow.value=row;
     document.mainform.navaction.value='ai/AccountStatusInvoiceLines.w';
     document.mainform.submit();
}     
 
  function startSearch() {
     document.mainform.navaction.value='pl/SearchResults.w';
     document.mainform.submit();
  }

  function startGenSearch() {
     document.mainform.navaction.value='tools/genResults.w';
     document.mainform.submit();
  }

  function newSearch(passed) {
     document.mainform.resetsearch.value=passed;
     document.mainform.navaction.value='pl/ProductSearchHome.w';
     document.mainform.submit();
  }

  function resultSetNav(resultpage, navvalue) {
     document.mainform.navaction.value = navvalue;
     document.mainform.ResultNavPage.value = resultpage;
     document.mainform.submit();
  }
  
  function resultSetNavSC(resultpage, navvalue) {
     document.mainform.partaction.value='additem';
     document.mainform.navaction.value = navvalue;
     document.mainform.ResultNavPage.value = resultpage;
     document.mainform.submit();
  }

  function resultSetAddSC(itemdet, navvalue) {
     document.mainform.partaction.value='qadditem';
     document.mainform.navaction.value = navvalue;
     document.mainform.itemDetail.value = itemdet;
     document.mainform.submit();
  }

  function itemNav(navvalue) {
      document.mainform.navaction.value='pl/ProductLookupItemDetail.w';
     document.mainform.plidNavaction.value=navvalue;
     document.mainform.submit();
  }
  
   function OrderNav(navvalue) {
      document.mainform.navaction.value='os/OrderStatusOrderDetail.w';
     document.mainform.OrddetNavaction.value=navvalue;
     document.mainform.submit();
  }
   
    function InvoiceNav(navvalue) {
      document.mainform.navaction.value='ai/AccountStatusInvoiceDetail.w';
     document.mainform.InvdetNavaction.value=navvalue;
     document.mainform.submit();
  }
   
   function OrderNavLine(navvalue, navaction) {
      document.mainform.navaction.value=navaction;
     document.mainform.OrddetNavaction.value=navvalue;
     document.mainform.submit();
  }

   function InvoiceNavLine(navvalue, navaction) {
      document.mainform.navaction.value=navaction;
     document.mainform.InvdetNavaction.value=navvalue;
     document.mainform.submit();
  }

  function tracknav (passed) {
    document.mainform.navaction.value='af/TSList.w';
    document.mainform.partaction.value=passed;
    document.mainform.submit() ;    
  }

  function shopcartnav (passed) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value=passed;
    document.mainform.submit() ;    
  }

  function templatenav (passed) {
    document.mainform.navaction.value='oe/TemplateCart.w';
    document.mainform.partaction.value=passed;
    document.mainform.submit() ;    
  }

  function quotecartnav (passed) {
    document.mainform.navaction.value='oe/quoteCart.w';
    document.mainform.partaction.value=passed;
    document.mainform.submit() ;    
  }

    function cartlinedel (passed, row) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value=passed;
    
      if (confirm('You are about to remove item from shopping cart. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
         }
      else { 
           this.document.mainform.submit();
           }
   }

    function webentitydel (passed, row, drow) {
    document.mainform.navaction.value='af/AfEntityListing.w';
    document.mainform.useraction.value=passed;
    
      if (confirm('You are about to remove an entity from this user. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.deleterowid.value=drow;
           this.document.mainform.submit();
         }
      else { 
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
           }
   }
    
    function webentityadd (passed, row) {
    document.mainform.navaction.value='af/AfEntityListing.w';
    document.mainform.useraction.value=passed;
    document.mainform.currentrowid.value=row;
    this.document.mainform.submit();
   }
 
    function afcustomedit (passed, row, pnum) {
    document.mainform.navaction.value='af/AfCustomCreate.w';
    document.mainform.afcustomaction.value=passed;
    document.mainform.currentrowid.value=row;
    this.document.mainform.submit();
   }

    function timesheetedit (passed, row, pnum) {
    document.mainform.navaction.value='af/TSCustomCreate.w';
    document.mainform.timesheetaction.value=passed;
    document.mainform.afcustomaction.value=passed;
    document.mainform.currentrowid.value=row;
    this.document.mainform.submit();
   }
    
    function webuserentity (passed, row, pnum) {
    document.mainform.navaction.value='af/AfEntityListing.w';
    document.mainform.useraction.value=passed;
    document.mainform.currentrowid.value=row;
    this.document.mainform.submit();
   }

    function cartlineedit (passed, row, pnum) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value=passed;
    document.mainform.currentrowid.value=row;
    this.document.mainform.submit();
   }

    function addtocart (passed) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value='addpart';
    document.mainform.scAIN.value=passed;
    document.mainform.submit() ;    
  }

   function cartsearch(passed) {
      document.mainform.navaction.value=passed;
      this.document.mainform.submit();
   }
   
   function ClearCart(passed) {   
   document.mainform.navaction.value='oe/ShoppingCart.w';
   document.mainform.partaction.value=passed;
      if (confirm('You are about to delete your shopping cart. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.submit();   }
      else { this.document.mainform.submit(); }
 }

   function UpdateCart(passed) {   
   document.mainform.navaction.value='oe/ShoppingCart.w';
   document.mainform.partaction.value=passed;
      if (confirm('You are about to update your shopping cart. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit(); }
      else { }
 }

   function UpdateTemplate(passed) {   
   document.mainform.navaction.value='oe/TemplateCart.w';
   document.mainform.partaction.value=passed;
      if (confirm('You are about to update your template. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit(); }
      else { }
 }
  
function UpdateCart2(passed) {   
   var vone = 'dleetline,' + passed;
   document.mainform.navaction.value='oe/ShoppingCart.w';
   document.mainform.partaction.value=vone; 
      if (confirm('You are about to delete a line. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit();
         }
      else {  }
 }

 function UpdateTemplate2(passed) {   
   var vone = 'dleetline,' + passed;
   document.mainform.navaction.value='oe/TemplateCart.w';
   document.mainform.partaction.value=vone; 
      if (confirm('You are about to delete a line. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit();
         }
      else {  }
 }

   function UpdateQuote(passed) {   
   document.mainform.navaction.value='oe/QuoteCart.w';
   document.mainform.partaction.value=passed;
      if (confirm('You are about to update your Quote. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit();
         }
      else {            
           }
 }

   function DeleteCarts(passed) {   
   document.mainform.navaction.value='oe/ShoppingCart.w';
   document.mainform.partaction.value=passed;
      if (confirm('You are about to modify a PO# for an existing cart,\nor you are about to delete an existing shopping cart. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit();
         }
      else { }
 }

   function DeleteTemplates(passed) {   
   document.mainform.navaction.value='oe/TemplateCart.w';
   document.mainform.partaction.value=passed;
      if (confirm('You are about to modify a PO# for an existing template,\nor you are about to delete an existing Template. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit();
         }
      else { }
 }

function DeleteCarts2(passed) {   
 var vone = 'deleetcart,' + passed;
   document.mainform.navaction.value='oe/ShoppingCart.w';
   document.mainform.partaction.value=vone;
      if (confirm('You are about to delete an existing shopping cart. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit(); }
      else { }
 }

function DeleteTemplates2(passed) {   
 var vone = 'deleetcart,' + passed;
   document.mainform.navaction.value='oe/TemplateCart.w';
   document.mainform.partaction.value=vone;
      if (confirm('You are about to delete an existing template. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit(); }
      else { }
 }

   function UpdateCartOS(passed) {   
   document.mainform.navaction.value='os/orderstatuslinedetail.w';
   document.mainform.partaction.value=passed;
      if (confirm('You are about to add the checked items to your shopping cart. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="No";
           this.document.mainform.submit();
         }
      else {            
           }
 }

   function SyncCust(navvalue,passed) {   
   document.mainform.navaction.value=navvalue;
   document.mainform.partaction.value=passed;
      if (confirm('You are about to Sync AfCustInfo with Cust. \nAn Alert Box will indicate completion. \nAre you sure?'))
         { this.document.mainform.navaction.value=navvalue;
           this.document.mainform.partaction.value=passed;
           this.document.mainform.submit();
         }
      else { this.document.mainform.partaction.value="No Sync";
             
           }
 }
    function UpdateCartBR (passed, Category) {
    document.mainform.navaction.value='pl/BrowseResults.w';
    document.mainform.cattobrowse.value=Category;
    document.mainform.partaction.value='additem';
    document.mainform.osAIN.value=passed;
    document.mainform.submit() ;
   }

    function UpdateCartPL (passed) {
    document.mainform.navaction.value='pl/SearchResults.w';
    document.mainform.partaction.value='additem';
    document.mainform.osAIN.value=passed;
    document.mainform.submit() ;
   }

    function checkout (passed) {
    document.mainform.navaction.value='oe/ConfirmCust.w';
    document.mainform.checkoutaction.value=passed;
    document.mainform.submit() ;    
  }

    function quotecheckout (passed) {
    document.mainform.navaction.value='oe/QcConfirm.w';
    document.mainform.checkoutaction.value=passed;
    document.mainform.submit() ;    
  }

    function Lnk(passed) {
 window.open(passed,'PartLinx','toolbar=yes,addressbar=yes,resizable=yes,menubar=yes,scrollbars=yes,left=1');
var vx1 = document.getElementById("lnkuser"); 
var vx2 =  vx1.value ;
}

    function Lnk2() {
var v1 = "http://www.PartLinx.com/default.asp?cMemberDealerNumber=";
var v2 = "&cDistributorCode=DEY";
var vx1 = document.getElementById("lnkuser"); 
var vx2 =  vx1.value ;
var v3 = v1 + vx2 + v2;
 
window.open (v3,'PartLinx','toolbar=yes,addressbar=yes,resizable=yes,menubar=yes,scrollbars=yes,left=1');
}

    function Lnk3() {
var v1 = "http://www.PartLinx.com/default.asp?cMemberDealerNumber=";
var v2 = "&cDistributorCode=DEY";
var v3 = "&cPostBackOrder=http://192.168.10.13/scripts/cgiip.exe/WService=deytemp/af/apphome.w";
var vx1 = document.getElementById("lnkuser"); 
var vx2 =  vx1.value ;
var v4 = v1 + vx2 + v2 + v3;
 
window.open (v4,'PartLinx','toolbar=yes,addressbar=yes,resizable=yes,menubar=yes,scrollbars=yes,left=1');
    
}

   function ShipTrack(link) {
      window.open(link, 'ShipTrack', '');
   }

   function afsubmit() {
      if (document.mainform.navaction.value == '') {
         return false;
      }
      else {
         return true;
      }
   }

    function addtofull (passed, row) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value=passed;
    
      if (confirm('You are about to replicate this order to your open shopping cart. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
         }
      else { 
          
           }
   }
   
    function QuoteCart (passed, row) {
    document.mainform.navaction.value='oe/QuoteCart.w';
    document.mainform.partaction.value=passed;
    
      if (confirm('You are about to convert this quote to an order. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
         }
      else {           
           }
   }

    function QuoteFull (passed, row) {
    document.mainform.navaction.value='oe/QuoteCart.w';
    document.mainform.partaction.value=passed;
    
      if (confirm('You are currently converting another Quote to an Order. \nIf you continue now, the previous Quote conversion will need to be re-done. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
         }
      else {           
           }
   }
    
    function addtoempty (passed, row) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value=passed;
    
      if (confirm('You are about to replicate this order to a new open shopping cart. \nAre you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
         }
      else {           
           }
   }
    
    function additemtocart (passed) {
    document.mainform.navaction.value='os/orderstatuslinedetail.w';
    document.mainform.partaction.value='additem';
    document.mainform.scAIN.value=passed;
    document.mainform.submit() ;
   }

     function additemtocartpl (passed) {
    document.mainform.navaction.value='pl/SearchResults.w';
    document.mainform.partaction.value='additem';
    document.mainform.osAIN.value=passed;
    document.mainform.submit() ;
   }

    function additemtocartpd (passed) {
    document.mainform.navaction.value='pl/ProductLookupItemDetail.w';
    document.mainform.partaction.value='additem';
    document.mainform.osAIN.value=passed;
    document.mainform.submit() ;
   }

function CategoryNav(NavPage, BrowseStart, BrowseEnd) {
   document.mainform.catstart.value = BrowseStart;
   document.mainform.catend.value= BrowseEnd;
   document.mainform.navaction.value= NavPage;
   document.mainform.submit();
}

function SubCategoryBrowse(Category) {
    document.mainform.catbrowse.value=Category;
    document.mainform.navaction.value='pl/SubCatBrowseHome.w';
    document.mainform.submit();
}
   
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function roundOff(value, precision)
{  mfactor =  Math.pow(10, precision);
   var result = Math.round(value * mfactor) / mfactor;
        return result; 
}

function LowPrice()
{ if (Number(this.document.mainform.defaultprice.value) < Number(-999999))
   {   return this.document.mainform.defaultprice.value;   }
   else {      return Number(-999999);   }
}
// combine with code from the INTRANET version ....
function setcc(valin) {
 
var mstr1 = valin.substr(0,3);
if (mstr1 == "CCP") {
 this.document.mainform.ccuse[1].checked=true;
}
else {
 this.document.mainform.ccuse[0].checked=true;
}
}

function popsetshipinfo(pagein) 
{ window.open(pagein,'ssi','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=383,height=310');
}

function vccpopup(pagin) {

window.open(pagin,'quotepop','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=500,height=400');
}
function vcwindow() {

window.open('','vcwindow','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=600,height=600');
}

function OrderPopup(pagin) {
 window.open(pagin,'orderpop','top=1,toolbar=yes,resizable=yes,directories=no,menubar=yes,scrollbars=yes,left=1,width=620,height=620');
}

function ChangeOrderPop(pagin) {
 window.open(pagin,'changeorderpop','top=1,toolbar=yes,resizable=yes,directories=no,menubar=yes,scrollbars=yes,left=10,width=716,height=620');
}

function EditNotePop(pagin) {
 window.open(pagin,'enotepop','top=51,toolbar=no,resizable=no,directories=no,menubar=no,scrollbars=no,left=110,width=568,height=281');
}

function CustNotePop(pagin) {
 window.open(pagin,'cnotepop','top=80,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=no,left=125,width=568,height=281');
}

function CfgNotePop(pagin) {
 window.open(pagin,'cnotepop','top=90,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=no,left=135,width=568,height=281');
}

function EditCustShipPop(pagin) {
 window.open(pagin,'csepop','top=61,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=no,left=120,width=568,height=325');
}

function CustShipPop(pagin) {
 window.open(pagin,'csepop','top=80,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=no,left=125,width=541,height=270');
}

function AddNotePop(pagin) {
 window.open(pagin,'anotepop','top=90,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=no,left=130,width=568,height=281');
}

function emailpop(pagin) {
   var today_date= new Date();
window.open(pagin,'emailpop' + today_date.getTime(),'top=1,toolbar=no,resizable=no,directories=no,menubar=no,scrollbars=no,left=1,width=10,height=10');
return;
}

function quotepop(pagin) {
window.open(pagin,'quotepop','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=90,width=620,height=230');
return;}

function shiprateWin(zip,weight){
   ourl = 'http://dsinet/amp/inwdscf_modules/shippingrates.cfm?shipweight=' + weight + '&shipzip=' + zip;
   shiprateWindow=window.open(ourl,'shipratewin','width=660,height=300,toolbar=no,location=no,scrollbars=yes,left=100,top=100');
   shiprateWindow.focus();
}

function vaddress(city,state,zip){
   ourl = 'http://dsinet/amp/inwdscf_modules/address_validation.cfm?city=' + city + '&state=' + state + '&zipcode=' + zip;
   shiprateWindow=window.open(ourl,'shipratewin','width=660,height=300,toolbar=no,location=no,scrollbars=auto,left=100,top=100');
   shiprateWindow.focus();
}
function CountChecked(vField,currentBox)
{
   i = 0;
   j = 0;
   while (i < vField.length) {
      
      if (vField[i].checked == true) {
         j = j + 1;
         if (j > 8) {
            currentBox.checked = false;
         }
      }
      i++;
   }           
   if (j > 8) {
      alert('Please Limit Comments to 8 Selections');      
   }
}
function Set3PBill(fieldname)
{
      if (fieldname == 'shipvia') {
//       this.document.shipbillform.i3pbnote.value=(this.document.shipbillform.shipvia.value);
//alert(this.document.mainform.vialist.value);
    d3dShow(this.document.mainform.vialist.value);
//      document.mainform.submit();
      }
}

function fnTrapKD(){
	if(event.keyCode = '13'){
		event.returnValue=false;
	}
   else
   { event.returnValue=true;
   }
}

function fnTabEnter(){
  if (window.event.keyCode==13) window.event.keyCode=13;}

function LowPrice2()
{ if (Number(this.document.itemform.defaultprice.value) < Number(this.document.itemform.slipprice.value))
   {   return this.document.itemform.defaultprice.value;   }
   else {      return this.document.itemform.slipprice.value;   }

}
function SetPrice()
{
 /*   if (this.document.itemform.iiprice.value > this.document.itemform.keyprice.value) {
   this.document.itemform.iiprice.value = this.document.itemform.keyprice.value;
   } */
   inprice = Number(Number(this.document.itemform.iiprice.value) / Number(this.document.itemform.cuomqty.value));
   lowprice = Number(LowPrice2());
   pricetype = this.document.itemform.iipricetype.value;

   if (pricetype == 'R' || pricetype == 'G' || pricetype == 'S') {
         if (inprice < LowPrice2()) {
   this.document.itemform.iiprice.value = (Number(LowPrice2()) * Number(this.document.itemform.cuomqty.value));
   }
   }
}

function CalcPrice(fieldname)
{
   SetPrice();
      if (fieldname == 'price') {
      
         this.document.itemform.iimargin.value=roundOff(((1 - (this.document.itemform.standardcost.value/(Number(this.document.itemform.iiprice.value) / Number(this.document.itemform.cuomqty.value)))) * 100),2);
         this.document.itemform.iiprice.value=roundOff(this.document.itemform.iiprice.value,4);

      }

      if (fieldname == 'margin') {
      
         this.document.itemform.iiprice.value=roundOff((this.document.itemform.standardcost.value/(1 - (this.document.itemform.iimargin.value/100)) * this.document.itemform.cuomqty.value),4); 
         this.document.itemform.iimargin.value=roundOff(this.document.itemform.iimargin.value,2);
         CalcPrice('price');
      }

}

function PriceUp()
{
   pu = Number(roundOff(this.document.itemform.iiprice.value,4));
   pu = Number(pu) + Number(0.1);
   this.document.itemform.iiprice.value=pu;

   CalcPrice('price');

}
function PriceDown()
{
   pd = Number(roundOff(this.document.itemform.iiprice.value,4));
   pd = Number(pd) - Number(0.1);
   this.document.itemform.iiprice.value=pd;

   CalcPrice('price');
   }

function MarginUp()
{
   mu = Number(roundOff(this.document.itemform.iimargin.value,2));
   mu = Number(mu) + Number(0.1);
   this.document.itemform.iimargin.value=mu;
   CalcPrice('margin');
   SetPrice();
   CalcPrice('price');

}
function MarginDown()
{
   md = Number(roundOff(this.document.itemform.iimargin.value,2));
   md = Number(md) - Number(0.1);
   this.document.itemform.iimargin.value=md;
   CalcPrice('margin');
   SetPrice();
   CalcPrice('price');
   }

function roundOff(value, precision)
{

   mfactor =  Math.pow(10, precision);
   var result = Math.round(value * mfactor) / mfactor;
   /*

        value = "" + value //convert value to string
        precision = parseInt(precision);

        var whole = "" + Math.round(value * Math.pow(10, precision));

        var decPoint = whole.length - precision;

        if(decPoint != 0)
        {
                result = whole.substring(0, decPoint);
                result += ".";
                result += whole.substring(decPoint, whole.length);
        }
        else
        {
                result = whole;
        }
        
        */

        return result;
}


function defaultsearch()
{ 
   
   if (this.keycode='undefined')
{
  document.mainform.navaction.value='dsic/appframe.w';
  document.mainform.navvalue.value='newsearch';
  document.mainform.submit();
}
else {}

}
function popaddon(pagein) 
{ window.open(pagein,'addlookup','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=710,height=400');
return;
}
function popaddlookup(pagein) 
{ window.open(pagein,'addon','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=700,height=370');
return;
}
function poptermsedit(pagein) 
{ window.open(pagein,'popterms','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=421,height=135');
return;
}
function popccedit(pagein) 
{ window.open(pagein,'popcc','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=400,height=173');
return;
}
function poppoedit(pagein) 
{ window.open(pagein,'poppo','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=350,height=135');
return;
}
function popshipdateedit(pagein) 
{ window.open(pagein,'sd','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=350,height=135');
return;
}
function popholdflagedit(pagein) 
{ window.open(pagein,'sd','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=350,height=145');
return;
}
function popshipviaedit(pagein) 
{ window.open(pagein,'sve','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=425,height=145');
return;
}
function popvoidedit(pagein) 
{ window.open(pagein,'pve','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=350,height=160');
return;
}
function popshipinfoedit(pagein) 
{ window.open(pagein,'sd','top=5,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=70,width=575,height=380');
return;
}
function popcomp(pagein) 
{ window.open(pagein,'compinfo','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=540,height=230');
return;
}
function popcartitem(pagein) 
{ window.open(pagein,'cartitem','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=610,height=275');
return;
}
function p2(pagein) 
{ window.open(pagein,'cartitem','top=150,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=155,width=610,height=275');
return;
}

function poplcomments(pagein) 
{ window.open(pagein,'lcomments','top=100,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=auto,left=150,width=540,height=475');
return;
}
function a2(pagein) 
{ window.open(pagein,'add','top=100,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=yes,left=150,width=789,height=470');
return;
}

function navAction(navvalue) {
   document.mainform.navaction.value=navvalue;
   document.mainform.submit();
}   

function deletetemplate() {    
      if (confirm('You are about to delete your active template. Are you sure?'))
         { this.document.templateform.navvalue.value='deletetemplate';
           this.document.templateform.submit();   }
   }

function deletesmcart() {    
      if (confirm('You are about to delete your active cart. Are you sure?'))
         { this.document.mainform.navvalue.value='deletecart';
           this.document.mainform.submit();
         }
      else { 
          /* this.document.mainform.submit() */;
           }
   }

function deletescitem(itemid) {    
      if (confirm('You are about to delete this item from your cart. Are you sure?'))
         { this.document.mainform.navvalue.value='deleteitem,' + itemid;
           this.document.mainform.submit();
         }
      else { 
          /* this.document.mainform.submit() */;
           }
   }

function deletetmpitem(itemid) {    
      if (confirm('You are about to delete this item from your template. Are you sure?'))
         { this.document.templateform.navvalue.value='deleteitem,' + itemid;
           this.document.templateform.submit(); }
      else { }
   }

function deleteoitem(itemid) {
    
      if (confirm('You are about to delete this item from your order. Are you sure?'))
         { this.document.maintform.navvalue.value='deleteitem,' + itemid;
           this.document.maintform.submit();
         }
      else { 
          /* this.document.mainform.submit() */;
           }
   }

function deletenote(noteid) {
    
      if (confirm('You are about to delete this note. Are you sure?'))
         { this.document.notesform.navnoteaction.value='deletenote,' + noteid;
           this.document.notesform.submit();
           document.mainform.submit();
         }
      else { 
          /* this.document.mainform.submit() */;
           }
   }

function deletecustship(shipid) {    
      if (confirm('You are about to delete this ship-to. Are you sure?'))
         { this.document.shipsform.navnoteaction.value='deleteship,' + shipid;
           this.document.shipsform.submit();
           document.mainform.submit();
         }
      else { 
          /* this.document.mainform.submit() */;
           }
   }

function qdup(qid) {
      if (confirm('You are about to upgrade this quote to an order. Are you sure?'))
         { this.document.mainform.navdo.value='orderize,' + qid;
           this.document.mainform.submit();
         }
      else { 
          /* this.document.mainform.submit() */;
           }
   }
function qddown(qid) {
      if (confirm('You are about to move this quote to a shopping cart. Are you sure?'))
         { this.document.mainform.navdo.value='cartize,' + qid;
           this.document.mainform.submit();
         }
      else { 
          /* this.document.mainform.submit() */;
           }
   }

function replk8(oid) {
      if (confirm('You are about to replicate this data to a new shopping cart. Are you sure?'))
         { this.document.mainform.navdo.value='replk8,' + oid;
           this.document.mainform.submit();
         }
      else { 
          /* this.document.mainform.submit() */;
           }
   }

function MoreInfo(pagein) 
{ window.open(pagein,'MoreInfo','top=0,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=yes,left=0,width=820,height=600')
}
function TestOpenWindow(pagein,navaction,navvalue) 
{ window.open(pagein + "?navaction=" + navaction + "&navvalue=" + navvalue,'NewWindow','top=0,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=yes,left=0,width=820,height=600')
}

function navigate(navactionv, navvaluev)
{this.document.mainform.navaction.value=navactionv;
this.document.mainform.navvalue.value=navvaluev;
this.document.mainform.submit(); }

function navigate2(navactionv, navvaluev)
{this.document.templateform.partadd.value=navactionv;
this.document.templateform.navivalue.value=navvaluev;
this.document.templateform.submit(); }

function navigate3(navactionv, navvaluev)
{this.document.templateform.orderadd.value=navactionv;
this.document.templateform.navivalue.value=navvaluev;
this.document.templateform.submit(); }

function navigate4(navactionv, navvaluev)
{this.document.templateform.custpartadd.value=navactionv;
this.document.templateform.navivalue.value=navvaluev;
this.document.templateform.submit(); }

function navigate5(navactionv, navvaluev)
{this.document.templateform.custpartadd.value=navactionv;
this.document.templateform.navivalue.value=navvaluev;
this.document.templateform.submit(); }

function navigate6(navactionv, navvaluev)
{this.document.templateform.invitemadd.value=navactionv;
this.document.templateform.navivalue.value=navvaluev;
this.document.templateform.submit(); }

function hidetmp2(navvaluev)
{this.document.templateform.navvalue.value='hide';
this.document.templateform.submit(); }

function showtmp2(navvaluev)
{this.document.templateform.navivalue.value='blanksearch';
this.document.templateform.navvalue.value='';
this.document.templateform.submit(); }

function switchcart() {
   this.document.mainform.navvalue.value='switchcart';
   this.document.mainform.submit();  }

function switchtemplate() { this.document.templateform.navvalue.value='switchtemplate';
   this.document.templateform.submit(); }

function switchtemplate2() { this.document.templateform.navvalue.value='switchtemplate2';
   this.document.templateform.submit(); }

function switchtemplate3() { this.document.templateform.navvalue.value='switchtemplate3';
   this.document.templateform.submit(); }

function picktype() { this.document.templateform.navvalue.value='searchtype3';
   this.document.templateform.searchbox.value='';
   this.document.templateform.submit(); }

function aiAction(navvalue,aiaction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.aiprocedure.value=aiaction;
   document.mainform.submit();
}   

function chkoutAction(passed) {
   document.mainform.navaction.value='os/OrderStatusListing.htm';
   document.mainform.osprocedure.value='ordquicksearch';
   document.mainform.inputordnum.value=passed;
   document.mainform.submit();
}   

function osAction(navvalue,osaction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.osprocedure.value=osaction;
   document.mainform.submit();
}   

function aflogAction(navvalue,aflogaction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.aflogprocedure.value=aflogaction;
   document.mainform.submit();
}   

function afuserAction(navvalue,afuseraction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.afuserprocedure.value=afuseraction;
   document.mainform.submit();
}   

  function itemDetail(passed, row) {
     document.mainform.itemDetail.value=passed;
     document.mainform.queryrow.value=row;
     document.mainform.navaction.value='pl/ProductLookupItemDetail.w';
     document.mainform.submit();
}

  function invoiceDetail(passed, row) {
     document.mainform.invoiceDetail.value=passed;
     document.mainform.iqueryrow.value=row;
     document.mainform.navaction.value='ai/AccountStatusInvoiceLines.w';
     document.mainform.submit();
}
     
   function OrderDetail(passed, row) {
     document.mainform.orderDetail.value=passed;
     document.mainform.oqueryrow.value=row;
     document.mainform.navaction.value='os/OrderStatusLineDetail.w';
     document.mainform.submit();
}
 
  function newSearch(passed) {
     document.mainform.resetsearch.value=passed;
     document.mainform.navaction.value='pl/ProductSearchHome.w';
     document.mainform.submit();
  }

  function resultSetNav(resultpage, navvalue) {
     document.mainform.navaction.value = navvalue;
     document.mainform.ResultNavPage.value = resultpage;
     document.mainform.submit();
  }

  function itemNav(navvalue) {
      document.mainform.navaction.value='pl/ProductLookupItemDetail.w';
     document.mainform.plidNavaction.value=navvalue;
     document.mainform.submit();
  }

    function cartlinedel (passed, row) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value=passed;
    
      if (confirm('You are about to remove item from shopping cart. Are you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
         }
      else { 
           this.document.mainform.submit();
           }
   }

    function webuserdel (passed, row) {
    document.mainform.navaction.value='af/AfUserListing.w';
    document.mainform.useraction.value=passed;    
      if (confirm('You are about to remove a user from the system. Are you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
         }
      else { 
           this.document.mainform.submit();
           }
   }

    function webuseredit (passed, row, pnum) {
    document.mainform.navaction.value='af/AfCreateListing.w';
    document.mainform.useraction.value=passed;
    document.mainform.currentrowid.value=row;
    this.document.mainform.submit();
   }

    function cartlineedit (passed, row, pnum) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value=passed;
    document.mainform.currentrowid.value=row;
    this.document.mainform.submit();
   }

    function addtocart (passed) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value='addpart';
    document.mainform.scAIN.value=passed;
    document.mainform.submit() ;    
  }

   function cartsearch(passed) {
      document.mainform.navaction.value=passed;
      this.document.mainform.submit();
   }
   
   function ClearCart(passed) {   
   document.mainform.navaction.value='oe/ShoppingCart.w';
   document.mainform.partaction.value=passed;
      if (confirm('You are about to delete your shopping cart, Are you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.submit();
         }
      else { 
           this.document.mainform.submit();
           }
 }


    function checkout (passed) {
    document.mainform.navaction.value='oe/ConfirmCust.w';
    document.mainform.checkoutaction.value=passed;
    document.mainform.submit() ;    
  }

    function AppLogOut(passed) {
       document.mainform.navaction.value='af/applogin.w';
       document.mainform.applogout.value=passed;
       document.mainform.submit();
//       if (!(pcwin.closed))
//          {pcwin.close();}
//       else {
//       }
    }


   function ShipTrack(link) {
      window.open(link, 'ShipTrack', '');
   }

   function crtDemoUser() {
      window.open ('crtDemo.htm', 'createDemoUser', "toolbars=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=560,left=50,top=50");
   }

   function crtRetailUser() {
      window.open ('crtretail.htm', 'createRetailUser', "toolbars=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=560,left=50,top=50");
   }

   function popContact() {
  //ourl = 'http://192.168.10.13/contact.htm'
      window.open ('contact.htm', 'createDemoUser', "toolbars=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=560,left=50,top=50");
   }

   function afsubmit() {
      if (document.mainform.navaction.value == '') {
         return false;
      }
      else {
         return true;
      }
   }

    function addtofull (passed, row) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value=passed;
    
      if (confirm('You are about to replicate this order to your existing shopping cart. Are you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
         }
      else {           
           }
   }
    
    function addtoempty (passed, row) {
    document.mainform.navaction.value='oe/ShoppingCart.w';
    document.mainform.partaction.value=passed;    
      if (confirm('You are about to replicate this order to the shopping cart. Are you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();
         }
      else {           
           }
   }
    
    function additemtocart (passed) {
    document.mainform.navaction.value='os/orderstatuslinedetail.w';
    document.mainform.partaction.value='additem';
    document.mainform.scAIN.value=passed;
    document.mainform.submit() ;
   }

     function additemtocartpl (passed) {
    document.mainform.navaction.value='pl/SearchResults.w';
    document.mainform.partaction.value='additem';
    document.mainform.osAIN.value=passed;
    document.mainform.submit() ;
   }

    function additemtocartpd (passed) {
    document.mainform.navaction.value='pl/ProductLookupItemDetail.w';
    document.mainform.partaction.value='additem';
    document.mainform.osAIN.value=passed;
    document.mainform.submit() ;
   }
   
 function ShowHide() {
   var inSH1 = document.getElementById("inSH1"); 
   var sh1 = document.shipviaform.vialist.value;
   var shortsh1 = sh1.substring(0,1);
   inSH1.style.visibility = (shortsh1 == "3") ? "visible" : "hidden";   
   inSHLabel.style.visibility = (shortsh1 == "3") ? "visible" : "hidden";
  }

  function setcss(cssid) {    
      if (confirm('You are about to set this style sheet as default. Are you sure?'))
         { this.document.cfgcssform.cfgcssaction.value='setcss,' + cssid;
           this.document.cfgcssform.submit();
           this.document.mainform.submit(); }
      else { }
   }

function ifmAction(navvalue,ifmaction) {
   document.mainform.navaction.value=navvalue;
   document.mainform.ifmprocedure.value=ifmaction;
   document.mainform.submit();
}   

function ifmedit(valuein)
{ setval = '../lib/ifmedit.w?cv=' + valuein;
window.open(setval,'cfgpop','height=325,width=560,menubar=no,resizable=no,status=no,toolbar=no,left=125,top=80');
}

function ifmedit2(valuein)
{ setval = '../lib/ifmedit2.w?cv=' + valuein;
window.open(setval,'cfgpop','height=640,width=550,menubar=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,left=125,top=30');
}

function temporaryEditCustShipPop(pagin) {
 window.open(pagin,'csepop','top=61,toolbar=no,resizable=yes,directories=no,menubar=no,scrollbars=no,left=120,width=568,height=325');
}

function DataDownloadEdit (passed, row, pnum) {
    document.mainform.navaction.value='lib/ifmee2Listing.w';
    document.mainform.useraction.value=passed;
    document.mainform.currentrowid.value=row;
    this.document.mainform.submit(); }

function DataDowndel (passed, row) {
    document.mainform.navaction.value='lib/ifmee2Listing.w';
    document.mainform.useraction.value=passed;
    
      if (confirm('You are about to remove a record from the system. Are you sure?'))
         { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.currentrowid.value=row;
           this.document.mainform.submit();         }
      else { this.document.mainform.DeleteConfirm.value="Yes";
           this.document.mainform.submit();         }
   }

function mbar1 () {
  var SH1 = document.getElementById("prenavbar"); 
  var SH2 = document.getElementById("smallnavbar"); 
  SH1.style.visibility = "hidden";   
  SH2.style.visibility = "visible";  
  this.document.mainform.toolbar1.value="show";   }

function mbar2 () {
  var SH1 = document.getElementById("prenavbar"); 
  var SH2 = document.getElementById("smallnavbar"); 
  SH1.style.visibility = "visible";   
  SH2.style.visibility = "hidden";   
  this.document.mainform.toolbar1.value="hide";   }

function fbar1 () {
  var FSH1 = document.getElementById("fbar"); 
  var FSH2 = document.getElementById("f2bar"); 
  FSH1.style.visibility = "hidden";   
  FSH2.style.visibility = "visible";  
this.document.mainform.footer1.value="show";   }

function fbar2 () {
  var FSH1 = document.getElementById("fbar"); 
  var FSH2 = document.getElementById("f2bar"); 
  FSH1.style.visibility = "visible";   
  FSH2.style.visibility = "hidden";   
  this.document.mainform.footer1.value="hide";
   }

// ocell supports hiding/showing the additem cell
//function ocell1 () {
//  var OSH1 = document.getElementById("ocell"); 
//  var OSH2 = document.getElementById("o2cell"); 
//  OSH1.style.visibility = "visible";   
//  OSH2.style.visibility = "hidden";   
//  this.document.mainform.oaddcell.value="show";
//   }

//function ocell2 (id,shtml) {
//   if (document.getElementById || document.all) {
//      var el = document.getElementById? document.getElementById(id): document.all[id];
//      if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
//   }
//}

//cchg supports hiding/showing the additem cell
function cchg (id,shtml) {
//var i, n;
// if (document.getElementById || document.all) {
//  var el = document.getElementById? document.getElementById(id): document.all[id];
//  if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
//for (var i=6; i>0; i--) {
//var fnew = new String(i);
//var vlnew   = 'cellcmt' + fnew;
//var vlnewer = 'csh' + fnew;
//var shonew = 'cellcmthide' + fnew;
//var hidnew = 'csi' + fnew;
if (id=='ocell1') {
commentShow('yes');
//cellback(vlnew,vlnewer);
}
else {
//cellback(shonew,hidnew);
commentShow('no');
  }
}

function cellback (cid,cidswitch) {
var lvs = '<span id=cellcmthide1><td></td></span>';
   if (document.getElementById || document.all) {
      var ccel = document.getElementById? document.getElementById(cid): document.all[cid];
      if (ccel && typeof ccel.innerHTML != "undefined") ccel.innerHTML = lvs;
 }
}
//cchg2 supports hiding/showing the additem cell
function cchg2 (id,shtml) {
var i, n;
n=4;
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById(id): document.all[id];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
for (var i=6; i>0; i--) {
var fnew = new String(i);
var vlnew   = 'cellcmt' + fnew;
var vlnewer = 'csh' + fnew;
var shonew = 'cellcmthide' + fnew;
var hidnew = 'csi' + fnew;
if (id=='ocell1') {
if (document.getElementById || document.all) {
      var ccel = document.getElementById? document.getElementById(vlnew): document.all[vlnew];       
      if (ccel && typeof ccel.innerHTML != "undefined") ccel.innerHTML = vlnewer;
}
//cellback2(vlnew,vlnewer);
}
else {
cellback3(shonew,hidnew);
}
  }
 }
}

function cellback2 (cid,cidswitch) { 
var lvs = '<span id=cellcmthide1><td>test</td></span>';
   if (document.getElementById || document.all) {
      var ccel = document.getElementById? document.getElementById(cid): document.all[cid];       
      if (ccel && typeof ccel.innerHTML != "undefined") ccel.innerHTML = lvs;
 }
}

function cellback3 (cid,cidswitch) {
var lvs = '<span id=cellcmt1><td>testdataback</td></span>';
   if (document.getElementById || document.all) {
      var ccel = document.getElementById? document.getElementById(cid): document.all[cid];       
      if (ccel && typeof ccel.innerHTML != "undefined") ccel.innerHTML = lvs;
 }
}

// these functions moved to tabdata.js
function taba(tid) { 
  graytab(tid)
  var x = document.getElementById("th1"); 
  var y = document.getElementById("t1");   
   y.style.height="24";
   x.style.backgroundColor="#6699CC";
   y.style.backgroundColor="#6699CC";
   y.style.top="-2";
}  

function tabb(tid) { 
  graytab(tid);
  var x = document.getElementById("th2"); 
  var y = document.getElementById("t2");   
   y.style.height="24";
   x.style.backgroundColor="#99CC99";
   y.style.backgroundColor="#99CC99";
   y.style.top="-2";
}  

function tabc(tid) { 
  graytab(tid);
  var x = document.getElementById("th3"); 
  var y = document.getElementById("t3");     
   y.style.height="24";
   x.style.backgroundColor="#FF938D";
   y.style.backgroundColor="#FF938D";
   y.style.top="-2";
}    

function tabd(tid) { 
  graytab(tid)
  var x = document.getElementById("th4"); 
  var y = document.getElementById("t4");     
   y.style.height="24";
   x.style.backgroundColor="#AAAACC";
   y.style.backgroundColor="#AAAACC";   
   y.style.top="-2";
}  

//function tabe(tid) { 
//  graytab(tid);   
//  var x = document.getElementById("th5"); 
//  var y = document.getElementById("t5");   
//   y.style.height="24";
//   x.style.backgroundColor="#BF9555";
//   y.style.backgroundColor="#BF9555";   
//   y.style.top="-2";
//}  

function tabf(tid) { 
  graytab(tid)
  var x = document.getElementById("th6"); 
  var y = document.getElementById("t6");     
   y.style.height="24";
   x.style.backgroundColor="#AAAAAA";
   y.style.backgroundColor="#AAAAAA";
   y.style.top="-2";  
}  

//function reference4() { 
//  var x = document.getElementById("th4"); 
//  var y = document.getElementById("t4");   
//   y.style.height="26";
//   x.style.backgroundColor="#669933";
//   y.style.backgroundColor="#669933";
//   y.style.position="relative";
//   y.style.top="-2";
//   document.getElementById("tbbot").style.backgroundColor="#669933";
//}  

function graytab(tin) {
  var x1 = document.getElementById("th1"); 
  var y1 = document.getElementById("t1");   
  var x2 = document.getElementById("th2"); 
  var y2 = document.getElementById("t2");   
  var x3 = document.getElementById("th3"); 
  var y3 = document.getElementById("t3");    
  var x4 = document.getElementById("th4"); 
  var y4 = document.getElementById("t4");    
  var x5 = document.getElementById("th5"); 
  var y5 = document.getElementById("t5");    
  var x6 = document.getElementById("th6"); 
  var y6 = document.getElementById("t6");    
if (tin !== 1) {
   y1.style.height="22";
   x1.style.backgroundColor="#CCCCCC";
   y1.style.backgroundColor="#CCCCCC";  
   y1.style.top="0";   
   y1.style.position="relative";
}
 if (tin !== 2) {
   y2.style.height="22";
   x2.style.backgroundColor="#CCCCCC";
   y2.style.backgroundColor="#CCCCCC";
   y2.style.top="0";   
   y2.style.position="relative";  
}
if (tin !== 3) {
   y3.style.height="22";
   x3.style.backgroundColor="#CCCCCC";
   y3.style.backgroundColor="#CCCCCC";
   y3.style.top="0";   
   y3.style.position="relative";  
}
if (tin !== 4) {
   y4.style.height="22";
   x4.style.backgroundColor="#CCCCCC";
   y4.style.backgroundColor="#CCCCCC";
   y4.style.top="0";   
   y4.style.position="relative";  
}
if (tin !== 5) {
   y5.style.height="22";
   x5.style.backgroundColor="#CCCCCC";
   y5.style.backgroundColor="#CCCCCC";
   y5.style.top="0";   
   y5.style.position="relative";  
}
if (tin !== 6) {
   y6.style.height="22";
   x6.style.backgroundColor="#CCCCCC";
   y6.style.backgroundColor="#CCCCCC";
   y6.style.top="0";   
   y6.style.position="relative";  
}
}

 
