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;
}
/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
/* Functions that handle preload. */
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];}}
}
/***********************************************
* Overlapping Content link- � 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, subobj){
if (document.getElementById){
var subobj=document.getElementById(subobj)
subobj.style.left=getposOffset(curobj, "left")+"px"
subobj.style.top=getposOffset(curobj, "top")+"px"
subobj.style.display="block"
return false
}
else
return true
}
function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}
function swapbkgd(subobj,imgurl){
	if(document.getElementById(subobj)){
		document.getElementById(subobj).style.background="url(\'"+imgurl+"\')";
	}
}
function showit(subobj){	
	var obj = document.getElementById(subobj);
	if(obj != null) {
		obj.style.display="block";
		obj.style.visibility="visible";
	}
}
function hideit(subobj){	
	var obj = document.getElementById(subobj);
	if(obj != null) {
		obj.style.visibility="hidden";
		obj.style.display="none";
	}
}
function showStatus(sMsg) {
    window.status = sMsg ;
    return true ;
}
function testVBV(subobj){
	if(document.getElementById(subobj)){
		var x=document.getElementById(subobj);
		if(x.selectedIndex==1 || x.selectedIndex==4){
			showit(subobj);
		}else{
			hideit(subobj);
		}
	}
}
function changeCursor() {
  document.body.style.cursor = 'wait';
}
function limitBillEqShip(cb, val, max) {
	var x=document.getElementById('beqs0');
	var n1 = parseInt( val ); 
	var n2 = parseInt( max+1 ); 
	var cnt = 0;
	while(cnt<n2) {
		if (!(cnt==n1)) {
			x=document.getElementById('beqs'+cnt);
			if (x!=null) {
				x.checked=false;
			}
		}
		cnt++;
	}
	return true;
}
function qtyKeyPress(e) {
    var code;  
    if(!e) var e=window.event; 
    if(e.keyCode){code=e.keyCode;} 
    else if(e.which){code=e.which;}
    if (code == 13){
		formActionSubmit('cartupdate.htm');
		e.returnValue = false;
		return false;
	}else if(code < 45 || code > 57 ){
		e.returnValue = false;
		return false;
	}else{
		e.returnValue = true;
		return true;
	}
}
function ordrSrchKeyPress(e) {
    var code;  
    if(!e) var e=window.event; 
    if(e.keyCode){code=e.keyCode;} 
    else if(e.which){code=e.which;}
    if (code == 13){
		formActionSubmit('orderstsdetail.htm');
		e.returnValue = false;
		return false;
	}else{
		e.returnValue = true;
		return true;
	}
}
	
function mask(e,str,textbox,loc,delim){
	var key //= (window.event) ? event.keyCode : e.which;  
	if (window.event){     
		key = event.keyCode   
	}else{     
		key = e.which   
	}
	var locs = loc.split(',');
	for (var i = 0; i <= locs.length; i++){
		for (var k = 0; k <= str.length; k++){
		 if (k == locs[i]){
		  if (str.substring(k, k+1) != delim){
		   if (key != 8){ //backspace
			str = str.substring(0,k) + delim + str.substring(k,str.length);
		   }
		  }
		 }
		}
	 }
	textbox.value = str
}
function checkNumeric(e) {
	var key //= (window.event) ? event.keyCode : e.which;  
	if (window.event){     
		key = event.keyCode   
	}else{     
		key = e.which   
	}
	// Was key that was pressed a numeric character (0-9) or backspace (8)?   
	if ( key > 47 && key < 58 || key == 8 ){     
		return; // if so, do nothing   else // otherwise, discard character
	}		
	if (window.event){ //IE      
		window.event.returnValue = null;     
	}else{ //Firefox       
		e.preventDefault(); 
	}
}

