// Standard JavaScript - Funktionen für den Workflow

function wf_std_set_formIndex(id)
{
    //formIndex   = id; do nothing
    return;
}

function wf_std_suchen()
{
    document.eshop.SUCHE.value = '1';
    wf_std_submit();
}

function wf_std_viewDetails(id)
{
    document.eshop.ARTIKELINFO.value = id;
    wf_std_submit();
}

function wf_std_submit()
{
    document.eshop.submit();
}

function displayDiv(id)
{
    if(document.getElementById(id).style.display == 'none')
    {
        document.getElementById(id).style.display = 'block';
//         document.getElementById('link'+id).innerHTML = '<<&nbsp;weniger&nbsp;&nbsp;';
        document.getElementById('link'+id).src = '../standard/bilder/up.gif';
    }
    else
    {
        document.getElementById(id).style.display = 'none';
//         document.getElementById('link'+id).innerHTML = '>>&nbsp;mehr&nbsp;&nbsp;';
        document.getElementById('link'+id).src = '../standard/bilder/down.gif';
    }
}



var tipDiv;
function genToolTip()
{
    tipDiv = document.getElementById('wf_std_tooltip');
}

window.onload = genToolTip;

function showTip(e, txt)
{
    if(tipDiv)
    {
        var e                = e || window.event;
        var xy               = cursorPos(e);
        tipDiv.innerHTML     = txt;
        tipDiv.style.left    = (xy[0] - 320) + 'px';
        tipDiv.style.top     = (xy[1] - 120) + 'px';
        tipDiv.style.display = '';
    }
}

function hideTip()
{
    if(tipDiv)
    {
        tipDiv.style.display = 'none';
    }
}

function cursorPos(e)
{
    if(e.pageX || e.pageY)
        return [ e.pageX, e.pageY ];
    else if(e.clientX || e.clientY)
        return [e.clientX + document.body.scrollLeft,e.clientY + document.body.scrollTop];
}



function goStep(nr)
{
    f   = document.eshop;

    f.stepback.value            = nr;
    f.SHOWFORM.value            = '1';
    f.wiederholeseite.value     = nr;
    f.wasstep.value             = '';
    f.STEP.value                = '';
    f.submit();
}


function changeSort(feld)
{
    document.eshop.CHANGESORT.value = feld;
    document.eshop.submit();
}


function wf_std_setUserName(username, feldname)
{
    document.getElementsByName(feldname)[0].value=username;
    return false;
}
var showButton = true;
function wf_std_showButton(button,anzeigen)
{
    showButton = anzeigen;
}

function loescheArtikel(artikelNr)
{
    document.eshop.DELETE_ARTIKEL.value=artikelNr;
    document.eshop.submit();
}


function wf_std_loginneukunde()
{
    document.eshop.NEUKUNDE.value= '1';
    document.eshop.PW_REMEMBER.value= '0';
    document.eshop.submit();
}

function wf_std_login()
{
    document.eshop.PW_REMEMBER.value='0';
    document.eshop.USERLOGIN.value='1';
    document.eshop.NEUKUNDE.value='0';
}

function wf_std_remember()
{
    document.eshop.PW_REMEMBER.value='1';
    document.eshop.USERLOGIN.value='0';
    document.eshop.NEUKUNDE.value='0';
    document.eshop.submit();
}


function wf_std_setDisplay(id)
{
    if(document.getElementById('DISPLAY'+id).value=='1')
        document.getElementById('DISPLAY'+id).value='0';
    else
        document.getElementById('DISPLAY'+id).value='1';
}


function wf_std_neuanmeldung()
{
    document.eshop.PW_REMEMBER.value='0';
    document.eshop.USERLOGIN.value='0';
    document.eshop.NEUKUNDE.value='1';
    document.eshop.submit();
}

function es_std_BucheArtikel(artikel)
{
    document.eshop.INFO_ARTIKEL.value    = '';
    document.eshop.BUCHE_ARTIKEL.value   = artikel;
    document.eshop.DELETE_ARTIKEL.value = '';
    document.eshop.ZUR_KASSE.value       = '';
    document.eshop.submit();
}
function es_std_ShowInfo(artikel)
{
    document.eshop.INFO_ARTIKEL.value    = artikel;
    document.eshop.BUCHE_ARTIKEL.value   = '';
    document.eshop.DELETE_ARTIKEL.value = '';
    document.eshop.ZUR_KASSE.value       = '';
    document.eshop.submit();
}
function es_std_LoescheArtikel(artikel)
{
    document.eshop.INFO_ARTIKEL.value    = '';
    document.eshop.BUCHE_ARTIKEL.value   = '';
    document.eshop.DELETE_ARTIKEL.value = artikel;
    document.eshop.ZUR_KASSE.value       = '';
    document.eshop.submit();
}
function es_std_zurKasse(artikel)
{
    document.eshop.INFO_ARTIKEL.value    = '';
    document.eshop.BUCHE_ARTIKEL.value   = '';
    document.eshop.DELETE_ARTIKEL.value = '';
    document.eshop.ZUR_KASSE.value       = 1;
    document.eshop.submit();
}

function es_std_setPerPage(anzahl)
{
    document.eshop.INFO_ARTIKEL.value    = '';
    document.eshop.BUCHE_ARTIKEL.value   = '';
    document.eshop.DELETE_ARTIKEL.value = '';
    document.eshop.ZUR_KASSE.value       = '';
    document.eshop.ANZAHL.value          = anzahl;
    document.eshop.submit();
}

function es_std_browsetable(wert)
{
    document.eshop.INFO_ARTIKEL.value    = '';
    document.eshop.BUCHE_ARTIKEL.value   = '';
    document.eshop.DELETE_ARTIKEL.value = '';
    document.eshop.ZUR_KASSE.value       = '';
    document.eshop.START.value           = wert;
    document.eshop.submit();
}

function es_std_neu_berechnen()
{
    document.eshop.ARTIKEL_BERECHNEN.value  = '1';
    document.eshop.DELETE_ARTIKEL.value    = '';
    document.eshop.submit();
}

function es_std_LoescheArtikel(artikel)
{
    if(confirm('Soll der Artikel wirklich aus dem Warenkorb gelöscht werden?'))
    {
        document.eshop.DELETE_ARTIKEL.value    = artikel;
        document.eshop.ARTIKEL_BERECHNEN.value  = '';
        document.eshop.submit();
    }
}


function es_std_weitere_artikel(menu)
{
    document.eshop.DELETE_ARTIKEL.value     = '';
    document.eshop.ARTIKEL_BERECHNEN.value   = '';
    document.eshop.WEITERE.value             = '1';
    document.eshop.GRUPPE.value				 = '';
    document.eshop.NEWGRUPPE.value			 = '';
    document.eshop.menu.value			 = '';
    document.eshop.action='evewa2.php?menu='+menu;
    document.eshop.submit();
}
