//
// Browser Detection
//
var ns = navigator.appName == "Netscape";
var ns5 = (ns && parseInt(navigator.appVersion) > 4);
var ie  = 0;
var ns4 = 0;
var dom = 1;
var ie4 = 0;
var ie5 = 0;
var ope = 0;
var moz = 0;
var bok = 1;
var initdone = false;
var xcenter = 0;

  ie  = (document.all)?true:false;
  ns4 = (document.layers)?true:false;
  dom = (document.getElementById)?true:false;
  ie4 = (document.all && !dom)?true:false;
  ie5 = (dom && navigator.userAgent.indexOf('MSIE 5')>0);
  ope = (dom && navigator.userAgent.indexOf('Opera')>0);
  moz = (dom && navigator.userAgent.indexOf('Gecko')>0);
  bok = ns4 || ie4 || dom;

var fotofenster =null;


var menuimage0 = new Image();
var menuimage1 = new Image();
var menuimage2 = new Image();
var menuimage3 = new Image();
var menuimage4 = new Image();
var menuimage5 = new Image();
var menuimage6 = new Image();
var menuimage7 = new Image();

menuimage0.src = "menu0.gif";
menuimage1.src = "menu1.gif";
menuimage2.src = "menu2.gif";
menuimage3.src = "menu3.gif";
menuimage4.src = "menu4.gif";
menuimage5.src = "menu5.gif";
menuimage6.src = "menu6.gif";



function an(menu_id)
{
   name="menuimage";
   window.document.images[name].src = eval("menuimage"+menu_id).src;
}

function aus(menu_id)
{
//   menu_id=1;
   name = "im"+menu_id;
   name = "menuimage";
   window.document.images[name].src = eval("menuimage"+menu_id).src;
}



function getxpos()
{
  x1=0;
  var ppic=getobj("lo");

  if (ns4) {
    x1 = document.lo.pageX;

  } else {
    for (obj = ppic, x1=0;  obj.tagName != 'BODY'; obj = obj.offsetParent){
      x1 += obj.offsetLeft;
    };
  };

  return x1
}

function getypos()
{
  y1=0;
  var ppic=getobj("lo");

  if (ns4) {
    y1 = document.lo.pageY;
  } else {
    for (obj = ppic, y1=0;  obj.tagName != 'BODY'; obj = obj.offsetParent){
      y1 += obj.offsetTop;
    };
  };

  return y1
}


// WindowAttributes() creates universal accessible window attribute objects
function WindowAttributes() {
	if (ns == false) {
		this.width = document.body.clientWidth;
		this.height	= document.body.clientHeight;
		}
	else  {
		this.width = window.innerWidth
		this.height = window.innerHeight
		}
	}

function reloadPage(init) {
  if (init==true) onresize=reloadPage;
  else location.reload();
}
reloadPage(true);


// Get object by ID
function getobj(hname) {
  if (ns4) return eval("document."+hname);
  else if (ie4) return document.all[hname]
  else if (dom) return document.getElementById(hname);
};



// Make an object visible
function showObj(obj) {
  if (ns4) obj.visibility = "show"
  else obj.style.visibility = "visible";
};

// Hide an object
function hideObj(obj) {
  if (ns4) obj.visibility = "hide"

  else obj.style.visibility = "hidden";
};

// Move an object X
function moveObjX(obj,x) {
  if (ns4)
  {
    obj.left = x;
  } else
  {
    obj.style.left = x;
  };
};

function moveObjY(obj,y) {
  if (ns4)
  {
    obj.top = y;
  } else
  {
    obj.style.top = y;
  };
};


function istleer(s)
{
  for (var i = 0; i < s.length; i++)
  {
    var c = s.charAt(i);
    if ((c != ' ') && (c != '\\n') && ( c!= '\t')) return false;
  }
  return true;
}


function istzahl(s)
{
  if ((s==null) || (s=='') || istleer(s)) return false;
  var v=parseInt(s,10);
  if (isNaN(v)) return false;
  return true;
}








function setpos()
{
  x=getxpos();
//  x=100;
  obj=getobj("keys");
  hideObj(obj);
  moveObjX(obj,x);
  showObj(obj);
}

//--------------------------------------------------------------------
// Zeigt ein neues Fenster für Fotos an

function show_window(name,title,x,y)
{
 par ='width='+x+',height='+y+', menubar=no,resizable=no,statusbar=no,scrollbars=no;';

 if (fotofenster != null)
 {
   if (fotofenster.closed==false) { fotofenster.close()}
 }

 fotofenster=window.open('','foto',par);
 fotofenster.focus();

 fotofenster.document.writeln('<html>');
 fotofenster.document.writeln('<head>');
 fotofenster.document.writeln('<title>'+title+'</title>');

 fotofenster.document.writeln('</head>');
 fotofenster.document.writeln('<body style="margin:0px 0px 0px 0px" MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" TOPMARGIN="0" bgcolor = "#000000"><center>');
// h.document.writeln('<body style="margin:0px 0px 0px 0px" MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" TOPMARGIN="0" onload="window.resizeTo('+x+','+y+')">');

 s ='<a href="#" onClick="self.close();"><img src = "'+name+'" border="0" alt = "Anklicken zum Schliessen"></a>';
 fotofenster.document.writeln(s);
 fotofenster.document.writeln('</body>');
 fotofenster.document.writeln('</html>');
// h.resizeTo(x,y);

 fotofenster.document.close();
 fotofenster.focus();

}
//--------------------------------------------
function menu_color(obj, color)
{
  obj.style.backgroundColor=color;
}

//--------------------------------------------
function popupwindow()
{
  var h = new Array();
  h=getSize();

  var x=(h[0]-500)/2;
  var y=(h[1]-180)/2;


  var obj = getobj("popup");
  if (obj != null)
  {
    moveObjX(obj,x);
    moveObjY(obj,y);

    showObj(obj);

  }
}

function closepopup()
{

  var obj = getobj("popup");
  if (obj != null) {hideObj(obj);}
}

function play()
{
  document.sound.play();
}

function getSize() {
	var myWidth = 0, myHeight = 0;

	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [ myWidth, myHeight ];
}


