
function top_window()
    {
    self.focus();
    // window.setTimeout("top()",1000);		//Zeitwert zum erneuten öffnen
    }

function OpenNewWindow(Picture, Hoch, Breit)
    {
    xsize = Breit + 35; // Zusatz für Rand rechts und links
    ysize = Hoch + 130; //Zusatz für Rand oben und unten - damit Button angezeigt werden kann 

    ScreenWidth = screen.width;
    ScreenHeight = screen.height;

    xpos = (ScreenWidth / 2) - (xsize / 2);
    ypos = (ScreenHeight / 2) - (ysize / 2);

    NewWindow = window.open("", "Picture", "height=" + ysize + ",width=" + xsize + ",scrollbars=no,resizable=no,top="
                                + ypos + ",left=" + xpos + "");
    NewWindow.document.write("<html><head><title>DETAIL LIMAGE");
    NewWindow.document.write("</title><link rel='stylesheet' type='text/css' href='content/css1.css'></head>");
    NewWindow.document.write("<body onload='focus()'>");
    NewWindow.document.write("<table align='center'><tr>");
    NewWindow.document.write("<td align='center' valign='top'>");
    NewWindow.document.write("<table border='0' cellpadding='0' cellspacing='1'><tr><td align='center'>");
    NewWindow.document.write("<img src=");
    NewWindow.document.write(Picture);
    NewWindow.document.write(">");
    NewWindow.document.write("</tr></table>");
    NewWindow.document.write("</td></tr><tr>");
    NewWindow.document.write("<td align='center' valign='top'>");
    NewWindow.document.write("<center><form><input type='button' value='FENSTER SCHLIESSEN' style='font-family: Verdana; font-size: 10px' onClick='self.close()'>");
    NewWindow.document.write("</td></tr></table>");
    NewWindow.document.write("</form></body></html>");
    NewWindow.document.close();
    NewWindow.resizeTo(xsize, ysize);
    }

function setPointer(theRow)
    {
    if (typeof (theRow.style) == 'undefined')
        {
        return false;
        }

    if (typeof (document.getElementsByTagName) != 'undefined')
        {
        var theCells = theRow.getElementsByTagName('td');
        }

    else if (typeof (theRow.cells) != 'undefined')
        {
        var theCells = theRow.cells;
        }

    else
        {
        return false;
        }

    var rowCellsCnt = theCells.length;

    for (var c = 0; c < rowCellsCnt; c++)
        {
        if (theCells[c].parentNode == theRow)
            {
            theCells[c].style.backgroundColor = '#E7EBEB';
            }
        }

    return true;
    }

function unsetPointer(theRow)
    {
    if (typeof (document.getElementsByTagName) != 'undefined')
        {
        var theCells = theRow.getElementsByTagName('td');
        }

    else if (typeof (theRow.cells) != 'undefined')
        {
        var theCells = theRow.cells;
        }

    else
        {
        return false;
        }

    var rowCellsCnt = theCells.length;

    for (var c = 0; c < rowCellsCnt; c++)
        {
        if (theCells[c].parentNode == theRow)
            {
            theCells[c].style.backgroundColor = '';
            }
        }

    return true;
    }

function openWin()
    {
    window.open('order.php?mode=password&sid=<?php echo $sid ?>', 'Passwort',
                'toolbar=no,statusbar=no,scrollbars=no,menu=no,height=300,width=450');
    }

function radio_input(url)
    {
    // Re-direct the browser to the url value
    window.location.href = url
    }

function disable()
    {
    document.getElementById("Submit").value = "submit";
    var result = gbSubmit;

    if (gbSubmit)
        {
        gbSubmit = false;
        }

    document.basketForm.CheckOut.value = "purchase";
    document.getElementById("Submit").disabled = result;
    document.basketForm.submit();
    }

function change_article_picture(URL)
    {
    document.js_article_picture.src = URL;
    return;
    }

function jumpto(form)
    {
    var myindex = form.sortbar.selectedIndex

    if (form.sortbar.options[myindex].value != "0")
        {
        location = form.sortbar.options[myindex].value;
        }
    }

if (self != top)
    {
    top.location.href = location.href;
    }

// Function to "activate" images
function imgOver(imgName, StatusMsg)
    {
    document[imgName].src = eval(imgName + "h.src");
    window.status = StatusMsg;
    }

// Function to "deactivate" images.
function imgOut(imgName)
    {
    document[imgName].src = eval(imgName + "n.src");
    window.status = "";
    }

var mstat = new Array();

function klapp(mid, mdepht)
    {
    if (mstat[mdepht] == undefined)
        {
        mstat[mdepht] = "";
        }

    if (mstat[mdepht] != "" && mstat[mdepht] != mid)
        {
        window.document.getElementById(mstat[mdepht]).style.display = "none";
        }

    if (mstat[mdepht] != mid)
        {
        window.document.getElementById(mid).style.display = "block";
        window.document.getElementById(mid).style.paddingLeft = mdepht * 3;
        mstat[mdepht] = mid;
        }

    else
        {
        window.document.getElementById(mid).style.display = "none";
        mstat[mdepht] = "";
        }
    }

function popup(picture, x, y)
    {
    target = picture;
    x += 20;
    y += 20;
    window.open(target, "popup", "toolbar=no,statusbar=no,scrolling=no,menubar=no,width=" + y + ",height=" + x);
    }

function MM_findObj(n, d)
    { //v4.01
    var p, i, x;

    if (!d)
        d = document;

    if ((p = n.indexOf("?")) > 0 && parent.frames.length)
        {
        d = parent.frames[n.substring(p + 1)].document;
        n = n.substring(0, p);
        }

    if (!(x = d[n]) && d.all)
        x = d.all[n];

    for (i = 0; !x && i < d.forms.length; i++)
        x = d.forms[i][n];

    for (i = 0; !x && d.layers && i < d.layers.length; i++)
        x = MM_findObj(n, d.layers[i].document);

    if (!x && d.getElementById)
        x = d.getElementById(n);

    return x;
    }

function MM_validateForm()
    { //v4.0
    var i, p, q, nm, test, num, min, max, errors = '', args = MM_validateForm.arguments;

    for (i = 0; i < (args.length - 2); i += 3)
        {
        test = args[i + 2];
        val = MM_findObj(args[i]);

        if (val)
            {
            nm = val.name;

            if ((val = val.value) != "")
                {
                if (test.indexOf('isEmail') != -1)
                    {
                    p = val.indexOf('@');

                    if (p < 1 || p == (val.length - 1))
                        errors += '- ' + nm + ' must contain an e-mail address.\n';
                    }

                else if (test != 'R')
                    {
                    num = parseFloat(val);

                    if (isNaN(val))
                        errors += '- ' + nm + ' must contain a number.\n';

                    if (test.indexOf('inRange') != -1)
                        {
                        p = test.indexOf(':');
                        min = test.substring(8, p);
                        max = test.substring(p + 1);

                        if (num < min || max < num)
                            errors += '- ' + nm + ' must contain a number between ' + min + ' and ' + max + '.\n';
                        }
                    }
                }

            else if (test.charAt(0) == 'R')
                errors += '- ' + nm + ' is required.\n';
            }
        }

    if (errors)
        alert('The following error(s) occurred:\n' + errors);

    document.MM_returnValue = (errors == '');
    }

function MM_openBrWindow(theURL, winName, features)
    { //v2.0
    window.open(theURL, winName, features);
    }

function MM_jumpMenu2(targ, selObj, restore)
    { //v3.0
    eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");

    if (restore)
        selObj.selectedIndex = 0;
    }

function MM_jumpMenuGo(selName, targ, restore)
    { //v3.0
    var selObj = MM_findObj(selName);

    if (selObj)
        MM_jumpMenu(targ, selObj, restore);
    }

/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var offsetfrommouse = [25, -15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration = 0;         //duration in seconds image should remain visible. 0 for always.
var currentimageheight = 300;    // maximum image size.

if (document.getElementById || document.all)
    {
    document.write('<div id="trailimageid">');
    document.write('</div>');
    }

function gettrailobj()
    {
    if (document.getElementById)
        return document.getElementById("trailimageid").style

    else if (document.all)
        return document.all.trailimagid.style
    }

function gettrailobjnostyle()
    {
    if (document.getElementById)
        return document.getElementById("trailimageid")

    else if (document.all)
        return document.all.trailimagid
    }

function truebody()
    {
    return (!window.opera && document.compatMode && document.compatMode != "BackCompat")
        ? document.documentElement : document.body
    }

function showtrail(imagename, title, showthumb, height, width)
    {
    if (height > 0)
        {
        currentimageheight = height;
        }

    if (width > 0)
        {
        currentimagewidth = width;
        }

    document.onmousemove = followmouse;

    cameraHTML = '';

    newHTML = '<div class="mousetrail">';
    newHTML = newHTML + '<span class="text_big_bold">' + title + '</span><div class="borderbot"></div>';

    if (showthumb > 0)
        {
        newHTML = newHTML + '<div class="mousetrail2" align="center"><img src="' + imagename
                      + '" border="0"></div>';
        }

    newHTML = newHTML + '</div>';

    gettrailobjnostyle().innerHTML = newHTML;

    gettrailobj().visibility = "visible";
    }

function hidetrail()
    {
    gettrailobj().visibility = "hidden"
    document.onmousemove = ""
    gettrailobj().left = "-200px"
    }

function followmouse(e)
    {
    var xcoord = offsetfrommouse[0]
    var ycoord = offsetfrommouse[1]

    var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - 15
    var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight)
            : Math.min(document.body.offsetHeight, window.innerHeight)

    //if (document.all){
    //	gettrailobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '<br>B = ' + truebody().clientHeight;
    //} else {
    //	gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br>D = ' + window.innerHeight;
    //}

    if (typeof e != "undefined")
        {
        if (docwidth - e.pageX < 220)
            {
            xcoord = e.pageX - xcoord - 400; // Move to the left side of the cursor
            }

        else
            {
            xcoord += e.pageX;
            }

        if (docheight - e.pageY < (currentimageheight + 10))
            {
            ycoord += e.pageY - Math.max(0, (10 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
            }

        else
            {
            ycoord += e.pageY;
            }
        }

    else if (typeof window.event != "undefined")
        {
        if (docwidth - event.clientX < 220)
            {
            xcoord = event.clientX + truebody().scrollLeft - xcoord - 400; // Move to the left side of the cursor
            }

        else
            {
            xcoord += truebody().scrollLeft + event.clientX
            }

        if (docheight - event.clientY < (currentimageheight + 10))
            {
            ycoord += event.clientY + truebody().scrollTop
                          - Math.max(0, (10 + currentimageheight + event.clientY - docheight));
            }

        else
            {
            ycoord += truebody().scrollTop + event.clientY;
            }
        }

    var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - 15
    var docheight = document.all ? Math.max(truebody().scrollHeight, truebody().clientHeight)
            : Math.max(document.body.offsetHeight, window.innerHeight)

    gettrailobj().left = xcoord + "px"
    gettrailobj().top = ycoord + "px"
    }
