function fillShipQty(cbo,q,minval,incr) {
	var val=0;
	var i=0;
	var s=0;
	
	cbo.options.length = 0;
	cbo.options[i] = new Option('Select Quantity','0');

	for (val=minval;val<=q;val=val+incr) 
	{
		i++;
		cbo.options[i] = new Option(val + ' - Store ' + (q-val) + ' in inventory',val);
	}
}
function emailPassword() {
	var strEmail = document.frmLogin.txtEmail.value;

	if (strEmail.length == 0 || strEmail.indexOf("@") < 0)
		alert("Please enter your email address.");
	else
		self.location = "default.asp?e=" + strEmail;
}

function confirmDelete(delUrl) {
  if (confirm("Are you sure you want to delete this item?\nThis cannot be undone.")) {
    document.location = delUrl;
  }
}

function confirmLink(destination, msg) {
  if (confirm(msg)) {
    document.location = destination;
  }
}

function toggleLayer( whichLayer )
{
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( whichLayer );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichLayer];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[whichLayer];
	vis = elem.style;
	// if the style.display value is blank we try to figure it out here
	if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
		vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
		vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function hideLayer( whichLayer )
{
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( whichLayer );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichLayer];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[whichLayer];
	vis = elem.style;
	vis.display='none';
}

function showLayer( whichLayer )
{
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( whichLayer );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichLayer];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[whichLayer];
	vis = elem.style;
	vis.display='block';
}

function hideRow( whichRow )
{
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( whichRow );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichRow];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[whichRow];
	vis = elem.style;
	vis.display='none';
}

function showRow( whichRow )
{
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( whichRow );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichRow];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[whichRow];
	vis = elem.style;

	if(navigator.appName.indexOf("Microsoft") > -1){
	vis.display = 'block'
	} else {
	vis.display = 'table-row';
	}
}

function showThumbnail(which, e)
{
	var thumb = document.getElementById('thumb');
	if (thumb && thumb.style.visibility == 'hidden') {
		var lLeft = 0;
		var lTop = 0;
		if (e.pageX) {
			// Mozilla
			lLeft = pageXOffset + e.clientX + 20;
			lTop = pageYOffset + e.clientY;
		} else {
			// IE
			if (document.documentElement) {
				lLeft = document.documentElement.scrollLeft + e.x + 20;
				lTop = document.documentElement.scrollTop + e.y;
			} else {
				lLeft = document.body.scrollLeft + e.x + 20;
				lTop = document.body.scrollTop + e.y;
			}
		}
		thumb.style.left = lLeft + 'px';
		thumb.style.top = lTop + 'px';
		thumb.style.visibility = 'visible';
		thumb.innerHTML = '<img src="' + unescape(which) + '">';
	}
}

function closeThumbnail()
{
	var thumb = document.getElementById('thumb');
	if (thumb) thumb.style.visibility = 'hidden';
}

function placeFocus() {
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
document.forms[0].elements[i].focus();
break;
         }
      }
   }
}
function copyAddress(theForm)
{
	theForm.txtShipping_Address1.value=theForm.txtBilling_Address1.value;
	theForm.txtShipping_Address2.value=theForm.txtBilling_Address2.value;
	theForm.txtShipping_City.value=theForm.txtBilling_City.value;
	theForm.txtShipping_State.value=theForm.txtBilling_State.value;
	theForm.txtShipping_Zip.value=theForm.txtBilling_Zip.value;
	theForm.txtShipping_Phone.value=theForm.txtBilling_Phone.value;
	theForm.txtShipping_Fax.value=theForm.txtBilling_Fax.value;
	theForm.txtShipping_Contact.value=theForm.txtBilling_Contact.value;
}

