// Function to 'activate' images.
function imgOn(imgName,windowStatus) {
        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');
        }
}

//shopping cart on/off
if (document.images) {            // Active images
    imgcartoff = new Image();  imgcartoff.src = 'images/cart_off.gif';
    imgcarton = new Image();  imgcarton.src = 'images/cart_on.gif';
}

//Open a new browser window 
function openWin(page) {
    window_handle = window.open(page,'popup','width=350,height=425,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=yes');
    window_handle.focus();
}

//open a window with defined width and height.
function openDynWin(page,w,h) {
    window_handle = window.open(page,'popup','width='+w+',height='+h+',scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no');
    window_handle.focus();
}

//Open a new browser window 
function printable(page) {
    window_handle = window.open(page,'popup','width=800,height=600,scrollbars=no,resizable=yes,status=no,toolbar=yes,menubar=yes');
    window_handle.focus();
}


// IE hover and Z-index fix for main navigation

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
	    window.onload = func;
	} else {
        window.onload = function() 
        {
            oldonload();
            func();
        };
    }
}


startList = function() {
    if (document.all&&document.getElementById) {
        zCount = 100;
        navRoot = document.getElementById("nav");
        for (i=0; i<navRoot.childNodes.length; i++) {
            node = navRoot.childNodes[i];
            if (node.nodeName=="LI") {
                node.style.zIndex = zCount;
                zCount--;
                node.onmouseover=function() {
                    this.className+=" over";
                }
                node.onmouseout=function() {
                    this.className=this.className.replace(" over", "");
                }
            }
        }
    }
}

if (document.getElementById("nav")!=null) addLoadEvent(startList);