if (document.images) {            // Active Images
	img1on = new Image();      
    img1on.src = "res/nav_home_on.gif";
	img2on = new Image();      
    img2on.src = "res/nav_products_on.gif";
	img3on = new Image();      
    img3on.src = "res/nav_aboutus_on.gif";  
	img4on = new Image();      
    img4on.src = "res/nav_custom_on.gif";  
	img5on = new Image();      
    img5on.src = "res/nav_catalog_on.gif";  
	img6on = new Image();      
    img6on.src = "res/nav_upload_on.gif";    
	img7on = new Image();      
    img7on.src = "res/nav_contact_on.gif";    
	
	
	
	
    img1off = new Image();      
    img1off.src = "res/nav_home.gif";
	img2off = new Image();      
    img2off.src = "res/nav_products.gif";
	img3off = new Image();      
    img3off.src = "res/nav_aboutus.gif";  
	img4off = new Image();      
    img4off.src = "res/nav_custom.gif";  
	img5off = new Image();      
    img5off.src = "res/nav_catalog.gif";  
	img6off = new Image();      
    img6off.src = "res/nav_upload.gif";    
	img7off = new Image();      
    img7off.src = "res/nav_contact.gif";   

		
}



// Function to 'activate' images.
function imgOn(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "on.src");
        }
}

// Function to 'deactivate' images.
function imgOff(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "off.src");
        }
}

// Function to change TD background colors.
function fncChangeBackGround(objTD,strStyle) {
	objTD.className = strStyle;
}

function openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function syncShippingToBilling(frm) {
	if (frm.elements['sameAsBilling'].checked == true) {
		frm.elements['shipping_streetaddress1'].value = frm.elements['billing_streetaddress1'].value;
		frm.elements['shipping_streetaddress2'].value = frm.elements['billing_streetaddress2'].value;
		frm.elements['shipping_city'].value = frm.elements['billing_city'].value;
		frm.elements['shipping_state'].value = frm.elements['billing_state'].value;
		frm.elements['shipping_country'].value = frm.elements['billing_country'].value;
		frm.elements['shipping_zipcode'].value = frm.elements['billing_zipcode'].value;
	} else {
		frm.elements['shipping_streetaddress1'].value = "";
		frm.elements['shipping_streetaddress2'].value = "";
		frm.elements['shipping_city'].value = "";
		frm.elements['shipping_state'].value = "";
		frm.elements['shipping_country'].value = "";
		frm.elements['shipping_zipcode'].value = "";
	}
}

function fncCheckNumber(objElement, intMinimum) {
	var xValue;
	xValue = objElement.value;

	if(isNaN(xValue)) {
		if(xValue != '') {
			alert('Please enter a valid number.')
			objElement.value = '';
			objElement.setFocus();
		}
	} else {
		if(xValue.indexOf('.') > -1) {
			alert('Please enter a valid whole number.')
			objElement.value = '';
			objElement.setFocus();
		}
	}
}

function fncCheckDecimal(objElement, intMinimum) {
	var xValue;
	xValue = objElement.value;

	if(isNaN(xValue)) {
		if(xValue != '') {
			alert('Please enter a valid number.')
			objElement.value = '';
			objElement.setFocus();
		}
	}
}

function fncCheckMinimum(objElement, intMinimum) {
	var xValue;
	xValue = objElement.value;
	if(isNaN(xValue) || xValue == '') {
		// skip
	} else {
		if(intMinimum > 0) {
			if(xValue < intMinimum) {
				alert('Please enter a quantity greater then or equal to ' + intMinimum + '.')
				objElement.value = '';
				objElement.setFocus();
			}
		}
	}
}

// *****************************************************************************************
// DUAL LIST ::: BEGIN
// *****************************************************************************************
// Compare two options within a list by VALUES
function compareOptionValues(a, b)
{
  var sA = parseInt( a.value, 36 );
  var sB = parseInt( b.value, 36 );
  return sA - sB;
}

// Compare two options within a list by TEXT
function compareOptionText(a, b)
{
  var sA = parseInt( a.text, 36 );
  var sB = parseInt( b.text, 36 );
  return sA - sB;
}

// Dual list move function
function moveDualList( srcList, destList, moveAll )
{
  // Do nothing if nothing is selected
  if (  ( srcList.selectedIndex == -1 ) && ( moveAll == false )   )
  {
    return;
  }

  newDestList = new Array( destList.options.length );
  var len = 0;
  for( len = 0; len < destList.options.length; len++ )
  {
    if ( destList.options[ len ] != null )
    {
      newDestList[ len ] = new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );
    }
  }

  for( var i = 0; i < srcList.options.length; i++ )
  {
    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )
    {
       // Statements to perform if option is selected
       // Incorporate into new list
       newDestList[ len ] = new Option( srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected );
       len++;
    }
  }

  // Sort out the new destination list
  // err prod sort [nonnumeric]
  // newDestList.sort( compareOptionValues );   // BY VALUES
  // newDestList.sort( compareOptionText );   // BY TEXT


  // Populate the destination with the items from the new array
  for ( var j = 0; j < newDestList.length; j++ )
  {
    if ( newDestList[ j ] != null )
    {
      destList.options[ j ] = newDestList[ j ];
    }
  }

  // Erase source list selected elements
  for( var i = srcList.options.length - 1; i >= 0; i-- )
  {
    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )

    {
       // Erase Source
       //srcList.options[i].value = "";
       //srcList.options[i].text  = "";
       srcList.options[i]       = null;
    }
  }
} 

// Dual list move function
function moveDualListResults( srcList , srcTarget) {
	var xValue;
	var newValue;
	newValue = '';
	
	if(srcList.options.length > 0) {
		for( var i = 0; i < srcList.options.length; i++ ) {
			xValue = srcList.options[i].value
			if(newValue.length > 0) {
				newValue += ','
			}
			newValue += '\''
			newValue += xValue
			newValue += '\''
		}
	}

	// RESET VALUE
	srcTarget.value = newValue;
}
// *****************************************************************************************
// DUAL LIST ::: END
// *****************************************************************************************

// *****************************************************************************************
// ADMIN FUNCTIONS ::: BEGIN
// *****************************************************************************************
// CONFIRMATION DIALOG BOX
function fncConfirmLink(strLink) {
	var answer = confirm ("Please click on OK to confirm.");
	if (answer) {
		document.location = strLink;
	}
}

// SELECT ALL CHECK BOXES ON A FORM
function fncSelectAll(objForm,intDirection) {
	var strElementType;
	for(var i = 0; i<objForm.length; i++) {
		strElementType = objForm.elements[i].type;
		if(strElementType == 'checkbox') {
			if(intDirection == 1) {
				if(objForm.elements[i].disabled == false) {
					objForm.elements[i].checked = true;
				}
			} else {
				objForm.elements[i].checked = false;
			}
		}
	}
}

// COPY VALUE FROM CONTROLS
function fncCopyValue(objForm, strTarget, strSource) {
	var strElementType;
	var strElementName;
	var overrideValue;
	var xCheck;
	var xi;
	overrideValue = objForm.elements[strSource].value;
	
	for(var i = 0; i<objForm.length; i++) {
		strElementType = objForm.elements[i].type;
		strElementName = objForm.elements[i].name;
		if(strElementType == 'text') {
			if(strElementName.indexOf(strTarget) >= 0) {
				objForm.elements[i].value = overrideValue;
			}
		}
	}
}

// *****************************************************
// WINDOW POPUP [catalog]
// *****************************************************
function OpenWindowCatalog(strURL,strTitle)
{
	var text;
	var str;
	str = "";

	if (window.screen) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;

		var xc = (aw - 996) / 2;
		var yc = (ah - 680) / 2;

		str += ",left=" + xc + ",screenX=" + xc;
		str += ",top=" + yc + ",screenY=" + yc;
	}

	var objPrintWindow = window.open(strURL, strTitle, "width=996,height=680,center,toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0" + str);
		
}

// *****************************************************************************************
// ADMIN FUNCTIONS ::: END
// *****************************************************************************************


// *****************************************************************************************
// ELEMENT POSITIONS ::: BEGIN
// *****************************************************************************************
function findPosX(obj)
 {
   var curleft = 0;
   if(obj.offsetParent)
       while(1) 
       {
         curleft += obj.offsetLeft;
         if(!obj.offsetParent)
           break;
         obj = obj.offsetParent;
       }
   else if(obj.x)
       curleft += obj.x;
   return curleft;
 }

 function findPosY(obj)
 {
   var curtop = 0;
   if(obj.offsetParent)
       while(1)
       {
         curtop += obj.offsetTop;
         if(!obj.offsetParent)
           break;
         obj = obj.offsetParent;
       }
   else if(obj.y)
       curtop += obj.y;
   return curtop;
 }

// *****************************************************************************************
// ELEMENT POSITIONS ::: END
// *****************************************************************************************
// -->


