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 such_nosql(str)
{
        var nosql = /[\x7F]/g;
        return nosql.test(str);
}
function check_Suchfeld(feldobject)
{
        if (such_nosql(feldobject.value))
        {
                alert("Eingabewert nicht zulässig!\nWert bitte neu eingeben.");
                feldobject.focus();
                feldobject.value = "";
                return false;
        }
        else
        {
                return true;
        }
        alert("	Eingabewert fehlt!");
}
function checkSuche(feldobject, feldobject_1)
{
        if (check_Suchfeld(feldobject_1))
        {
                feldobject.value = feldobject_1.value;
                return true;
        }
        return false;
}
function helpFenster(x)
	{
	FensterHilfe=window.open(x,"Hilfe","width=400,height=300,screenX=100,screenY=100,scrollbars");
	FensterHilfe.focus();
	}

function DoNo()
	{
	}

function lageranzeige(Sh, lager, lager_menge)
	{
	if ( lager == "J" )
		{
		if ( lager_menge > 0)
			document.writeln ('<img src="'+ Sh +'/nav/b_lage1.gif" border="0">');
		else
			document.writeln ('<img src="'+ Sh +'/nav/b_lage1_1.gif" border="0">');
		}
	else
		document.writeln ('<font face="{SAL_FACE1}" size="2"></font>');
	}

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 kleiner 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;
		document.eingabe[altindex].focus();
		}
	return returnwert
	}

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>3)
		{
		alert(errStr)
		return false
		}
	if (len<2)
		{
		alert(errStr)
		return false
		}
	return true;
	}

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!");
}

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 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)
{
  parent.fr_korb.location.reload();
  /*
  var lasttopurl, newtopurl;

  lasttopurl = parent.fr_korb.location.href;
  newtopurl = completeURLSession(lasttopurl, SessionId);
  if (newtopurl != '')
    parent.fr_korb.location.replace(newtopurl);
  else
    parent.fr_korb.location.reload();
  */
}
function otopreload(SessionId)
{
  opener.parent.fr_korb.location.reload();
  /*
  var lasttopurl, newtopurl;

  lasttopurl = opener.parent.fr_korb.location.href;
  newtopurl = completeURLSession(lasttopurl, SessionId);
  if (newtopurl != '')
    opener.parent.fr_korb.location.replace(newtopurl);
  else
    opener.parent.fr_korb.location.reload();
  */
}
function mnuHighLow (idname, classname)
{
  var myobj;

  myobj = document.getElementById(idname);
  if (((typeof myobj) == 'object') && (myobj != null))
  {
    myobj.className = classname;
  }
}
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>');
  }
}
var blank = new Image();
function fixPng(png) {
  // get src
  var src = png.src;
  // set width and height
  if (!png.style.width) { png.style.width = $(png).width(); }
  if (!png.style.height) { png.style.height = $(png).height(); }
  // replace by blank image
  png.onload = function() { };
  png.src = blank.src;
  // set filter (display original image)
  png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}
function evpngfix(shop)
{
  if (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32") {
    blank.src = shop + '/nav/pixel.gif';
    // get all pngs on page
    $('img[src$=.png]').each(function() {
      if (!this.complete) {
        this.onload = function() { fixPng(this) };
      } else {
        fixPng(this);
      }
    });
  }
}
// Anfang Slideshow Artikeldetailansicht
function stopSlide() {
  window.clearInterval(aktiv);
}
function setSlideLeft() {
  if (barwidth > barmax) {
    barmax = -(slidebar.scrollWidth - bardiff);
    aktiv = window.setInterval("SlideLeft()", barspeed);
  }
}
function SlideLeft() {
  if (barwidth > barmax) {
    if (barposition <= barmax) {
      barposition = barmax;
      endArrow('rightslide');
      startArrow('leftslide');
    } else {
      barposition = barposition - 1;
      startArrow('leftslide');
    }
    slidebar.style.left =  barposition + 'px';
  }
}
function setSlideRight() {
  if (barwidth > barmax) {
    barmax = -(slidebar.scrollWidth - bardiff);
    aktiv = window.setInterval("SlideRight()", barspeed);
  }
}
function SlideRight() {
  if (barwidth > barmax) {
    if (barposition >= barmin) {
      barposition = 0;
      endArrow('leftslide');
      startArrow('rightslide');
    } else {
      barposition = barposition + 1;
      startArrow('rightslide');
    }
    slidebar.style.left =  barposition + 'px';
  }
}
function imageSlide(imagenr) {
  if (lastidnr != '') {
    document.getElementById('detailimagea_' + lastidnr).className = 'detailimagea_h';;
    document.getElementById('detailimageaimg_' + lastidnr).className = 'detailimageaimg_h';;
  }
  document.getElementById('detailimagea_' + imagenr).className = 'detailimagea_v';;
  document.getElementById('detailimageaimg_' + imagenr).className = 'detailimageaimg_v';;
  lastidnr = imagenr;
}
function endArrow(id) {
  document.getElementById(id).className = 'slightarrow_light';
}
function startArrow(id) {
  document.getElementById(id).className = 'slightarrow_full';
}
// Ende Slideshow Artikeldetailansicht

