// FLASH VARS
    // -----------------------------------------------------------------------------
    // Globale Variablen
    // Erforderliche Hauptversion von Flash
    var requiredMajorVersion = 6;
    // Erforderliche Unterversion von Flash
    var requiredMinorVersion = 0;
    // Erforderliche Flash-Revision
    var requiredRevision = 0;
    // Die unterstützte JavaScript-Version
    var jsVersion = 1.0;
    // -----------------------------------------------------------------------------
    //

// FLASH ABFRAGE
    // Client-Browsertyp ermitteln
    var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
    var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
    var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
    jsVersion = 1.1;
    // JavaScript-Hilfsprogramm ist zur Ermittlung der Versionsinformationen des Flash Player Plug-Ins erforderlich
    function JSGetSwfVer(i){
      // NS/Opera-Version >= 3 auf Flash-Plug-In im Plug-In-Array prüfen
      if (navigator.plugins != null && navigator.plugins.length > 0) {
        if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
          var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
              var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
          descArray = flashDescription.split(" ");
          tempArrayMajor = descArray[2].split(".");
          versionMajor = tempArrayMajor[0];
          versionMinor = tempArrayMajor[1];
          if ( descArray[3] != "" ) {
            tempArrayMinor = descArray[3].split("r");
          } else {
            tempArrayMinor = descArray[4].split("r");
          }
              versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
                flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
            } else {
          flashVer = -1;
        }
      }
      // MSN/WebTV 2.6 unterstützt Flash 4
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
      // WebTV 2.5 unterstützt Flash 3
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
      // älteres WebTV unterstützt Flash 2
      else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
      // Ermittlung in allen anderen Fällen nicht möglich
      else {

        flashVer = -1;
      }
      return flashVer;
    }
    // Wenn der Funktionsaufruf ohne Parameter erfolgt, gibt diese Funktion einen Gleitkommawert zurück,
    // bei dem es sich entweder um die Flash Player-Version oder um 0.0 handelt.
    // Beispiel: Flash Player 7r14 gibt 7.14 zurück.
    // Wenn reqMinorVer, reqMajorVer, reqRevision aufgerufen wird, wird 'true' zurückgegeben, sofern diese bzw. eine höhere Version verfügbar ist
    function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
    {
      reqVer = parseFloat(reqMajorVer + "." + reqRevision);
        // Versionen rückwärts durchlaufen, bis die neueste Version gefunden wird
      for (i=25;i>0;i--) {
        if (isIE && isWin && !isOpera) {
          versionStr = VBGetSwfVer(i);
        } else {
          versionStr = JSGetSwfVer(i);
        }
        if (versionStr == -1 ) {
          return false;
        } else if (versionStr != 0) {
          if(isIE && isWin && !isOpera) {
            tempArray         = versionStr.split(" ");
            tempString        = tempArray[1];
            versionArray      = tempString .split(",");
          } else {
            versionArray      = versionStr.split(".");
          }
          versionMajor      = versionArray[0];
          versionMinor      = versionArray[1];
          versionRevision   = versionArray[2];

          versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
          versionNum        = parseFloat(versionString);
              // ist die Hauptrevision >= angeforderte Hauptrevision UND die Nebenversion >= angeforderte Nebenversion
          if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
            return true;
          } else {
            return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );
          }
        }
      }
      return (reqVer ? false : 0.0);
    }
    //

// POPUP

w = parseInt(screen.width);
h = parseInt(screen.height);
w2 = (w-1059)/2;
h2 = (h-690)/2;
theOpts="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=1059,height=690,screenX="+w2+",screenY="+h2+",left="+w2+",top="+h2;
function open_window(url) {
mywin = window.open(url,"win",theOpts);
}

// POPUP AUTOSCALE

function showPicture(pictureToShow, windowTitle)
{
PicWin=window.open("","PictureViewer",'status=0,scrollbars=no,resizable=no,width=440,height=341,screenX=50,screenY=50,top=250,left=250');
PicWin.document.open();
PicWin.document.writeln('<html><head><title>GWD - GreenTeens - der Jugendclub</title><link rel="stylesheet" href="style.css" type="text/css"></head>');
PicWin.document.writeln('<body>');
PicWin.document.writeln('<a href="javascript:this.close()"><img onLoad="window.opener.resizeWindow(10,30,0);" border="0" src="'+ pictureToShow +'"></a>');
PicWin.document.writeln('</body></html>');
PicWin.document.close();
}
function resizeWindow(Hborder, Vborder, millisecs)
{
setTimeout("PicWin.resizeTo(PicWin.document.images[0].width + " + Hborder + ", PicWin.document.images[0].height + " + Vborder + ");", millisecs);
}

// ROLLOVER

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



//POPUP CSS

function showpopup(games) {

//        alert("test");

if(document.getElementById('popup').style.visibility=='hidden') {
  document.getElementById('popup').style.visibility='visible';
 }
 else if(document.getElementById('popup').style.visibility=='visible') {
  document.getElementById('memory').style.display='none';

    if(games == 'close') {
          document.getElementById('popup').style.visibility='hidden';
         }
 }
   if (games == 'memory') {
   if(document.getElementById(maschine).style.display=='none') {
    document.getElementById(maschine).style.display='block';
   }
   else if(document.getElementById(maschine).style.display=='block') {
    document.getElementById(maschine).style.display='none';
   }
  }
}

//Formular CHECK

function decode_utf8(utftext) {
  var plaintext = ""; var i=0; var c=c1=c2=0;
  // while-Schleife, weil einige Zeichen uebersprungen werden
  while(i<utftext.length){
    c = utftext.charCodeAt(i);
    if (c<128) {
      plaintext += String.fromCharCode(c);
    i++;}
    else if((c>191) && (c<224)) {
      c2 = utftext.charCodeAt(i+1);
      plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
    i+=2;}
    else {
      c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
      plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
    i+=3;}
  }
  return plaintext;
}

function encode_utf8(rohtext) {
  // dient der Normalisierung des Zeilenumbruchs
  rohtext = rohtext.replace(/\r\n/g,"\n");
  var utftext = "";
  for(var n=0; n<rohtext.length; n++){
    // ermitteln des Unicodes des  aktuellen Zeichens
    var c=rohtext.charCodeAt(n);
    // alle Zeichen von 0-127 => 1byte
    if (c<128)
      utftext += String.fromCharCode(c);
      // alle Zeichen von 127 bis 2047 => 2byte
    else if((c>127) && (c<2048)) {
      utftext += String.fromCharCode((c>>6)|192);
      utftext += String.fromCharCode((c&63)|128);}
      // alle Zeichen von 2048 bis 66536 => 3byte
    else {
      utftext += String.fromCharCode((c>>12)|224);
      utftext += String.fromCharCode(((c>>6)&63)|128);
      utftext += String.fromCharCode((c&63)|128);
    }
  }
  return utftext;
}

function IsEmail(field) {
  // werden regular expressions unterstuetzt?
  var supported = 0;
  if (window.RegExp) {
  var tempStr = "a";
  var tempReg = new RegExp(tempStr);
  if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) return (field.indexOf(".") > 2) && (field.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 =
  new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(field) && r2.test(field));
}

function SaveChecked(){
  var message = '';
  if(document.getElementById('name').value==''){    message+= 'Bitte geben Sie Ihren Namen an!\n'; }
  if(document.getElementById('strasse').value==''){  message+= 'Bitte geben Sie Ihre Straße an!\n'; }
  if(document.getElementById('plzort').value==''){  message+= 'Bitte geben Sie Ihre Postleitzahl und den Ort an!\n'; }
  if(document.getElementById('telefon').value==''){  message+= 'Bitte geben Sie Ihre Telefonnummmer an!\n'; }
  if(!IsEmail(document.getElementById('email').value)){  message+='Bitte geben Sie eine gültige E-Mail Adresse ein!\n'; }
  if(document.getElementById('feedback').value==''){  message+= 'Bitte geben Sie Ihr Feedback ein!\n'; }
  if(message!=''){ alert(message); return false; }
  else{
              //document.forms[0].submit();
                 return true;
         }
}

function SaveChecked2(){
  var message = '';
  if(document.getElementById('name').value==''){    message+= 'Bitte geben Sie Ihren Namen an!\n'; }
  if(document.getElementById('strasse').value==''){  message+= 'Bitte geben Sie Ihre Straße an!\n'; }
  if(document.getElementById('plzort').value==''){  message+= 'Bitte geben Sie Ihre Postleitzahl und den Ort an!\n'; }
  if(document.getElementById('telefon').value==''){  message+= 'Bitte geben Sie Ihre Telefonnummmer an!\n'; }
  if(!IsEmail(document.getElementById('email').value)){  message+='Bitte geben Sie eine gültige E-Mail Adresse ein!\n'; }
  if(document.getElementById('feedback').value==''){  message+= 'Bitte geben Sie Ihr Feedback ein!\n'; }
  if(message!=''){ alert(message); return false; }
  else{
              //document.forms[0].submit();
                 return true;
         }
}

function extraSearch(){
  if(document.getElementById("extraSearch").style.display=="block"){
    document.getElementById("extraSearch").style.display="none";
  }else{
    document.getElementById("extraSearch").style.display="block"
  }
}

function checkSubmit(){
  var msg='';
  if(document.formular.Name.value==''){ msg+='Bitte geben Sie Ihren Namen ein!\n' }
  if(document.formular.Telefon.value==''){ msg+='Bitte geben Sie Ihre Telefon-Nr. ein!\n' }
  if(document.formular.Strasse.value==''){ msg+='Bitte geben Sie Ihre Strasse ein!\n' }
  if(document.formular.Ort.value==''){ msg+='Bitte geben Sie Ihren Ort ein!\n' }
  if(document.formular.email.value==''){ msg+='Bitte geben Sie Ihre E-Mail Adresse ein!\n' }
  if(document.formular.Feedback.value==''){ msg+='Bitte geben Sie Ihr Feedback ein!\n' }
  if(msg!=''){
    alert(msg);
  }else{
    document.formular.submit();
  }
}

function checkSubmit2(){
  var msg2='';
  if(document.formular2.Name.value==''){ msg2+='Bitte geben Sie Ihren Namen ein!\n' }
  if(document.formular2.VorName.value==''){ msg2+='Bitte geben Sie Ihren Vornamen ein!\n'; }
  if(document.formular2.email.value==''){ msg2+='Bitte geben Sie Ihre E-Mail Adresse ein!\n'; }
  if(document.formular2.GebJahr.value==''){ msg2+='Bitte geben Sie Ihr Geburtsjahr ein!\n'; }
  if(document.formular2.Familienstand.value==''){ msg2+='Bitte geben Sie Ihren Familienstand ein!\n'; }
  if(document.formular2.Strasse.value==''){ msg2+='Bitte geben Sie Ihre Strasse ein!\n'; }
  if(document.formular2.Ort.value==''){ msg2+='Bitte geben Sie Ihren Ort ein!\n'; }
  if(document.formular2.Telefon.value==''){ msg2+='Bitte geben Sie Ihre Telefon-Nr. ein!\n'; }
  //if(document.formular2.fuehrerschein.value==''){ msg2+='Bitte geben Sie Ihre F&uml;hrerscheininformation ein!\n'; }
  if(document.formular2.Schulabschluss.value==''){ msg2+='Bitte geben Sie Ihren Schulabschluss ein!\n'; }
  if(msg2!=''){
    alert(msg2);
  }else{
    document.formular2.submit();
    //alert("alle felder sind ok");
  }
}

//Menue Popup // FischerCGD - PSch
function openSubMenue(boxid){
    document.getElementById(boxid).style.visibility='visible';
}
function closeSubMenue(boxid){
    document.getElementById(boxid).style.visibility='hidden';
}


//Umlaute ändern
function add2Doc(headlineText) {
 for(i = 1; i < 8; i++) {
  if(i==1) { a="ae"; b="ä"; }
  if(i==2) { a="oe"; b="ö"; }
  if(i==3) { a="ue"; b="ü"; }
  while (headlineText.indexOf(a)>-1) {
   pos=headlineText.indexOf(a);
   headlineText=(headlineText.substring(0, pos)+b+
   headlineText.substring((pos + a.length), headlineText.length));
  }
 }
 return headlineText;
}

//Aktualisieren Standort_navi
Standorte = new Array("Bielefeld", "Luebbecke");
var lastLocationID = 0;

function changeLocation(){
  document.getElementById(Standorte[lastLocationID]).style.display='none';
  lastLocationID = lastLocationID + 1;
  if (Standorte[lastLocationID] == undefined){
    lastLocationID = 0;
  }
    document.getElementById("StandortField").value = add2Doc(Standorte[lastLocationID]);
    document.getElementById(Standorte[lastLocationID]).style.display='block';
}

function chgGallery(src,id,anz){
  var req=getRequestObject();
  getPageJS(src,id,anz);
}

function startJavascript(anz){
    if(anz==''){
      anz=-1;
    }

  var box = {};
  window.addEvent('domready', function(){
    box = new MultiBox('mb', {descClassName: 'multiBoxDesc', useOverlay: true, fixedTop: 20});
  });

  window.addEvent('domready', function(){
      var totIncrement    = 0;
      var increment      = 246;
      var maxRightIncrement  = increment*(anz);
      var fx = new Fx.Style('myList', 'margin-left', {
          duration: 1000,
          transition: Fx.Transitions.Back.easeInOut,
          wait: true
       });

       //-------------------------------------
      // EVENTS for the button "previous"
      $('previous').addEvents({
            'click' : function(event){
        if(totIncrement<0){
            totIncrement = totIncrement+increment;
            fx.stop()
            fx.start(totIncrement);
          }
        }
        });

         //-------------------------------------
      // EVENTS for the button "next"
        $('next').addEvents({
            'click' : function(event){
         if(totIncrement>maxRightIncrement){
           totIncrement = totIncrement-increment;
            fx.stop()
          fx.start(totIncrement);
        }
            }
        })


  });

}



function click(){

}