var dr = document.referrer;
dr = dr.substring(dr.indexOf('//')+2);
dr = dr.substring(0,dr.indexOf('/')+1);
if (document.referrer && dr.indexOf('train')<0) {
  if (dr.indexOf('.de/')>0 || dr.indexOf('de.')>0) {
    var host="www.mainframe-training.de";
    document.write ('<BASE HREF="http://www.mainframe-training.de/">\n');
  } else if (dr.indexOf('.be/')>0 || dr.indexOf('be.')>0) {
    var host="www.datatrain.be";
    document.write ('<BASE HREF="http://www.datatrain.be/">\n');
  } else if (dr.indexOf('.nl/')>0 || dr.indexOf('nl.')>0) {
    var host="www.datatrain.nl";
    document.write ('<BASE HREF="http://www.datatrain.nl/">\n');
  }
}
document.write ('<STYLE TYPE="text\/css"><!--\n');
document.write (' UL { margin-left: 12pt }\n');
document.write ('--><\/STYLE>\n');

var loaded		= 0;
var hoofdHeight		= 0;
var scrollTop		= 0;
var topBarHeight	= 20;
var marginLeft		= 10;
var layerLeft		= 0;
var layerTop		= 0;
var layerWidth		= 0;
var currentLayer	= 0;

function changeMenu(changeLayer,hideShow){
    if(loaded == 1){
	if (hideShow != "hidden") {
	    scrollTop			= 0;
	    if (!scrollTop) scrollTop	= window.scrollY;
	    if (!scrollTop) scrollTop	= window.pageYOffset;
	    if (!scrollTop && document.body) scrollTop = document.body.scrollTop;
	}
	hoofdHeight = 0;
	part2Width = 0; // Assume no second part
	// Definitions
	if(document.getElementById){
	    if (self.innerHeight) hoofdHeight = self.innerHeight;
	    if (!hoofdHeight && document.body && document.body.clientHeight)
		 hoofdHeight = document.body.clientHeight;
	    layerName = document.getElementById("subMenu"+changeLayer);
	    part2Name = document.getElementById("subMenu"+changeLayer+"Part2");
	    layerNameTable = document.getElementById("subMenu"+changeLayer+"Table");
	    part2NameTable = document.getElementById("subMenu"+changeLayer+"Part2Table");

	    if (hideShow != "hidden" && layerName) {
		hoofdWidth  = document.getElementById("topBar").offsetWidth;
		layerWidth  = layerName.offsetWidth;
		layerLeft   = document.getElementById("posMenu"+changeLayer).offsetLeft
			    + marginLeft - 4;
		topBarHeight	 = document.getElementById("topBar").offsetHeight;
		if (!topBarHeight)
		    topBarHeight = document.getElementById("topBar").style.pixelHeight;

		layerTop = document.getElementById("topBar").offsetTop
			 + topBarHeight - 1;
		layerHeight = layerName.offsetHeight;
		if (part2Name) {
		    part2Height = part2Name.offsetHeight;
		    part2Width = part2Name.offsetWidth;
		}
	    }
	    // Calculations
	    if (hideShow != "hidden" && layerWidth) {
		if (layerTop < scrollTop) layerTop = scrollTop;
		if (part2Width) part2Left = layerLeft;
		if (layerLeft > hoofdWidth - layerWidth)
		    layerLeft = hoofdWidth - layerWidth + 2;
		if (layerLeft < marginLeft)
		    layerLeft = marginLeft;

		if (part2Width) {
		    if ( layerLeft + layerWidth + part2Width > hoofdWidth
		      && layerLeft - part2Width > 0)
			part2Left = layerLeft - part2Width + 1;
		    else part2Left = layerLeft + layerWidth - 1;
		    part2Top = scrollTop + hoofdHeight - part2Height;
		    // Adjust part2Top for minimum overLap
		    overLap = layerTop - scrollTop + layerHeight + part2Height - hoofdHeight;
		    if (overLap < 72) part2Top -= 72 - overLap;
		    if (part2Height < 72 && layerTop + layerHeight + 14 < hoofdHeight)
			part2Top = layerTop + layerHeight + 15;
		}
	    }
	    // Positioning
	    if (hideShow != "hidden" && layerName) {
		layerName.style.left = layerLeft+"px";
		layerName.style.top = layerTop+"px";
		if (part2Width) {
		    part2Name.style.left = part2Left+"px";
		    part2Name.style.top = part2Top+"px";
		}
	    }
	    if (hideShow != "position" && layerName) {
		layerName.style.visibility = hideShow;
		if (part2Name)
		    part2Name.style.visibility = hideShow;
	    }
	}
    }
}
function p(whichLayer){
	if(whichLayer<1){p(11);p(10);p(9);p(8);p(7);p(6);p(5);p(4);p(3);p(2);if(whichLayer<0)s(-whichLayer)}
	if(whichLayer>0)changeMenu(whichLayer,"position");}
function s(whichLayer){
    if(currentLayer!=whichLayer){
	clearMenu();
	if(whichLayer>0)currentLayer=whichLayer;
	if(whichLayer>0)changeMenu(currentLayer,"visible")}}
function clearMenu(){
    t=80;
    if(currentLayer>0) changeMenu(currentLayer,"hidden");
    if(currentLayer>0) currentLayer=0;}
function telMenu(){
    t++;
    if(t>6 && t<9) clearMenu();
    if(t<12) setTimeout("telMenu()",300);
}
function u(tel){
    if (t>90 && tel==0) {
	t = tel;
    } else if (t<90 && tel==1) {
	t = tel;
    } else if (tel>1 || tel<0) {
	t = tel;
    }
    if (t<6) telMenu();
}
