/* Copyright 2009  */
var sMenu = '0';
top.vID = ""
function menuSel(mSel,ou) {
  return(false);
  if (mSel == '0') {
    if ((sMenu != '0') && (ou == 0)) {
	 		document.getElementById("subM" + sMenu).style.visibility = "hidden";
	  }
  } else {
		if (sMenu != '0') {
		  document.getElementById("subM" + sMenu).style.visibility = "hidden";
		}
		if (mSel != '0') {
		  var selM = "subM" + mSel
		 	document.getElementById(selM).style.visibility = "visible";
		 	//alert(document.getElementById(selM).style.visibility)
    	sMenu = mSel;
    }	
  }
}

function menuHSel(MSel) {
  if (top.menu < 11) {
   swapImage(top.menu,0)
  }
  top.menu = MSel;
  goMenuID(MSel);
  go3img(MSel)
  swapMenu(MSel,1);
}

function swapMenu(MSel) {
 for (i=1;i<7;i++) {
  txtID = 'txt|'+i;
  imgID = 'img|'+i;
  if (document.getElementById(txtID)) {
   document.getElementById(txtID).className = 'txtM1';
   document.getElementById(imgID).src = "./images/hmenu_0.png";
  }
 }
 for (i=7;i<11;i++) {
  txtID = 'txt|'+i;
  imgID = 'img|'+i;
  if (document.getElementById(txtID)) {
   document.getElementById(txtID).className = 'txtM2';
   document.getElementById(imgID).src = "./images/hmenu_0.png";
  }
 }
 
 if (MSel < 7) {
  txtID = 'txt|'+MSel;
  imgID = 'img|'+MSel;
  document.getElementById(txtID).className = 'txtM1o';
  document.getElementById(imgID).src = "./images/hmenu_1.png";
 } else {
  txtID = 'txt|'+MSel;
  imgID = 'img|'+MSel;
  document.getElementById(txtID).className = 'txtM2a';
  document.getElementById(imgID).src = "./images/hmenu_2.png";
 }
}

function menuVSel(MSel) {
  if (top.menu < 11) {
   swapImage(top.menu,0)
  }
  top.menu = MSel;
  goMenuID(MSel);
}

function swapImage(img,nr) {
 imgID = 'img|'+img;
   if (nr == 1) {
      document.getElementById(imgID).src = "./images/hmenu_1.png";
   } else {
      document.getElementById(imgID).src = "./images/hmenu_0.png";
   }
}

function swapImg(img,tal,nr) {
   imgArr = img.split("_");
   var nwimg = './sponsoren/'+imgArr[0]+'_'+imgArr[1];
   if (nr == 0) {
    document.getElementById(tal).src = nwimg+"_1.jpg";
   } else {
    document.getElementById(tal).src = nwimg+"_0.jpg";
   }
}

function getXMLHTTP() {
	var xmlhttp=false;
	try{
		xmlhttp=new XMLHttpRequest();
	}
	catch(e)	{
		try{
			xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e){
			try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e1){
				xmlhttp=false;
			}
		}
	}

	return xmlhttp;
}

function goMenuID(hMenuID) {
  
	var req = getXMLHTTP();

	if (req) {

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {
				  var hSel = req.responseText;
				   var spos = hSel.indexOf("goSubMenuID('");
					 var nwID=hSel.substr(spos+13,5);
					 hSel = nwID;
					 spos = hSel.indexOf("'");
           nwID=hSel.substr(0,spos);
           top.SelConID(nwID);
					document.getElementById('subMenu').innerHTML=req.responseText;
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}
		}
		var strURL = "getSubMenu.php?hMid="+hMenuID;
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function goSubMenuID(sMenuID) {
	var req = getXMLHTTP();

	if (req) {

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {
					document.getElementById('mvCont').innerHTML=req.responseText;
          checkScroll();
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}
		}
		var strURL = "getIDtext.php?Mid="+sMenuID;
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function go3img(sMenuID) {
	var req = getXMLHTTP();

	if (req) {

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {
					document.getElementById('mv3').innerHTML=req.responseText;
          checkScroll();
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}
		}
		var strURL = "get3Foto.php?Mid="+sMenuID;
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function SelConID(nwID) {
  goSubMenuID(nwID);
}

function selPlayer(plID) {

}

function doResize() {

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winH = window.innerHeight;
  winH= winH-275;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winH = document.body.offsetHeight;
  winH= winH-295;
 }
}

   document.getElementById("mvCont").style.height=winH+"px";
} 

defaultStep=1
step=defaultStep
function scrollDivDown(id){
document.getElementById(id).scrollTop+=step
}

function scrollDivUp(id){
document.getElementById(id).scrollTop-=step
}

function  checkScroll(){
  var cH = document.getElementById("mvCont").clientHeight;
  var sH = document.getElementById("mvCont").scrollHeight;
  step = (cH-100)
  /*
  if (cH >= sH) {
   // document.getElementById('divnav').innerHTML="<img src=\"images/Prev_0.gif\"><img src=\"images/Next_0.gif\">"
  } else {
   // document.getElementById('divnav').innerHTML="<a href=\"#null\" onmousedown=\"scrollDivUp('mvCont')\"><img src=\"images/Prev_1.gif\"></a><a href=\"#null\" onmousedown=\"scrollDivDown('mvCont')\"><img src=\"images/Next_1.gif\"></a>"
  }
  */
  document.getElementById('mvCont').scrollTop=0
}
