
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_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];}
}

function setClassName(tis,a) {
tis.className=a;
}

// Newslayer
function changeon(){
		document.getElementById("newsdiv").style.display="block";	
}
function newson(){
	window.setTimeout("changeon()", 5000);
}


/* ################# Galerie ################### */
var currP = 1;
var currI = "x";
function showPage(n) {
 closeImg();
 if (n!=currP) {
 		document.getElementById("tnp"+currP).style.display="none";
 		currP = n; 
 		document.getElementById("tnp"+currP).style.display="block";
	}
	for(var i=1;i<6;i++) {
		if (document.getElementById("gp"+i)) {
			document.getElementById("gp"+i).style.fontWeight="normal"; 
			document.getElementById("gp"+i).style.color="#FFFFFF";
		}
	}
	document.getElementById("gp"+currP).style.fontWeight="bold";
	document.getElementById("gp"+currP).style.color="#b80d34";
}

function showImg(n) {
	if (document.getElementById(n)) {
		//document.getElementById(n).firstChild.title="Bild schließen";
	}
	else {
		var bimgd = document.createElement("div");
		bimgd.id=n;
		//bimgd.style.display="none";
		bimgd.onclick=closeImg;
	
		bimgd.style.cursor="hand";
		bimgd.style.position="absolute";
		bimgd.style.top="0px";
		bimgd.style.left="0px";

		var bimg = document.createElement("img");
		bimg.style.width="326px";
		bimg.style.height="388px";
		//bimg.style.display="block";
		bimg.src="../daten_optiker_meise/pics/"+n;

		bimgd.appendChild(bimg);
		document.getElementById("tnp").appendChild(bimgd);

	}

	document.getElementById(n).style.display="block";
	document.getElementById("sImg").style.display="none";
	document.getElementById("cImg").style.display="block";
	currI=n;

  //if (document.getElementById(n).firstChild.complete) {}

}

function closeImg() {
	if (document.getElementById(currI)) document.getElementById(currI).style.display="none";
	document.getElementById("cImg").style.display="none";
	document.getElementById("sImg").style.display="block";
}

function setOver(tis) {
	setClassName(tis,'off');
	tis.style.cursor="hand";
	tis.firstChild.src = tis.firstChild.src.replace("1.jpg","2.jpg");
}

function setOut(tis) {
	setClassName(tis,'on');
	tis.firstChild.src = tis.firstChild.src.replace("2.jpg","1.jpg");
}

/* ################# Navi ################### */

/* Navigation Aufklappmenüs */
var subact = "mn1";
var tt;
function subon(i) {
	window.clearTimeout(tt);
	suballoff(0);
	if (document.getElementById("mn"+i)) document.getElementById("mn"+i).style.display='block';
}
function suboff() {
	//suballoff();
 tt = window.setTimeout("suballoff(1)",500);
}
function suballoff(j) {
	for(i=1;i<11+1;i++) 
		if (document.getElementById("mn"+i)) document.getElementById("mn"+i).style.display='none';
	//if (j==1 && document.getElementById(subact)) document.getElementById(subact).style.display='block';
}
function hold() {
	window.clearTimeout(tt);
	tt = window.setTimeout("suballoff(1)",2000);
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function cleanWhitespace(elem)
{
  var strClean = "";
  if ( elem.value!="" )
  {

	  var intElemLength = elem.value.length;
	  var intElemLengthLast = elem.value.length - 1;
	  for (i = 0; i < intElemLength; i++)
	  {

		if (elem.value.charAt(i) != ' ')
	    { strClean += elem.value.charAt(i);}
	    else

	    {
	    	if (strClean.length > 0)
	        {

	        	if (elem.value.charAt(i+1) != ' ' && i != intElemLengthLast)
	          	{ strClean += elem.value.charAt(i);}
	        }
		}
	  }
  }

  return strClean;
}
/* Navigation Aufklappmenüs */

/* PopUp zentriert */
// <![CDATA[
function PopUp(w,h,ziel) {
  h = h - 20; var x=0, y=0, parameter="";
  if (w < screen.availWidth || h < screen.availHeight) {
    x = (screen.availWidth - w - 12) / 2;
    y = (screen.availHeight - h - 104) / 2;
    if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
    if (x<0 || y<0) { x=0; y=0; }
    else parameter = "width=" + w + ",height=" + h + ",";
  }
  parameter += "left=" + x + ",top=" + y;
  parameter += ",menubar=yes,location=yes,toolbar=no,status=no";
  parameter += ",resizable=yes,scrollbars=yes";
  var Fenster = window.open(ziel,"PopUp",parameter);
  if (Fenster) Fenster.focus();
  return !Fenster;
}
// ]]>
/* PopUp zentriert */
