
var ac = 0;    // table for qty/amt pairs
var aqty = new Array ();  // qty brkpt
var aamt = new Array ();  // amount to charge

var pc = 0;    // table for qty/percent pairs
var pqty = new Array ();  // qty brkpt
var pper = new Array ();  // percent to discount

function Dollar (val) {  // force to valid dollar amount
var str,pos,rnd=0;
  if (val < .995) rnd = 1;  // for old Netscape browsers
  str = escape (val*1.0 + 0.005001 + rnd);  // float, round, escape
  pos = str.indexOf (".");
  if (pos > 0) str = str.substring (rnd, pos + 3);
  return str;
}

function ReadForm (obj1) { // quantity based discounts
var i,amt,des,qty;

  amt = obj1.baseamt.value*1.0; // base amount
  des = obj1.qty.value +" - "+ obj1.basedes.value;    // base description
  qty = obj1.qty.value;         // get user quantity

  if (isNaN (qty) || qty < 1) { // make sure it's good
    alert ('"' + qty + '"' + ' is not a valid number!');
    ac = 0;                     // always zap the table
    pc = 0;
    return false;               // th-th-that's all, folks.
  }


 if (qty < 50) { // make sure it's at least 50 peices 
    alert ('Minimum Quantity is 50 Pieces');
    ac = 0;                     // always zap the table
    pc = 0;
    return false;               // th-th-that's all, folks.
  }


 if (qty.substr(qty.length-1, 1) != '0' && qty.substr(qty.length-1, 1) != '5') { // make sure it is a quantity of 5 
    alert ('Invalid Quantity! Must be in Quantities of 5');
    ac = 0;                     // always zap the table
    pc = 0;


    return false;               // th-th-that's all, folks.
  }





  qty = qty*1.0;                // force to numeric



  for (i=ac-1; i>=0; i=i-1) {   // run table backwards
    if (qty >= aqty[i]) {       // use this entry
      amt = aamt[i];            // this is the real amount
      break;                    // get out, we're done
    }
  }
  for (i=pc-1; i>=0; i=i-1) {   // run table backwards
    if (qty >= pqty[i]) {       // use this entry
      amt = amt - (amt/100.0 * pper[i]);
      break;                    // get out, we're done
    }
  }

  obj1.item_name.value = des + " priced @$" +
                         Dollar (amt) + " ea. (Direct Ship)";
  obj1.amount.value = Dollar (amt * qty);
  ac = 0;  // reset item discount
  pc = 0;
}

function SetAmt (q1, a1) {  // set up a quantity-based amount table
var i;
  ac = 0;
  for (i=0; i<arguments.length; i=i+2) {  // build the table
    aqty[ac] = arguments[i];   // get real args and store 
    aamt[ac] = arguments[i+1];
    ac = ac + 1;               // number of pairs in table
  }
}

function SetPer (q1, p1) {  // set up a quantity-based percent table
var i;
  pc = 0;
  for (i=0; i<arguments.length; i=i+2) {  // build the table
    pqty[pc] = arguments[i];   // get real args and store 
    pper[pc] = arguments[i+1];
    pc = pc + 1;               // number of pairs in table
  }
}

function openwin7() {
mywin=window.open("/outofstock.htm","ie7", "height=480, width=500, resizable=yes, scrollbars=yes, left=10, top=10")


}


//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Property of Laundry Bag Lots \n (C) 2008-2011, Laundry Bag Lots"



///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")



/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}




