

function updateQty( e, incr, lb_name, oz_name ){
  if( e.id == oz_name ){
    oz = e;
    lb = document.getElementById( lb_name );
    v = Math.round( (  oz.value / 16 )/incr ) * incr;
    s = v.toString();
    //yuky hack to chop off miniscule trailing digits 15 places toward nowhere
    if( s.length - s.indexOf(".") > 8 ){
      s = s.slice( 0, -1 );
      while ( s.charAt( s.length - 1 ) == '0' ) s = s.slice( 0, -1 ); 
    }
    if( isNaN( parseFloat( s ) ) ){
      lb.value = '';
    }else{
      lb.value = s;
    }
  }else if( e.id == lb_name ){
    lb = e;    
    oz = document.getElementById( oz_name );
    v = lb.value * 16;
    if( isNaN( parseFloat( v ) ) ){
      oz.value='';
    }else{
      oz.value = v;
    }
  }
}


/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}

