// Add Drop Down Menus code for IE (to make up for IE's lack of support for the :hover pseudoclass)
// Code from http://www.htmldog.com/articles/suckerfish/dropdowns/
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent)  window.attachEvent("onload", sfHover);




function addOnLoad(f) {
    var currentOnLoad = window.onload;
    if (typeof window.onload != "function") {
        window.onload = f;
    } else {
        window.onload = function() {
            currentOnLoad();
            f();
        }
    }
}

function preloadImages() {
    // This function will preload the hover images so we don't get a flicker while waiting for hover images to load
    if (document.getElementById) {
        var i, j;
        var imageArray = Array();
        
        // Preload the "Collections" menu hover items
        for (i=1; i <= 8; i++) {
            imageArray[i] = new Image();
            imageArray[i].src = '../images/collections/menu/collection-hover-'+i+'.gif';
        }
        j = i;

        // Preload the "Featured Products" hover items
        for (i=1; i <= 3; i++) {
            imageArray[j+i] = new Image();
            imageArray[j+i].src = '../images/featured/featured-hover-'+i+'.gif';
        }
        j = i+1;
        
        // Preload the hover arrow
        imageArray[j] = new Image();
        imageArray[j].src = '../images/a-details-hover.gif';
        
    }
}
addOnLoad(preloadImages);



