  
/* Copyright 2010  */
var sVal = 50;
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 menuHSel(MSel) {
  top.menu = MSel;
  //swapMenu(MSel,1);
  goMenuID(MSel);
  //swapBanner(MSel);
}

function menuVSel(VMSel) {
  //swapVMenu(VMSel,1);
  //alert(VMSel)
  goVMenuID(VMSel);
}

function mRightSel(RSel) {
  goRightSel(RSel);
}

function goRightSel(RSel) {
	var req = getXMLHTTP();

	if (req) {

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {
          var tmpTXT = req.responseText;
					document.getElementById('rightReg').innerHTML=tmpTXT;
					setTimeout("setMVheight(20)", 100);
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}
		}
		var strURL = "getIDtext.php?Mid="+RSel;
		req.open("POST", strURL, true);
    req.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
		req.send(null);
	}
}
function mRightSpkr(spSel) {
  goRightSpkr(spSel);
}

function goRightSpkr(spSel) {
	var req = getXMLHTTP();

	if (req) {

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {
          var tmpTXT = req.responseText;
					document.getElementById('rightSpkr').innerHTML=tmpTXT;
          setTimeout("setMVheight(20)", 100);
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}
		}
		var strURL = "getIDtext.php?Mid="+spSel;
		req.open("POST", strURL, true);
    req.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
		req.send(null);
	}
}

function swapMenu(MSel) {
 for (i=1;i<11;i++) {
  txtID = 'txt|'+i;
  imgID = 'img|'+i;
  if (document.getElementById(txtID)) {
   document.getElementById(txtID).className = 'txtM1';
  }
 }
 txtID = 'txt|'+MSel;
 imgID = 'img|'+MSel;
 document.getElementById(txtID).className = 'txtM1o';
}

function swapVMenu(VMsel) {
  i = top.Vmenu;
  if (i > 0) {
  	txtID = 'txtV|'+i;
  	imgID = 'imgV|'+i;
  	if (document.getElementById(txtID)) {
   		document.getElementById(txtID).className = 'txtM2';
  	}
  }
 txtID = 'txtV|'+VMsel;
 imgID = 'imgV|'+VMsel;
 document.getElementById(txtID).className = 'txtM2o';
}

function swapBanner(MSel) {
 if (MSel == 1) {
 	varBan = (Math.round((Math.random()*6)));
 	banImg = '<img src="./images_hls/foto_head_'+MSel+'_'+varBan+'.jpg">';
 } else {
   	banImg = '<img src="./images_hls/foto_head_'+MSel+'.jpg">';
 }
// document.getElementById('mvBanner').innerHTML = banImg;
}
  
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('menuHor').innerHTML=req.responseText;
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}
		}
		var strURL = "getSubMenu.php?hMid="+hMenuID;
		req.open('POST', strURL, true);
    req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    req.send(null);

		//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) {
          var tmpTXT = req.responseText;
					document.getElementById('left').innerHTML=tmpTXT;
					setTimeout("setMVheight(20)", 100);
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}
		}
		var strURL = "getIDtext.php?Mid="+sMenuID;
		req.open("POST", strURL, true);
    req.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
    var encoded = "";
    encoded = "test"
    //alert(req.open("GET", strURL, true))
		req.send(encoded);
	}
}

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


function setH()
{
setMVheight()
}

function setMVheight(tVal){	
obj1=document.getElementById('chkCont');
obj2=document.getElementById('right');
obj3=document.getElementById('rightbody');
obj4=document.getElementById('righttext');
tmp4 = 720;
H=Math.max(obj1.offsetHeight,tmp4);
window.status=H+"|"+obj1.offsetHeight+"|"+tmp4;
obj1.style.height=H+'px';
obj2.style.height=H+'px';
obj3.style.height=(H-15)+'px';
if (document.getElementById("chkCont")) {
obj1=document.getElementById('divRow');
obj2=document.getElementById('righttext');
obj3=document.getElementById('left');
if (obj2.offsetHeight > obj1.offsetHeight) {
 mRightSel(91);
}
if (obj3.offsetHeight > obj1.offsetHeight) {
 setTimeout("setMVheight(20)", 10);
}
  
} else {
 setTimeout("setMVheight(20)", 100);
}
}  

function GotoPage(Hnr) {
  menuHSel(Hnr)
}

function goStart() {
  location.href="http://www.innomate.nl";
}

function spreker(Snr) {
  goSubMenuID(Snr)
}


function goLogin(form) {
  var TestEm = form.naam.value;
  var TestWW = form.wacht.value;
  
  var req = getXMLHTTP();

	if (req) {
    req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {
          var tmpTXT = req.responseText;
          var tstTXT = tmpTXT;
          tstTXT = tstTXT.replace('\n', '', 'g');
          //alert(">"+tstTXT+"<"+(tstTXT == 'menu80 '))
          if (tstTXT == 'menu80 ') {
            goSubMenuID(80);
            setTimeout("setMVheight(20)", 100);
          } else {
            document.getElementById('left').innerHTML=tmpTXT;
          }  
					//setTimeout("setMVheight(20)", 100);
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}
		}
		var strURL = "getlogin.php?naam="+TestEm+"&wacht="+TestWW;
		req.open("POST", strURL, true);
    req.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
    var encoded = "";
    encoded = "test"
		req.send(encoded);
  }
}

function goSubPage(pnr) {
  goSubMenuID(90)
}
