// ###########################################
// ###  Ajax-Bildwechsel                   ###
// ###########################################

function bildwechsel2(bildnr)
{
	var xmlHttp = null;
  // Mozilla, Opera, Safari sowie Internet Explorer 7
  if (typeof XMLHttpRequest != 'undefined') {
      xmlHttp = new XMLHttpRequest();
  }
  if (!xmlHttp) {
      // Internet Explorer 6 und älter
      try {
          xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
      } catch(e) {
          try {
              xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
          } catch(e) {
              xmlHttp  = null;
          }
      }
  }
  if (xmlHttp) {
      xmlHttp.open('POST', 'inc/ambienteajax.php', true);
      xmlHttp.onreadystatechange = function () {
          if (xmlHttp.readyState == 4) {
              document.images.galeriefoto.src = ('' + bildnr  + '');
          }
      };
      xmlHttp.send(null);
  }
}

// ###########################################
// ###  Chokoladenmanufaktur              ###
// ###########################################

function caption(boxnr) {
  if (document.getElementById('caption').style.visibility == 'hidden')
	  document.getElementById('caption').style.visibility = 'visible';
	else 
	  document.getElementById('caption').style.visibility = 'hidden';
	if (boxnr == 'caption1') document.getElementById('caption').innerHTML = 'Karotte-Koriander';
	if (boxnr == 'caption2') document.getElementById('caption').innerHTML = 'Orange-Thymian';
	if (boxnr == 'caption3') document.getElementById('caption').innerHTML = 'Zartbitter-Gold';
	if (boxnr == 'caption4') document.getElementById('caption').innerHTML = 'Sweetbitter-Chili';
	if (boxnr == 'caption5') document.getElementById('caption').innerHTML = 'Eisenkraut-Passionsfrucht';
	if (boxnr == 'caption6') document.getElementById('caption').innerHTML = 'Zitronengras';
	if (boxnr == 'caption7') document.getElementById('caption').innerHTML = 'Toffee Tea'; }                                                                          


function details(boxnr)
{
	var xmlHttp = null;
  // Mozilla, Opera, Safari sowie Internet Explorer 7
  if (typeof XMLHttpRequest != 'undefined') {
      xmlHttp = new XMLHttpRequest();
  }
  if (!xmlHttp) {
      // Internet Explorer 6 und älter
      try {
          xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
      } catch(e) {
          try {
              xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
          } catch(e) {
              xmlHttp  = null;
          }
      }
  }
  if (xmlHttp) {
      xmlHttp.open('POST', 'inc/pralinenresponse.php?boxnr='+ boxnr +'', true);
      xmlHttp.onreadystatechange = function () {
          if (xmlHttp.readyState == 4) {
          	if (document.getElementById('detailbox').style.display == 'none')
	            document.getElementById('detailbox').style.display = '';
	          else 
	            document.getElementById('detailbox').style.display = 'none';
            document.getElementById('detailbox').innerHTML = xmlHttp.responseText;
          }
      };
      xmlHttp.send(null);
  }
}

function schliessen() {
	document.getElementById('detailbox').style.display = 'none';
}

// ###########################################
// ###  E-Mail-Verschlüsselung             ###
// ###########################################
function UnCryptMailto( s )
{
    var n = 0;
    var r = "";
    for( var i = 0; i < s.length; i++)
    {
        n = s.charCodeAt( i );
        if( n >= 8364 )
        {
            n = 128;
        }
        r += String.fromCharCode( n - 1 );
    }
    return r;
}

function linkTo_UnCryptMailto( s )
{
    location.href=UnCryptMailto( s );
}

  var numArt=10;
  function openwindow(URLlink,URLtarget)
  {
  newwin=window.open(URLlink, URLtarget,'resizable=yes,width=650,height=450,scrollbars=yes,titlebar=no,status=no,menubar=no,toolbar=no,location=no,left=20,top=20');
  };
  
function fieldCheck ()
	{	
		if ((document.email.name.value == "") || (document.email.telefon.value == "") || (document.email.email.value == "") || (document.email.betreff.value == "") || (document.email.nachricht.value == "") )
			{	alert ('Bitte füllen Sie alle Felder aus, damit Sie Ihre Nachricht senden können.'); return false;	}
				else {	return true;	}
			}
			
function printpage() {
  window.print();  
}			
