﻿
    function preload(img) {
        var a = new Image(); a.src = img; return a;
    }

    function swapimage(item, substitute) {
        //alert("item.src = " + item.src)
        //alert("substitute.src = " + substitute.src)
        item.src = substitute.src
        //alert("item.src = " + item.src)
    }

    function showhide(id) {
        el = document.all ? document.all[id] : HM_DOM ? document.getElementById(id) : document.layers[id];
        els = HM_DOM ? el.style : el;
        if (HM_DOM) {
            if (els.visibility == "hidden")
                els.visibility = "visible";
            else els.visibility = "hidden";
        }
        else if (HM_NS4) {
            if (els.visibility == "show")
                els.visibility = "hide";
            else els.visibility = "show";
        }
    }

    function thumbout(item, substitute, index) {
        //alert("mouseout! currentThumbIndex = " + currentThumbIndex + " ; index = " + index) 
        if (index != currentThumbIndex)
            swapimage(item, substitute);
    }

    function thumbclick(item, substitute, index) {
        swapimage(item, substitute)

        if (currentThumbIndex != index) {
            streval = "swapimage(document.thumb" + currentThumbIndex + ",thumb" + currentThumbIndex + "OFF)"
            //alert(streval)
            //alert(eval("thumb" + currentThumbIndex + "OFF.src"))
            eval(streval)

            streval = "popuppath = popuppath" + index
            eval(streval)

            currentThumbIndex = index
        }

        //alert(thumb1.src)
        //alert("HM_NS4 = " + HM_NS4 + "HM_IE = " + HM_IE)
    }

    function openpopup() {
        var agt = navigator.userAgent
        var imagepath = eval("popuppath" + currentThumbIndex)
        var imageheight = eval("popupheight" + currentThumbIndex)
        var imagewidth = eval("popupwidth" + currentThumbIndex)

        //if no popup exists, then exit
        if (imagepath == "images/") return;

        if ((agt.indexOf("Win") != -1) && (agt.indexOf("MSIE 5") != -1)) {
            //alert("ok to use showmodelessdialog")			
            imageheight = parseInt(imageheight) + 50 //* 1.1
            imagewidth = parseInt(imagewidth) + 10 //* 1.1

            winstyle = "scroll:false;status:false;help:no;dialogWidth:" + imagewidth + "px;dialogHeight:" + imageheight + "px";
            window.showModelessDialog("popup.asp?ImagePath=" + imagepath, null, winstyle);
        }
        else {
            //alert("don't you dare use a modeless dialog")
            //winstyle = "height=" + imageheight + ",width=" + imagewidth + ",status=no,toolbar=no,menubar=no,location=no,scrollbars=no";
            winstyle = "height=" + imageheight + ",width=" + imagewidth + ",status=no,toolbar=no,menubar=no,location=no";
            if (imageheight > 550)
                winstyle = winstyle + ",scrollbars=yes";
            else
                winstyle = winstyle + ",scrollbars=no";

            window.open("popup.asp?ImagePath=" + imagepath, null, winstyle);
        }
    }

