// copy 2005 rocuments.de


var bV=parseInt(navigator.appVersion);
NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bV>=4)) ? true : false;
DOM=((!document.layers && !document.all && bV>=4)) ? true : false;
capable = (NS4 || IE4 || DOM ) ? true : false;


var expDays = 1;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {

var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : exp;
var path = (argc > 3) ? argv[3] : '/';
var domain = (argc > 4) ? argv[4] : 'www.time-warp.de';
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}


function opensound(url){
var sound = GetCookie('muckefigurensound');
  //alert(sound);
if(sound == null) {
   
soundWin = window.open(url,'soundfenster','width=320,height=20,scrollbars=no,dependent=yes,menubar=no,resizable=no,status=no,toolbar=no');;
if(soundWin && soundWin.closed==true){
SetCookie('muckefigurensound','off',exp,'/',"www.muckefiguren.de");
} else {
SetCookie('muckefigurensound','on',exp,'/',"www.muckefiguren.de");

}
} 
}
function clickopensound(url){
var sound = GetCookie('muckefigurensound');
  //alert(sound);
if(sound == null || sound=='off') {
   
   soundWin = window.open(url,'soundfenster','width=100,height=50,scrollbars=no,dependent=yes,menubar=no,resizable=no,status=no,toolbar=no');;
if(soundWin.closed==true){
SetCookie('muckefigurensound','off',exp,'/',"www.muckefiguren.de");
} else {
SetCookie('muckefigurensound','on',exp,'/',"www.muckefiguren.de");

}
} 
}




var active;
var activeContentScroll;

function startclose(){
     active = window.setTimeout("closeAll()",600);
}

function stopclose(){
     if(active){
		window.clearTimeout(active);
	}
}

function stopContentScrolling(){
    if(activeContentScroll){
		window.clearTimeout(activeContentScroll);
	}
}

function startContentScrolling(direction){
	stopContentScrolling();
	if(direction=='up') activeContentScroll = window.setInterval("contentUp()",5);
	else  activeContentScroll = window.setInterval("contentDown()",5);
}

function contentUp(){
	el="InnerContent";
	il="InnerWeitereBilder";
	if(DOM) {
		whichEl = document.getElementById(el);
		if(whichEl){
			var tops = whichEl.style.top;
			tops = tops.substr(0,tops.lastIndexOf('px'));
			if(tops>=0) tops=0;
			whichEl.style.top = (Number(tops) + 5) +"px";
			
		}

		whichIl = document.getElementById(il);
		if(whichIl){
			var tops = whichIl.style.top;
			tops = tops.substr(0,tops.lastIndexOf('px'));
			if(tops>=0) tops=0;
			whichIl.style.top = (Number(tops) + 5) +"px";
			
		}
		
	} else if (IE4) {
		if(document.all.InnerContent){
			var tops = (document.all.InnerContent.style.top!='') ? document.all.InnerContent.style.top:"0";
			tops = tops.substr(0,tops.lastIndexOf('px'));
			if(tops>=0) tops=0;
			document.all.InnerContent.style.top = (Number(tops) + 5 )+"px";;
		}	
		
		if(document.all.InnerWeitereBilder){
			var tops = (document.all.InnerWeitereBilder.style.top!='') ? document.all.InnerWeitereBilder.style.top:"0";
			tops = tops.substr(0,tops.lastIndexOf('px'));
			if(tops>=0) tops=0;
			document.all.InnerWeitereBilder.style.top = (Number(tops) + 5 )+"px";;
		}
		
	} else if(NS4) {
		whichEl = eval("document." + el);
		if(whichEl){
			var tops = eval("document." + el).top; 
			if(tops>=0) tops=0;
			whichEl.top = parseInt(Number(tops) + 5);
		}
		whichEl = eval("document." + il);
		if(whichEl){
			var tops = eval("document." + el).top; 
			if(tops>=0) tops=0;
			whichEl.top = parseInt(Number(tops) + 5);
		}
	}

	return true;
}

function contentDown(){
	el="InnerContent";
	il="InnerWeitereBilder";
	if(DOM) {
		whichEl = document.getElementById(el);
		if(whichEl) {
			var tops = whichEl.style.top.substr(0,whichEl.style.top.lastIndexOf('px')); 
		
			whichEl.style.top = ((tops) - 5) +"px";
		}
		
		whichEl = document.getElementById(il);
		if(whichEl) {
			var tops = whichEl.style.top.substr(0,whichEl.style.top.lastIndexOf('px')); 
		  	whichEl.style.top = ((tops) - 5) +"px";
		}
		
	} else if (IE4) {
		if(document.all[eval('el')]){
			var tops = (document.all.InnerContent.style.top!='') ? document.all.InnerContent.style.top:"0";
			tops = tops.substr(0,tops.lastIndexOf('px'));
			document.all[eval('el')].style.top = (tops - 5 )+"px";;
		}
		
		if(document.all[eval('il')]){
			var tops = (document.all.InnerWeitereBilder.style.top!='') ? document.all.InnerWeitereBilder.style.top:"0";
			tops = tops.substr(0,tops.lastIndexOf('px'));
			 document.all[eval('il')].style.top = (tops - 5 )+"px";
		}
	} else if(NS4) {
		whichEl = eval("document." + el);
		if(whichEl){
			var tops = eval("document." + el).top;
			tops =tops.substr(0,tops.lastIndexOf('px')); 
		 	whichEl.top = (tops - 5);
			whichEl = eval("document." + il);
		}
		whichEl = eval("document." + il);
		if(whichEl) {
			var tops = eval("document." + il).top;
			tops =tops.substr(0,tops.lastIndexOf('px')); 
			whichEl.top = (tops - 5);
		}
	}
	
	return true;
}

function expandIt(el, id, OffsX, OffsY) {
	if (!capable) return;
	// closeAll();
	var coords;
	var MouseX=0;
	var MouseY=0;
	if (DOM || IE4) {
		coords = {x: 0, y: 0};
		var element = document.getElementById('POSER_'+id);
		while (element) {
			coords.x += element.offsetLeft;
			coords.y += element.offsetTop;
			element = element.offsetParent;
		}
	} else if (NS4) {
		var element = document.links['POSER_'+id];
		coords = {x: element.x, y: element.y};
	} else {
		return false;
	}
	
	if (coords){
		var poserX = coords['x'];
		var poserY = coords['y'];
	}
	MouseX=(poserX+OffsX);
	MouseY=(poserY+OffsY);
	
	if(DOM) {
		whichEl = document.getElementById(el);
		whichEl.style.top = MouseY+"px";
		whichEl.style.left = MouseX+"px";
		whichEl.style.visibility = "visible";
		whichEl.style.display = "block";
	} else if (IE4) {
		document.all[eval('el')].style.top = MouseY+"px";
		document.all[eval('el')].style.left = MouseX+"px";
		document.all[eval('el')].style.display = "block";
		document.all[eval('el')].style.visibility = "visible";
	} else if(NS4) {
		whichEl = eval("document." + el);
		whichEl.top = parseInt(MouseY);
		whichEl.left = parseInt(MouseX);  
		whichEl.visibility = "show";
		whichEl.display = "block";
	} 

}

function closeAll(){
  closeAllByName("child");
  closeAllByName("subchild");
  closeAllByName("DIVBIGPICTURE");
}

function closeAllByName(name){
	stopclose();
	if (NS4) {
		for (i=0; i< document.layers.length; i++) {
			whichEl = document.layers[i];
			if (whichEl.id.toLowerCase().indexOf(name) != -1) {
				whichEl.visibility = "hide";
				whichEl.display = "none";
			}
		}
	} else if(IE4) {
		tempColl = document.all.tags("DIV");
		for (i=0; i< tempColl.length; i++) {
			whichEl = tempColl(i);
			if (whichEl.className == name){
				whichEl.style.display = "none";
				whichEl.style.visibility = "hidden";
			}
		}
	} else if(DOM) {
		tempColl = document.getElementsByTagName("DIV");
		for (i=0; i< tempColl.length; i++) {
			whichEl = tempColl[i];
			if (whichEl.className == name){
				whichEl.style.visibility = "hidden";
				whichEl.style.display = "none";
			}
		}
	}
}

function setPointer(theRow, thePointerColor){
    if(DOM||IE4) theRow.style.backgroundColor = thePointerColor;
    return true;
} 


function changeBigPic(bigsrc,width){
	divel="DIVBIGPICTURE";
	imgimg="IMGBIGPICTURE";
	if(DOM) {
		whichEl = document.getElementById(divel);
		whichImage = document.getElementById(imgimg);
		if(whichImage){
			whichImage.src=bigsrc;
			whichEl.style.width= width + "px";
		}
		whichEl.style.visibility = "visible";
		whichEl.style.display = "block";
		

	} else if (IE4) {
		if(document.all[eval('imgimg')]){
			document.all[eval('imgimg')].src=bigsrc;
			document.all[eval('divel')].style.width = width  + "px";
		}
		document.all[eval('divel')].style.display = "block";
		document.all[eval('divel')].style.visibility = "visible";
	} else if(NS4) {
		window.open(bigsrc,'bigpic');
	}
}

function moveDiv(el,from,to,speed,xy){
	//alert(from);
	if (!capable) return;
	newPOS = from + speed;
//	alert(newPOS);
	if(newPOS>to) newPOS=to;
	if(DOM ) {
		whichEl = document.getElementById(el);
		if(xy=='top') whichEl.style.top = newPOS+"px";
		if(xy=='left') whichEl.style.left = newPOS+"px";
	} else if (IE4) {
		if(xy=='top') document.all[eval('el')].style.top = newPOS+"px";
		if(xy=='left') document.all[eval('el')].style.left = newPOS+"px";
	} else if(NS4) {
		whichEl = eval("document." + el);
		if(xy=='top') whichEl.top = parseInt(newPOS);
		if(xy=='left') whichEl.left = parseInt(newPOS);  
	} 	
	if(newPOS==to) return true;
	else window.setTimeout("moveDiv('"+el+"',"+ newPOS+","+to+","+speed+",'"+xy+"')",20);
}

function MyGetParam(param) {
	var url = String(window.location);
	//alert(url);
	if(window.location.search != "") {
		// Es gibt Parameter
		var undef = url.split("?");
		var args = undef[1].split("&");
		for(i = 0; i < args.length; i++) {
			var a = args[i].split("=");
			if(a[0] == param) {
				return a[1];
			}
		}
	}
	return false;
}
