defaultStatus="Darby Dental Supply - 1(800) 645-2310";

function toggleVisibility(id, NNtype, IEtype, WC3type) {
    if (document.getElementById) {
        eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
    } else {
        if (document.layers) {
            document.layers[id].visibility = NNtype;
        } else {
            if (document.all) {
                eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
            }
        }
    }
}

function getObjectXY(theElement, theID){
	elemPosX = theElement.offsetLeft;
	elemPosY = theElement.offsetTop;
	theElement = theElement.offsetParent;
	while(theElement != null){
		elemPosX += theElement.offsetLeft;
		elemPosY += theElement.offsetTop;
		theElement = theElement.offsetParent;
	}
	document.getElementById(theID).style.top = elemPosY + 23;
	document.getElementById(theID).style.left = elemPosX - 1;
}

function OpenWin(src,nme,s,w,h) {
	window.open(src,nme,'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=' + s + ',width=' + w + ',height=' + h);
	}

function helpframe(help,hash,fullpath) {
	//store the page that needs to load in the content frame
	var spage = String(fullpath);
	//
	var npage = '';

	//if no parameter passed, open default help page.
	if (!help)
		help = 'help_contents.asp';

	for(var i = 0; i < spage.length; i++)
		if (spage.charAt(i) == '&')
			npage = npage + '~';
		else
			npage = npage + spage.charAt(i);
	var target = '/help/online_help.asp?content=' + npage + '&help=' + help + '~' + hash
	top.location = target;
}

//function to redirect to catalog when searching by manufacturer
function mfrSelect(mfrID){
	document.location="/scripts/search_categories.aspx?mfr=" + mfrID ;
}

//function used for the Advanced Search Feature
var activeID;
var activeIDgr;
function showhide(what,what2){
	if (what.style.display == 'none'){
		if(activeID != null){
			activeID.style.display = 'none';
			activeIDgr.src = "/images/closed.gif";
		}
		what.style.display = '';
		what2.src = "/images/open.gif";
		activeID = what;
		activeIDgr = what2;
	}
	else {
		what.style.display = 'none';
		activeID = null;
		activeIDgr = null;
		what2.src = "/images/closed.gif";
	}
}
function mfrfind() 
{
	if (document.mfrform.arg.value.length > 0 || document.mfrform.mfr.selectedIndex != 0) 
	{ 
		document.mfrform.submit(); 
		return true; 
	} 
	else 
	{
		return false;
	}
}
// function to check for all empty form values... will not submit form if nothing is filled out.

var qtyError = 0;
function chkForm(y){
	var len = y.length;
	var x = 0;
	var i;

	for(i=0; i < len; i++){
		if(y.elements[i].name.substr(0,6) == 'minQty'){
			if (!ValidateQty( + y['qty' + y.elements[i].name.substr(6,7)].value, y.elements[i].value ))
			{
				x++;
			}
//		}else if(y.elements[i].name.substr(0,3) == 'qty'){
//			if (!ValidateQty( + y['qty' + y.elements[i].name.substr(3,7)].value, y.elements[i].value ))
//			{
//				x++;
//			}
		}
	}
	if (x > 0)
	{
		alert("One or more of the quantites entered is invalid. \n\nPlease correct the values marked with 'X' and re-submit.");
		return false;
	}
	else
	{
		y.submit();
	}
}

// function to check for valid quantity on product page.
function ValidateQty(qty, mult) {
	qtyChk = qty / mult + "";
	var isValidQty = new Boolean();
	var i;
	isValidQty = true;

	if (qtyChk != "" && typeof(qtyChk) == "string") {
		for (i=0; i < qtyChk.length; i++) {
			x = qtyChk.charAt(i);
			y = parseInt(x);
			if (isNaN(y)) {
				isValidQty = false;
			}
		}
	}
	else
	{
		isValidQty = false;
	}

	return isValidQty;
}




