

    function PopupSignIn() {
        var w, h;
        w = screen.width / 2 - 180;
        h = screen.height / 2 - 200;
        window.open("hm_signin_popup_de.asp", "signon", "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,directories=no,height=360,width=400,top=" + h + ",left=" + w);
    }


    function TurnOn(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "_on.src");
        }
    }


    function TurnOff(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "_off.src");
        }
    }


    function ChangeImage(imgName, imgSource) {
        try {
            document.images[imgName].src = imgSource;
        } catch (ex) {
        }
    }


    function sortFuncAsc(record1, record2) {
        var value1 = record1.optText.toLowerCase();
        var value2 = record2.optText.toLowerCase();
        if (value1 > value2) {
            return 1;
        }
        if (value1 < value2) {
            return -1;
        }
        return 0;
    }


    function sortFuncDesc(record1, record2) {
        var value1 = record1.optText.toLowerCase();
        var value2 = record2.optText.toLowerCase();
        if (value1 > value2) {
            return -1;
        }
        if (value1 < value2) {
            return 1;
        }
        return 0;
    }


    function sortSelect(selectToSort, ascendingOrder) {
        if (arguments.length == 1) {
            ascendingOrder = true;
        }
        var myOptions = [];
        for (var loop = 0; loop < selectToSort.options.length; loop++) {
            myOptions[loop] = {optText: selectToSort.options[loop].text, optValue: selectToSort.options[loop].value};
        }
        if (ascendingOrder) {
            myOptions.sort(sortFuncAsc);
        } else {
            myOptions.sort(sortFuncDesc);
        }
        selectToSort.options.length = 0;
        for (var loop = 0; loop < myOptions.length; loop++) {
            var optObj = document.createElement("option");
            optObj.text = myOptions[loop].optText;
            optObj.value = myOptions[loop].optValue;
            selectToSort.options.add(optObj);
        }
    }


    function AddItem(Text, Value, ElementId, SortItems) {
        var opt = document.createElement("option");
        document.getElementById(ElementId).options.add(opt);
        opt.text = Text;
        opt.value = Value;
        if (SortItems) {
            sortSelect(document.getElementById(ElementId), true);
        }
        var sdd = document.getElementById(ElementId);
        if (sdd) {
            for (var i = 0; i < sdd.options.length; i++) {
                if (sdd.options[i].value == Value) {
                    sdd.selectedIndex = i;
                }
            }
        }
    }


    function showServiceTeamMessage() {
        alert("Gerne nimmt unser Serviceteam Ihre Bestellung entgegen:\n\nStockFood Deutschland  Tel. +49 (89) 747.2020\nStockFood \xD6sterreich  Tel. +43 (1) 505.5490\nStockFood Schweiz  Tel. +41 (56) 297.3131");
    }


    function goNav(id) {
        document.getElementById("Top" + oldid).className = "normal";
        document.getElementById("Top" + id).className = "hover";
        document.getElementById("Sub" + oldid).style.visibility = "hidden";
        document.getElementById("Sub" + id).style.visibility = "visible";
        oldid = id;
    }


    function DoSearch() {
        var search = document.getElementById("LastSearches").options[document.getElementById("LastSearches").selectedIndex].value;
        if (search == "0") {
            return;
        }
        var parameters = "";
        if (search.indexOf("rprf=") != -1) {
            parameters += "&" + search.substr(search.indexOf("rprf="));
        }
        tmp_rprf_pos = search.indexOf(" and rprf=");
        if (tmp_rprf_pos > 0) {
            var tmp_rprf = search.substr(tmp_rprf_pos);
            search = search.replace(tmp_rprf, "");
        }
        if (search.indexOf("lstorients=") != -1) {
            parameters += "&" + search.substr(search.indexOf("lstorients="));
        }
        tmp_lstorient_pos = search.indexOf(" and lstorients=");
        if (tmp_lstorient_pos > 0) {
            var tmp_lstorient = search.substr(tmp_lstorient_pos);
            search = search.replace(tmp_lstorient, "");
        }
        if (search.indexOf("catalogs=") != -1) {
            parameters += "&" + search.substr(search.indexOf("catalogs="));
        }
        tmp_catalogs_pos = search.indexOf(" and catalogs=");
        if (tmp_catalogs_pos > 0) {
            var tmp_catalogs = search.substr(tmp_catalogs_pos);
            search = search.replace(tmp_catalogs, "");
        }
        if (search.indexOf("lstfotogs=") != -1) {
            parameters += "&" + search.substr(search.indexOf("lstfotogs=")).toUpperCase();
        }
        tmp_lstfotogs_pos = search.indexOf(" and lstfotogs=");
        if (tmp_lstfotogs_pos > 0) {
            var tmp_lstfotogs = search.substr(tmp_lstfotogs_pos);
            search = search.replace(tmp_lstfotogs, "");
        }
        if (search.indexOf("lstoccasions=") != -1) {
            parameters += "&" + search.substr(search.indexOf("lstoccasions=")).toUpperCase();
        }
        tmp_lstoccasions_pos = search.indexOf(" and lstoccasions=");
        if (tmp_lstoccasions_pos > 0) {
            var tmp_lstoccasions = search.substr(tmp_lstoccasions_pos);
            search = search.replace(tmp_lstoccasions, "");
        }
        if (search.indexOf("lstcourses=") != -1) {
            parameters += "&" + search.substr(search.indexOf("lstcourses=")).toUpperCase();
        }
        tmp_lstcourses_pos = search.indexOf(" and lstcourses=");
        if (tmp_lstcourses_pos > 0) {
            var tmp_lstcourses = search.substr(tmp_lstcourses_pos);
            search = search.replace(tmp_lstcourses, "");
        }
        if (search.indexOf("lstcontinents=") != -1) {
            parameters += "&" + search.substr(search.indexOf("lstcontinents=")).toUpperCase();
        }
        tmp_lstcontinents_pos = search.indexOf(" and lstcontinents=");
        if (tmp_lstcontinents_pos > 0) {
            var tmp_lstcontinents = search.substr(tmp_lstcontinents_pos);
            search = search.replace(tmp_lstcontinents, "");
        }
        if (search.indexOf("lstcountries=") != -1) {
            parameters += "&" + search.substr(search.indexOf("lstcountries=")).toUpperCase();
        }
        tmp_lstcountries_pos = search.indexOf(" and lstcountries=");
        if (tmp_lstcountries_pos > 0) {
            var tmp_lstcountries = search.substr(tmp_lstcountries_pos);
            search = search.replace(tmp_lstcountries, "");
        }
        if (search.indexOf(" and checkmodrelease") != -1) {
            parameters += "&chkmodrelnum=TRUE";
        }
        if (search.indexOf(" and imgoncd") != -1) {
            parameters += "&ImgOnCD=1";
        }
        search = search.replace(" and checkmodrelease", "");
        search = search.replace(" and imgoncd", "");
        location.href = "results.asp?txtkeys=" + search + parameters;
    }


    function upageOnKeyPress(e) {
        var a;
        if (window.event) {
            a = !(window.event && window.event.keyCode == 13);
        } else {
            a = !(e.which == 13);
        }
        if (!a) {
            if (uIsNumeric(document.getElementById("upage").value)) {
                if (document.getElementById("upage").value >= 1 &&
                    document.getElementById("upage").value <= uNumPages) {
                    setTimeout("ugoOnClick()", 500);
                }
            }
        }
        return a;
    }


    function upage_bottomOnKeyPress(e) {
        var a;
        if (window.event) {
            a = !(window.event && window.event.keyCode == 13);
        } else {
            a = !(e.which == 13);
        }
        if (!a) {
            if (uIsNumeric(document.getElementById("upage_bottom").value)) {
                if (document.getElementById("upage_bottom").value >= 1 &&
                    document.getElementById("upage_bottom").value <= uNumPages) {
                    setTimeout("ugoBottomOnClick()", 500);
                }
            }
        }
        return a;
    }


    function viewcd(ImageId, Place) {
        ImageId = escape(ImageId);
        location = "results.asp?image=" + ImageId;
    }


    function CDOrder(cdorder) {
        var w = screen.width / 2 - 200;
        var h = screen.height / 2 - 150;
        cdorder = escape(cdorder);
        window.open("cdorder.asp?cdorder=" + cdorder, "cdorder", "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,directories=no,height=300,width=400,top=" + h + ",left=" + w);
    }


    function PrevOnSame(image, wwwflag, imagepos) {
        location = "results.asp?image=" + image + "&wwwflag=" + wwwflag + "&imagepos=" + imagepos;
    }


    function ShowRFInfo(image) {
        var w = screen.width / 2 - 200;
        var h = screen.height / 2 - 150;
        image = escape(image);
        window.open("rf.asp?image=" + image, "RF", "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,directories=no,height=300,width=550,top=" + h + ",left=" + w);
    }


    function ShowRMInfo(image) {
        var w = screen.width / 2 - 200;
        var h = screen.height / 2 - 150;
        image = escape(image);
        window.open("rp.asp?image=" + image, "RF", "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,directories=no,height=250,width=550,top=" + h + ",left=" + w);
    }


    function CDOrderChoice(cdorder) {
        var w = screen.width / 2 - 300;
        var h = screen.height / 2 - 150;
        cdorder = escape(cdorder);
        window.open("cdorderchoice.asp?cdorder=" + cdorder, "cdorder", "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,directories=no,height=300,width=600,top=" + h + ",left=" + w);
    }


    function OrderRMImage(image) {
        location = "formorderinfo.asp?image=" + image;
    }


    function GoToPage(W, F, Step) {
        location.href = "results.asp?W=" + W + "&F=" + F + "&Step=" + Step;
    }


    function LstPasteboards() {
        var i = document.PBFORM.PB.selectedIndex;
        var v = document.PBFORM.PB.options[i].value;
        var i = document.PBFORM.PIXPERPAGE.selectedIndex;
        var p = document.PBFORM.PIXPERPAGE.value;
        for (i = 0; i < document.PBFORM.PIXPERPAGE.length; i++) {
            if (document.PBFORM.PIXPERPAGE[i].checked == true) {
                var p = document.PBFORM.PIXPERPAGE[i].value;
            }
        }
        v = escape(v);
        location = "results.asp?btnshow=1&lstpasteboards=" + v + "&pixperpage=" + p;
    }

