FlashObject = function(swf, id, w, h, ver, c, wm) {
   this.swf = swf;
   this.id = id;
   this.width = w;
   this.height = h;
   this.version = ver || 6; // default to 6
   this.align = "middle"; // default to middle
   this.redirect = "";
   this.sq = document.location.search.split("?")[1] || "";
   this.altTxt = "Please <a href='http://www.macromedia.com/go/getflashplayer'>upgrade your Flash Player</a>.";
   this.bypassTxt = "<p>Already have Flash Player? <a href='?detectflash=false&"+ this.sq +"'>Click here if you have Flash Player "+ this.version +" installed</a>.</p>";
   this.params = new Object();
   this.variables = new Object();
   if (c) this.color = this.addParam('bgcolor', c);
   if (wm) this.addParam('wmode', 'transparent'); // wm
   this.addParam('quality', 'high'); // default to high
   this.doDetect = getQueryParamValue('detectflash');
}

FlashObject.prototype.addParam = function(name, value) {
   this.params[name] = value;
}

FlashObject.prototype.getParams = function() {
    return this.params;
}

FlashObject.prototype.getParam = function(name) {
    return this.params[name];
}

FlashObject.prototype.addVariable = function(name, value) {
   this.variables[name] = value;
}

FlashObject.prototype.getVariable = function(name) {
    return this.variables[name];
}

FlashObject.prototype.getVariables = function() {
    return this.variables;
}

FlashObject.prototype.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    if (paramTags == "") {
        paramTags = null;
    }
    return paramTags;
}

FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (window.ActiveXObject && navigator.userAgent.indexOf('Mac') == -1) { // PC IE
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '">';
        flashHTML += '<param name="movie" value="' + this.swf + '" />';
        if (this.getParamTags() != null) {
            flashHTML += this.getParamTags();
        }
        if (this.getVariablePairs() != null) {
            flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
        }
        flashHTML += '</object>';
    }
    else { // Everyone else
        flashHTML += '<embed type="application/x-shockwave-flash" src="' + this.swf + '" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '"';
        for (var param in this.getParams()) {
            flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
        }
        if (this.getVariablePairs() != null) {
            flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
        }
        flashHTML += '></embed>';
    }
    return flashHTML;   
}


FlashObject.prototype.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) {
        variablePairs.push(name + "=" + escape(this.getVariable(name)));
    }
    if (variablePairs.length > 0) {
        return variablePairs.join("&");
    }
    else {
        return null;
    }
}

FlashObject.prototype.write = function(elementId) {
   if(detectFlash(this.version) || this.doDetect=='false') {
      if (elementId) {
         document.getElementById(elementId).innerHTML = this.getHTML();
      } else {
         document.write(this.getHTML());
      }
   } else {
      if (this.redirect != "") {
         document.location.replace(this.redirect);
      } else {
         if (elementId) {
            document.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt;
         } else {
            document.write(this.altTxt +""+ this.bypassTxt);
         }
      }
   }       
}

function getFlashVersion() {
   var flashversion = 0;
   if (navigator.plugins && navigator.plugins.length) {
      var x = navigator.plugins["Shockwave Flash"];
      if(x){
         if (x.description) {
            var y = x.description;
               flashversion = y.charAt(y.indexOf('.')-1);
         }
      }
   } else {
      result = false;
       for(var i = 15; i >= 3 && result != true; i--){
            execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
            flashversion = i;
         }
   }
   return flashversion;
}

function detectFlash(ver) {   
   if (getFlashVersion() >= ver) {
      return true;
   } else {
      return false;
   }
}

// get value of querystring param
function getQueryParamValue(param) {
   var q = document.location.search;
   var detectIndex = q.indexOf(param);
   var endIndex = (q.indexOf("&", detectIndex) != -1) ? q.indexOf("&", detectIndex) : q.length;
   if(q.length > 1 && detectIndex != -1) {
      return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
   } else {
      return "";
   }
}

/* add Array.push if needed */
if(Array.prototype.push == null){
   Array.prototype.push = function(item){
      this[this.length] = item;
      return this.length;
   }
}



// weitere funktionen

function owin() {
window.open('images/anfahrt-achern.png','fa','toolbar=no,status=no,location=no,menubar=no,directories=no,width=800,height=600,scrollbars=yes') 
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}



function clrRadio(obj)
{
  if(navigator.appVersion.indexOf("MSIE 3",0)==-1)
  {
    for(i=0;i<obj.length;i++)
      obj[i].checked = false;
  }
}


function moveTo(abschnitt,meldung)
{
  if(navigator.appVersion.indexOf("MSIE 3",0)==-1)
    location.href = "#"+abschnitt;
  alert(meldung);
}

function testNaN(str)
{
  if(navigator.appVersion.indexOf("MSIE 3",0)==-1)
    return isNaN(str);
  else
  {
    for(i=0;i<str.length;i++)
      if(str.charAt(i)<'0' || str.charAt(i)>'9') return true;
    return false;
  }
}

function isEmail(string)
{
  var atloc,dotloc,i,ch;

  if(string.length<6) return false;
  atloc = string.indexOf('@');
  dotloc = string.lastIndexOf('.');
  if(atloc==-1 || dotloc==-1 || atloc>dotloc ||
dotloc==(string.length-1) || (string.length-4)>dotloc) return false;
  if(string.indexOf('@',atloc+1)!=-1) return false;
  for(i=0; i<string.length; i++)
  {
    ch = string.charAt(i);
    if(!((i<dotloc && ch>='0' && ch<='9') || (ch>='A' && ch<='Z') ||
(ch>='a' && ch<='z') || (i<=dotloc && (ch=='.' || ch=='@' || ch=='-' ||
ch=='_' || ch=='+'))))
      return false;
  }
  return true;
}


function forceDate(string)
{
  var i,d,m,y;
  if(string.length != 10) return false;
  for(i=0; i<10; i++)
  {
    if(i==2||i==5)
    {
      if(string.charAt(i)!='.') return false;
    }
    else
    {
      if(string.charAt(i)<'0' || string.charAt(i)>'9') return false;
    }
  }
  d = eval(string.substring(0,2));
  m = eval(string.substring(3,5));
  y = eval(string.substring(6));
  if(d<1||d>31) return false;
  if(m<1||m>12) return false;
  if(y<1850||y>2200) return false;
  return true;
}

function testString(string, check, lang)
{
  if (lang)
    if ((string.length)<lang)
      return false;

  for (i=0; i<string.length; i++)
  {
    if (check.indexOf(string.charAt(i))==-1)
    return false;
  }
  return true;
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,'resizable=1,location=0,directories=0,status=0,menubar=0,scrollbars=0,toolbar=0,width=600,height=450')
}

function TT_Cool(n)
{
    return "<img src=./uploads/images/cool/"+n+">";
}

function TT_Max(n)
{
    return "<img src=./uploads/images/max/"+n+">";
}

function TT_Matrix(n)
{
    return "<img src=./uploads/images/matrix/"+n+">";
}

