function evendoload(So)
{
        document.writeln('<link rel="stylesheet" type="text/css" href="'+ So +'/css/formate.css" />');
}
function separatNormalWindow(windowurl, bWithFocus)
{
        popup = window.open(windowurl, 'santander', 'resizable=yes,scrollbars=yes');
        if (popup && bWithFocus)
        {
                popup.window.focus();
        }
        return popup;
}
function separatNormalWindowTimeout(windowurl, bWithFocus, TimeoutMilliseconds)
{
        window.setTimeout('separatNormalWindow("' + windowurl + '", ' + bWithFocus + ')', TimeoutMilliseconds);
}
function separatWindow(windowurl, w, h)
{
        newWindow = window.open(windowurl, "", "resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,left=0,right=0,top=0,width=" + w + ",height=" + h );
}
function helpFenster(x)
{
	FensterHilfe=window.open(x,"Hilfe","width=500,height=500,screenX=100,screenY=100,scrollbars");
	if (FensterHilfe) FensterHilfe.focus();
}
function DoNo()
{
}
function SubmitOk(txt)
{
	Check = confirm(txt);
	if (Check)
		document.eingabe.submit();
}
function istzahl(s)
{
	for (i=0; i < s.length; i++)
        {
		c=s.charAt(i);
		if (!(c >='0' && c <='9'))
			return false;
        }
        return true;
}
altindex=1;
altwert=1;
function check_eingabe(item,max)
{
	var returnwert = false
	if (parseInt(item.value) < 0)
		alert("Bitte geben Sie eine positive Zahl ein" )
	else if (parseInt(item.value) > max)
		alert("Bitte geben Sie eine Zahl ein, die nicht größer als " + max + " ist.")
		else if (!istzahl(item.value))
			alert("Bitte geben Sie nur numerische Zeichen in die Felder für die Stückzahl ein. \n(Ihre Eingabe war '"+item.value+"'.)")
			else
				returnwert = true
	if (!returnwert)
        {
		item.value=altwert;
		item.focus();
        }
	return returnwert
}
function check_eingabe_k1(item, max)
{
        var bReturn;
        var fNumber;
        var fNewNumber;
        var sValue;

        bReturn = true;

        sValue = item.value;
        item.value = sValue.replace(/,/, ".");
        fNumber = parseFloat(item.value);
        if (fNumber == NaN)
        {
                alert("Bitte geben Sie nur numerische Zeichen in die Felder für die Stückzahl ein. Für die Eingabe nicht glatter Werte verwenden Sie das Komma als Dezimaltrenner!\n(Ihre Eingabe war '"+item.value+"'.)");
                item.value = '';
                item.focus();
                bReturn = false;
        }
        else
        {
                if (fNumber < 0)
                        fNumber = (-1) * fNumber;
                if (fNumber > max)
                {
                        alert("Bitte geben Sie eine Zahl ein, die nicht größer als " + max + " ist.");
                        item.focus();
                        bReturn = false;
                }
                else
                {
                        fNewNumber = fNumber * 10;
                        fNumber = Math.round(fNewNumber);
                        fNewNumber = fNumber / 10;
                        item.value = String(fNewNumber);
                }
        }
        return bReturn;
}
function emailCheck (emailStr)
{
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	var errStr='Geben Sie Ihre gültige eMail Adresse ein!'
	if (matchArray==null)
        {
		alert(errStr)
		return false
        }
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null)
        {
		alert(errStr)
		return false
        }
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null)
        {
		for (var i=1;i<=4;i++)
                {
			if (IPArray[i]>255)
                        {
				alert(errStr)
				return false
                        }
                }
                return true
        }
	var domainArray=domain.match(domainPat)
	if (domainArray==null)
        {
		alert(errStr)
		return false
        }
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>4)
        {
		alert(errStr)
		return false
        }
	if (len<2)
        {
		alert(errStr)
		return false
        }
	return true;
}
function such_nosql(str)
{
	/* var nosql = /[\x7F]/g; */
        /* var nosql = /[\x7F]/g; */
        var nosql7f, nosql7;

        nosql = /[\x7F]/g;
        nosql7f = nosql.exec(str);
        nosql = /[7]/g;
        nosql7 = nosql.exec(str);

        if (nosql7f > nosql7)
        	return true;
        else
        	return false;

	/* return nosql.test(str); */
}
function check_feld(feld)
{
	index = altindex;
	if (such_nosql(feld))
	{
		alert("Eingabewert nicht zulässig !\nWert bitte neu eingeben.");
		document.eingabe[index].focus();
		document.eingabe[index].value = "";
		return false;
	}
	else
	{
		return true;
	}
	alert("Eingabewert fehlt !");
        return false;
}
function check_fastorder(feld)
{
	index = altindex;
	if (such_nosql(feld))
        {
		alert("Eingabewert fehlerhaft !\nWert bitte neu eingeben.");
		document.fastorder[index].focus();
		document.fastorder[index].value = "";
		return false;
        }
	else
        {
		return true;
        }
	alert("Daten fehlen");
}
function oWin(url,title,sizeH,sizeV)
{
        winHandle = top.open(url,title,'toolbar=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=no,width='+sizeH+',height='+sizeV);
        if(navigator.appVersion.indexOf("MSIE 3",0)==-1) id = setTimeout('winHandle.focus()',1000);
}
function goTo(location)
{
        if (location != "")
                document.location.href = location;
}
function mnuHighLow (mnuItem, Highlight, colHigh, colLow)
{
	var zelle = 0;
	var zelleItem = '';
	var Color = Highlight ? colHigh : colLow;
	if (document.all)
        {

                while ( (zelleItem = eval ('document.all.' + mnuItem + 't' + zelle) )  )
                {
                        zelleItem.style.backgroundColor = Color;
                        zelle++;
                }
        }
        else
                if (document.body)
                {
                        zelleItem = document.getElementsByTagName ('td')[mnuItem + 't' + zelle];
                        while ( zelleItem  )
                        {
                                zelleItem.style.backgroundColor = Color;
                                zelle++;
                                zelleItem = document.getElementsByTagName ('td')[mnuItem + 't' + zelle];
                        }
                }

}
function checkAnmeldenS()
{
        if (document.anmeldenFormS.NewCustLoginname.value == "")
        {
                alert("Geben Sie Ihren Loginnamen oder Ihre Kunden-Nr. an!");
                document.anmeldenFormS.NewCustLoginname.focus();
                return false;
        }
        check_feld(document.anmeldenFormS.NewCustLoginname.value);
        check_feld(document.anmeldenFormS.kennwort.value);
        if (document.anmeldenFormS.NewCustLoginname.value != "")
                return true;
        else
                return false;
}
function ShowAktiv(tabpath, bildid)
{
  var imgobj;

  imgobj = document.getElementById(bildid);
  if (((typeof imgobj) == 'object') && (imgobj != null))
    imgobj.src = tabpath + imgobj.id + '_a.gif';
}
function ChangeAktiv(bildid)
{
  ShowAktivInDoc(bildid);
}
function checkSuche_Klein()
{
        check_feld(document.suche_klein.SearchStr.value);
        if (document.suche_klein.SearchStr.value.length < 3)
        {
                alert("Bitte geben Sie zunächst Ihren Suchbegriff mit mind. 3 Zeichen an!");
                return false;
        }
        return true;
}
function showCart(shop, SessionId, cart_pos, cart_sum, cart_sumwkz)
{
	if (cart_pos != '')
        {
        	document.write('<div style="float:left; vertical-align:middle;"><a href="e-vendo.php?shop=' + shop + '&SessionId=' + SessionId + '&a=cart"><img src="' + shop + '/nav/cartsmall.gif" alt="Zu Ihrem Warenkorb ..." /></a></div>');
                document.write('<div><table cellpadding="0" cellspacing="0" border="0">');
                document.write('<tr><td><span class="sTopCart">Artikel:&nbsp;</span></td><td><span class="sTopCart">' + cart_pos + '</span></td></tr>');
                document.write('<tr><td><span class="sTopCart">Summe:&nbsp;</span></td><td><span class="sTopCart">' + cart_sum + ' ' + cart_sumwkz + '</span></td></tr>');
                document.write('</table></div><div style="clear:left;"></div>');
                document.write('<div align="center" style="margin-top:6px;"><a href="e-vendo.php?shop=' + shop + '&SessionId=' + SessionId + '&a=cart">Zum Warenkorb</a> / <a href="e-vendo.php?shop=' + shop + '&SessionId=' + SessionId + '&a=cart">Zur Kasse</a></div>');
        }
        else
        {
        	document.write('Im Warenkorb befinden sich keine Produkte.');
        }
}
function completeURLSession(url, SessionId)
{
  var gourl, lastSessionId, matchResult, startSessionId, restSessionId, startAmpersand, lastChar;

  gourl = '';
  // haben wir eine verwertbare SessionId jetzt?
  // und haben wir eine verwertbare letzte URL?
  if ((SessionId != '') && url.length)
  {
    bReady = false;
    lastSessionId = '';

    // ist in der letzten URL irgendwas von SessionId?
    startSessionId = url.search('SessionId=');
    if (startSessionId != -1)
    {
      // kommt nach der SessionId noch ein weiterer Parameter?
      restSessionId = url.substr(startSessionId);
      startAmpersand = restSessionId.search('&');
      if (startAmpersand != -1)
      {
        if (startAmpersand != 1)
        {
          // die SessionId ist leer
        }
        else
        {
          // da kommt noch einer oder noch weitere Parameter hinzu
          matchResult = restSessionId.match(/=(.+)&/);
          if (matchResult != '')
          {
            lastSessionId = RegExp.$1;
          }
        }
      }
      else
      {
        // also, die SessionId ist der letzte Parameter

        // welchen Wert hat denn die bisherige SessionId?
        matchResult = restSessionId.match(/=(.+)/);
        if (matchResult != '')
        {
          lastSessionId = RegExp.$1;
        }
      }
      // unterscheidet sich die bisherige von der neuen SessionId?
      if (lastSessionId != SessionId)
      {
        urlpart1 = url.substring(0, startSessionId);
        urlpart2 = 'SessionId=' + SessionId;
        urlpart3 = '';

        if (startAmpersand != -1)
        {
          urlpart3 = restSessionId.substring(startAmpersand);
        }

        gourl = urlpart1 + urlpart2 + urlpart3;
      }
    }
    else
    {
      // in der letzten URL steht nix von irgendeiner SessionId
      // also muessen wir da eine anhaengen
      alert(url);
      lastChar = url.charAt(url.length);
      if (lastChar == '/')
      {
        // es endet mit /, also sollten wir irgendwas gescheites mit anhaengen
        gourl = url + 'e-vendo.php?SessionId=' + SessionId;
      }
      else
      {
        if ((lastChar == '?') || (lastChar == '&'))
        {
          gourl = url + 'SessionId=' + SessionId;
        }
        else
        {
            // also, es endet nicht mit /, nicht mit ? und nicht mit &

            // gibt es irgendwo ein Fragezeichen?
            if (url.search(/\?/) != -1)
            {
              // also ein Fragezeichen gibt es schon
              gourl = url + '&';
            }
            else
            {
              // es gibt noch kein Fragezeichen im String
              gourl = url + '?';
            }

            // dann haengen wir einfach die SessionId mit ran
            gourl = gourl + 'SessionId=' + SessionId;
        }
      }
    }
  }
  return gourl;
}
function goback(SessionId)
{
  history.back();
  /*
  var lasturl, gourl;

  lasturl = document.referrer;

  // haben wir eine verwertbare SessionId jetzt?
  // und haben wir eine verwertbare letzte URL?
  if ((SessionId != '') && lasturl.length)
  {
    gourl = completeURLSession(lasturl, SessionId);
    if (gourl != '')
      location.replace(gourl);
    else
      history.back();
  }
  else
  {
    // keine SessionId oder keine verwertbare letzte URL, also einfach nur ein Zurueck in der History
    history.back();
  }
  */
}
function gobackreload(SessionId)
{
  history.back();
  /*
  var lasturl, gourl;

  lasturl = document.referrer;

  // haben wir eine verwertbare SessionId jetzt?
  // und haben wir eine verwertbare letzte URL?
  if ((SessionId != '') && lasturl.length)
  {
    gourl = completeURLSession(lasturl, SessionId);
    if (gourl != '')
      location.replace(gourl);
    else
      location.replace(lasturl);
  }
  else
  {
    // keine SessionId oder keine verwertbare letzte URL, also einfach nur ein Zurueck in der History
    history.back();
  }
  */
}
function topreload(SessionId)
{
}
function otopreload(SessionId)
{
  var lasturl, newurl;

  lasturl = opener.location.href;
  newurl = completeURLSession(lasturl, SessionId);
  if (newurl != '')
    opener.location.replace(newurl);
  else
    opener.location.reload();
}
function oframesreload(SessionId)
{
  otopreload(SessionId);
}
function parentreload(SessionId)
{
  var lasturl, newurl;

  lasturl = parent.location.href;
  newurl = completeURLSession(lasturl, SessionId);
  if (newurl != '')
    parent.location.replace(newurl);
  else
    parent.location.reload();
}
function hidepbox(checkid, hideid)
{
  var myobj;
  myobj = document.getElementById(checkid);
  if (((typeof myobj) == 'object') && (myobj != null) && (myobj.childNodes.length == 0))
  {
    myobj = document.getElementById(hideid);
    if (((typeof myobj) == 'object') && (myobj != null))
      myobj.style.display = 'none';
  }
}
function goSelectOption(select)
{
  var wert = select.options[select.options.selectedIndex].value;
  if (wert != "-")
    location.href = wert;
}
function isPrintVersion()
{
  return window.location.search.search(/print=on/) != (-1);
}
function makePrintLink(shop)
{
  if (!isPrintVersion())
  {
    var printlink = '';

    printlink = window.location.protocol + '//' + window.location.hostname + window.location.pathname + window.location.search;
    if (window.location.search != "") { printlink = printlink + '&'; } else { printlink = printlink + '?'; }
    printlink = printlink + 'print=on';
    document.write('<div id="printversion"><a href="' + printlink + '" title="Hier gelangen Sie zur Druckansicht dieser Seite" target="_blank" rel="nofollow"><img src="' + shop + '/nav/druckversion.gif" alt="Hier gelangen Sie zur Druckansicht dieser Seite" />Druckversion</a></div>');
  }
}
function printTabs(jQuery, tabselector)
{
/*
  jQuery(tabselector + " > ul:first > li  > a", document.body).each(function() {
    var litag = $(this).parent();
    if (litag.css("display") != "none")
    {
      var contentid = $(this).attr("href");
      $(contentid).before('<div class="tabReiter">' + $(this).html() + '</div>');
      litag.css("display", "none");
      $(contentid).toggleClass("tabContent");
    }
  });
  jQuery(tabselector + " > ul:first").css("display", "none");
*/
}
