//Fuer diverse Scripte
var win = navigator.userAgent.indexOf("Win") > -1;
var mac = navigator.userAgent.indexOf("Mac") > -1;
var ie_version=0;
var ns_version=0;
var op_version=0;

// Welche BROWSER Version
if(parseInt(navigator.appVersion)>= 5 && navigator.appName == "Netscape")
{ns_version = 6;}
if(parseInt(navigator.appVersion)== 4 && navigator.appName == "Netscape")
{ns_version = 4;}
if(parseInt(navigator.appVersion)== 4 && navigator.appName == "Microsoft Internet Explorer")
{ie_version = 4;}
if(parseInt(navigator.appVersion)>= 5 && navigator.appName == "Opera")
{op_version = 5;}


// Je nach Browser wird der Layer unterschiedlich angesprochen
function get_element(name)
{
if(ie_version > 4 || ns_version > 4){return eval('document.getElementById(name).style');} 
  else if(ns_version == 4){return eval('document.layers["'+name+'"]');} 
    else if(ie_version == 4){return eval('document.all["'+name+'"].style');}
}

function pos_layers_detail1frame()
{
  // Welche innere Bildschirmgroesse
  if(ie_version > 0)
  {
    max_height=document.body.offsetHeight;
    max_width=document.body.offsetWidth;
    scrolly=document.body.scrollTop;	
    scrollx=document.body.scrollLop;	

  } 
  if(ns_version > 0)
  {
    max_height=window.innerHeight;
    max_width=window.innerWidth;
    scrolly=window.pageYOffset;	
    scrollx=window.pageXOffset;	
  }
  
  // Layerpositionierung
  get_element('layer_leiste').top=scrolly;
  
  get_element('layer_inhalt').top=25;
  get_element('layer_inhalt').height=max_height-27;
  
}

function changeSheets(whichSheet){
  whichSheet=whichSheet-1;
  if(document.styleSheets){
    var c = document.styleSheets.length;
    if (doAlerts) alert('Change to Style '+(whichSheet+1));
    for(var i=0;i<c;i++){
      if(i!=whichSheet){
        document.styleSheets[i].disabled=true;
      }else{
        document.styleSheets[i].disabled=false;
      }
    }
  }
}

// Relative Position der Layers
function pos_layers()
{

  // Welche innere Bildschirmgroesse
  if(ie_version > 0)
  {
    max_height=document.body.offsetHeight;
    max_width=document.body.offsetWidth-20;
  } 
  if(ns_version > 0)
  {
    max_height=window.innerHeight;
    max_width=window.innerWidth;
  }

}

// Relative Position der Layers
function pos_layers_newsticker()
{

  // Welche innere Bildschirmgroesse
  if(ie_version > 0)
  {
    max_height=document.body.offsetHeight;
    max_width=document.body.offsetWidth-20;
  } 
  if(ns_version > 0)
  {
    max_height=window.innerHeight;
    max_width=window.innerWidth;
  }
  // Layerpositionierung

  get_element("news_layer").visibility="hidden";
  get_element("news_layer").top=300;
  get_element("news_layer").left=(max_width/2)-160;
  get_element("news_layer").visibility="visible";
  
}

// Fenster oeffnen
function fenster(url,fenstername,fenstereinstellungen)
{
  win=window.open('',fenstername, fenstereinstellungen);
  if (win!=null)
  {
     if(win.opener==null)
        win.opener=self;
     win.location.href=url;
  }
  win.focus();
}


// Dynamisch Flash einfügen
function FlashMovie(src, movie, width, height, version, quality, menu, bgcolor, flashvars)
{
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+version+",0,0,0' width='" +width+ "' height='" +height+ "' id='" +movie+ "'>");
	document.write("<param name='movie' value='" +src+ "' />");
	document.write("<param name='FlashVars' value='" +flashvars+ "'>");
	document.write("<param name='quality' value='" +quality+ "' />");
	document.write("<param name='scale' value='noscale' />");
	document.write("<param name='wmode' value='transparent' />");	
	document.write("<param name='salign' value='m' />");
	document.write("<param name='menu' value='" +menu+ "' />");
	document.write("<param name='bgcolor' value='" +bgcolor+ "' />");
	document.write("<embed src='" +src+ "' swLiveConnect='true' menu='" +menu+ "' FlashVars='" +flashvars+ "' quality='" +quality+ "' bgcolor='" +bgcolor+ "' width='" +width+ "' height='" +height+ "' name='" +movie+ "' wmode='transparent' scale='noscale' salign='m' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}



//MM Scripte
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.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 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_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_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];}
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  var meldung=args[args.length-1];
  for (i=0; i<(args.length-3); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert(meldung);
  document.MM_returnValue = (errors == '');
}


