
/***********************************************
* Fold-out external menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//var slidemenu_height = '298px' 									//specify height of menu (in pixels throughout)
var slidemenu_height = '335px' 									//specify height of menu (in pixels throughout)
var slidemenu_width = '170px' 									//specify width of menu
var slidemenu_reveal = '30px' 									//specify amount that menu should protrude initially
var slidemenu_top = '-335px'   									//specify vertical offset of menu on page
// URL per PHP
// var slidemenu_url = "/www.media-mirror.de/html/global/galerie_nav.php" 		//specify path to menu file
var follow = 1;																	// true ==> Menü folgt beim Scrollen  || false ==> Menü ist stationär
var menuemitte = 1;															// Menü in der Mitte der Seite?
var topoffset = 17;															// Offset von oben


document.write('<iframe id="slidemenubar" style="left:'+((parseInt(slidemenu_width) - parseInt(slidemenu_reveal)) * -1) + 'px; top:' + slidemenu_top + '; width:' + slidemenu_width + '; height:' + slidemenu_height + '" src="' + slidemenu_url + '" frameborder="no" scrolling="no"></iframe>') ;

var themenu = document.getElementById("slidemenubar").style;
var rightboundary = 0;
var leftboundary = (parseInt(slidemenu_width) - parseInt(slidemenu_reveal)) * -1;

if(follow) window.onload = function() { setInterval('movemenu()', 75); }


var pullit, drawit;
function pull() {
	if(window.drawit) clearInterval(drawit);
	pullit = setInterval("pullengine()", 10);
}

function draw() {
	if(window.pullit) clearInterval(pullit);
	drawit = setInterval("drawengine()", 10);
}

function pullengine() {
	if(parseInt(themenu.left) < rightboundary) {
		themenu.left = parseInt(themenu.left) + 10 + "px";
	}
	else if(window.pullit) {
		themenu.left = 0;
		clearInterval(pullit);
	}
}

function drawengine() {
	if(parseInt(themenu.left) > leftboundary) {
		themenu.left = parseInt(themenu.left) - 10 + "px";
	}
	else if(window.drawit){
		themenu.left = leftboundary;
		clearInterval(drawit);
	}
}

function movemenu(ie) {
	if(follow) {
		var sy;
		var yoffset = topoffset;
		
		var y = parseInt(themenu.top);

		if(typeof document.all == "object") {
			if(menuemitte) yoffset = ((document.body.offsetHeight - parseInt(slidemenu_height)) / 2) + topoffset;
			sy = document.body.scrollTop;

			/*if(!ie) {
				if(menuemitte) yoffset = ((document.getElementById('content').offsetHeight - parseInt(slidemenu_height)) / 2) + topoffset;
				sy = document.getElementById('content').scrollTop;
				sy = -sy;
				window.setTimeout("movemenu(true)", 100);
			}*/
		}
		else {
			if(menuemitte) yoffset = ((document.body.offsetHeight - parseInt(slidemenu_height)) / 2) + topoffset;
			//sy = parseInt(window.pageYOffset);
			sy = 0;
		}
		
		moveyto(((sy - y + yoffset) / 3 + 3) + y);
	}
}

function movexto(x) {
	themenu.left = x + 'px';
}

function moveyto(y) {
	themenu.top = y + 'px';
}