var menu = 1;
var menutop = 50;
var menuright = 170;
var tabdistvert = 22;
var tabtop = 50;
var Width=80;
var Height=20;
var sound = true;
if (cook == 1){lang = getCookie("language")}

if (lang == 1){var sp = "English"}
else{var sp = "Deutsch"}


if (!document.layers){
	// Choose size and colours here!!!!!!!!!!!!!!!!!!!!!!!!!!
	Font=font;
	FontSize=fontsize - 4;
	AFontColor='#ffffff';
	BFontColor='#ffffff';
	CFontColor='#ffffff';
	FontWeight='normal';  //normal or bold!
	BackGround='#666666'; //Same as your body bgcolor!
	BorderDepth=1;
	//BorderLight='#00ccff';
	BorderLight='#cccccc';
	BorderShad='#000000';
	
	//Nothing needs altering past here!!!!!!!!!!!!!!!!!!!!!!
	function On(id){
		with(id.style){
		color=BFontColor;
		borderTopColor=BorderLight;
		borderLeftColor=BorderLight;
		borderRightColor=BorderShad;
		borderBottomColor=BorderShad;
		}
	}
	function Off(id){
	with(id.style){
		color=AFontColor;
		borderTopColor = '#666666';
		borderLeftColor = '#666666';
		borderRightColor = '#666666';
		borderBottomColor = '#666666';
		}
	}
	function Down(id){
		with(id.style){
		color=CFontColor;
		borderTopColor=BorderShad;
		borderLeftColor=BorderShad;
		borderRightColor=BorderLight;
		borderBottomColor=BorderLight;
	}
	}
	
	
	function Link(Url,Txt,id,top){
		//var topw = top +7;
		document.write("<img style='visibility:hidden;z-index:8;position:absolute;left:10px;top:" + top + "' id='M" + 3 * id.substr(1,3) + "' src='" + root + "pictures/menu/wire_sm.gif' height=18px>"
		+"<input id='" + id +"'"
		+" onClick='" + Url + "'"
		+" style='visibility:hidden;z-index:6;"
		+"width:" + Width + ";height:" + Height + ";"
		+"border-width:"+BorderDepth+"px;"
		+"border-color:"+BackGround+";"
		+"border-style:solid;"
		+"padding:"+ FontSize/4 + "px;"
		+"background:"+BackGround+";"
		+"font-family:"+Font+";"
		+"font-size:"+FontSize+"px;"
		+"line-height:"+FontSize*1.2+"px;"
		+"font-weight:"+FontWeight+";"
		+"text-align:left;"
		+"color:"+AFontColor+";"
		+"cursor:pointer;"
		+"z-index:8;"
		+"position:absolute;top:" + (top - Height/3) + ";left:24px;' "
		+"onMouseOver='javascript:if(On){On(this)}' "
		+"onMouseOut='javascript:if(Off){Off(this)}' "
		+"onMouseDown='javascript:if(Down){Down(this)}' "
		+" value='" + Txt + "'"
		+ " readonly>");
	}
}
function Temp(){
	alert("Under construction yet");
}

function output(uri,fr) {
	window.location.href = uri;
}

document.write ("<div id='hmen' style='z-index:8;position:absolute;top:" + menutop + ";left:0px'>");

document.write("<span style='visibility:hidden;z-index:8;position:absolute;left:10;top:3;font-size:9;color:#FFFFFF;font-family:Verdana' id='M1'></span>"
		+ "<a id='M2' style='visibility:hidden;z-index:8;position:absolute;left:10;top:20' href=javascript:changelang('Deutsch')><img id='flaggede' style='width:25;height:15' src = '"
		+ flaggede
		+ "' border=0></a>"
		+ "<a id='M3' style='visibility:hidden;z-index:8;position:absolute;left:38;top:20' href=javascript:changelang('English')><img id='flaggeuk' style='width:25;height:15' src = '"
		+ flaggeuk
		+ "' border=0></a>"
		+ "<span id='M10' style='visibility:hidden;z-index:8;position:absolute;left:68;top:17'></span>");
		
		

if(site == 'menu'){
	document.getElementById("M10").innerHTML= "<a id='M9' href=javascript:playsound()><img id='soundpic' border=0 src=" + root + "pictures/menu/sound1.gif></a>";
	}
else	{
	document.getElementById("M10").innerHTML = "<a href=javascript:changelang(document.getElementById('M10').innerHTML) style='text-decoration:none;font-size:9;font-family:Verdana;color:#FFFFFF'>"
	//document.getElementById("M10").innerHTML = "<a href=javascript:changelang(lang) style='text-decoration:none;font-size:9;font-family:Verdana;color:#FFFFFF'>"
	+ sp + "</a>";
	document.getElementById("M10").style.top = 22;
	}		

var dummy = Math.random();


Link('javascript:output("' + root + 'index.html","_self")','Home','M12',tabtop);
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'surround.html","_self")','Surroundings','M13', tabtop);
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'linksites/franzi.html","_self")','Daughter','M14',tabtop);
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'occupants.html","_self")','Occupants','M15',tabtop);
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'cgi-bin/profession/profession.pl","_self")','Profession','M16',tabtop);
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'hobbies.html","_self")','Hobby','M17',tabtop);
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'joke.html","_self")','Jokes','M18',tabtop);
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'cgi-bin/weather/wetter.pl","_self")','Weather','M19',tabtop);
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'cgi-bin/mail/simplemail.pl","_self")','Mail','M20',tabtop);
tabtop = tabtop + tabdistvert;
if (lang == 0){Link('javascript:output("' + root + 'cgi-bin/guestbook/guestbook.cgi?lang=English","_self")','Guestbook','M21',tabtop);}
else {Link('javascript:output("' + root + 'cgi-bin/guestbook/guestbook.cgi?lang=Deutsch","_self")','Guestbook','M21',tabtop);}
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'shoutbox/shoutbox.html")','Chat','M22',tabtop);
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'cgi-bin/wiki/wiki.pl")','MiniWIKI','M23',tabtop);
//Link('javascript:output("' + root + 'linksites/mess/mess.php?' + dummy + '","_self")','I-Speed','M24',tabtop)
//Link('javascript:output("' + root + 'linksites/mess/messn.php","_self")','I-Speed','M24',tabtop
tabtop = tabtop + tabdistvert;
Link('javascript:output("' + root + 'cgi-bin/speed/speed.pl","_self")','I-Speed','M24',tabtop)
tabtop = tabtop + tabdistvert;

document.write ("<a id='M90' style='z-index:8;visibility:hidden;position:absolute;top:" + tabtop + ";left:24px;text-decoration:none; font-size:" + (fontsize - 4) + "; font-style: italic;"
		+ " color: " + fontcolor + "; font-family: " + font + ";' href=javascript:output('" + root + "personality.html','_self') "
		+ ">&copy&#160Oldman4</a>");
tabtop = tabtop + tabdistvert;
document.write("<img id='M99' style='visibility:hidden;z-index:6;position:absolute;left:0px;top:0px;width:" + (Width * 1.5) + ";height:" + tabtop + "' src='" + root + "pictures/menu/bullet_2.gif'></div>");

document.write("<span id='men' onmouseover=showmenu(1)></span>");

var en = new Array('Home','Surroundings','Daughter','Occupants','Profession','Hobby','Jokes','Weather','Mail','Guestbook','Minichat','MiniWIKI','Ispeed');
var ge = new Array('Startseite','Umgebung','Tochter','Mitbewohner','Beruf','Hobby','Spaß','Wetter','Kontakt','Gästebuch','Minichat','MiniWIKI','I-Speed');

function changelang(sp){
	
	if (sp.indexOf("Deutsch") >= 0){
		lang = 1;
		document.getElementById("M1").innerHTML = "Choise&#160language";
		document.getElementById("M2").style.cursor = "default";
		document.getElementById("M3").style.cursor = "pointer";
		document.getElementById("flaggede").src = flaggede_matt;
		document.getElementById("flaggeuk").src = flaggeuk;
		
		if(site != 'menu'){document.getElementById("M10").innerHTML = document.getElementById("M10").innerHTML.replace(/Deutsch/,"English")}
		document.getElementById("men").innerHTML = "<img id='smen' style='z-index:4;position:absolute;top:" +  (menutop + tabtop/4) + ";left:0' src='" + root + "pictures/menu/bullet_3_ge.gif' width='20px'>";
		
		}
	else {
		lang = 0;
		document.getElementById("M1").innerHTML = "Sprachwahl";
		document.getElementById("M2").style.cursor = "pointer";
		document.getElementById("M3").style.cursor = "default";
		document.getElementById("flaggeuk").src = flaggeuk_matt;
		document.getElementById("flaggede").src = flaggede;
		
		if(site != 'menu'){document.getElementById("M10").innerHTML = document.getElementById("M10").innerHTML.replace(/English/,"Deutsch")}
		document.getElementById("men").innerHTML = "<img id='smen' style='z-index:4;position:absolute;top:" + (menutop + tabtop/4)  + ";left:0' src='" + root + "pictures/menu/bullet_3_en.gif' width='20px'>";
		}
	for(k=12;k <= (en.length +11) ;k++){
		if (document.getElementById("M" + k + "") && lang==1){
			document.getElementById("M" + k + "").value = ge[k - 12];
			}
		if (document.getElementById("M" + k + "") && lang==0){
			 	document.getElementById("M" + k + "").value = en[k - 12]
			 	}

	}
	
	if (cook == 1 && getCookie("language") != lang){
		if (site == "minichat"){
			chlang(lang);
		}
		else if (site == "wiki"){
			chlang();
			chlangfooter();
		}
		else if (site == "speed"){
			chlang();
			
		}
		else if (site == "mailto"){
			chlang();
		}
		else if (site == "profession"){
			chlang();
		}
		else if (site == "guestbook"){
			if (lang == 0){window.location.href= root + "cgi-bin/guestbook/guestbook.cgi?lang=English"}
			else {window.location.href= root + "cgi-bin/guestbook/guestbook.cgi?lang=Deutsch"}
			//posmenu();
			}
		else {window.location.reload()}
		}
		
	if (cook == 1){setCookie("language", lang,null,"/")}
	
}



if (lang == 0 ){changelang('English')}
else {changelang('Deutsch')}
var i = 0;
function posmenu(){
	//alert(i);
	if (i <  document.body.scrollTop + menutop - 4){
		
		setTimeout("posmenu()",10);
		i+=4;
		document.getElementById('hmen').style.top = i;
		document.getElementById('smen').style.top = i + (menutop + tabtop/4);
		}
	if (i >  document.body.scrollTop + menutop + 4){
		setTimeout("posmenu()",10);
		document.getElementById('hmen').style.top = i;
		document.getElementById('smen').style.top = i + (menutop + tabtop/4);
		i-=4;
		}
	if (site == "wiki"){
		//wikimenupos()
		document.getElementById('menuall').style.top = document.body.scrollTop;
		}
	
}

window.onscroll = posmenu;

var tempX = 0;
var tempY = 0;
var topalt;


function showmenu(show){
	

if (show == 0){
	menu = 0;
	for (var n = 1; n <= 99; n++){
		if (document.getElementById("M" + n + "")){
			document.getElementById("M" + n + "").style.visibility = "hidden";
			}
		}
	}
if (show == 1){
	menu = 1;
	for (var n = 1; n <= 99; n++){
		if (document.getElementById("M" + n + "")){
			document.getElementById("M" + n + "").style.visibility = "visible";
			}
		}
	}
}
function replaceit(QuellText, SuchText, ErsatzText)
        {
            // Fehlerpruefung
            if ((QuellText == null) || (SuchText == null))           { return null; }
            if ((QuellText.length == 0) || (SuchText.length == 0))   { return QuellText; }

            // Kein ErsatzText ?
            if ((ErsatzText == null) || (ErsatzText.length == 0))    { ErsatzText = ""; }

            var LaengeSuchText = SuchText.length;
            var LaengeErsatzText = ErsatzText.length;
            var Pos = QuellText.indexOf(SuchText, 0);

            while (Pos >= 0)
            {
                QuellText = QuellText.substring(0, Pos) + ErsatzText + QuellText.substring(Pos + LaengeSuchText);
                Pos = QuellText.indexOf(SuchText, Pos + LaengeErsatzText);
            }
            return QuellText;
        }


document.write("<div id=divglobe>");
if(document.getElementById('divglobe') && location.href.search(/index/) == -1){
	with (document.getElementById('divglobe').style){
		position = 'absolute';
		top = bordertop;
		left = borderleft;
		zIndex = 5;
	}
}


function getMouseXY(e) {
	if (typeof(menuright)=="undefined"){return}

	
		if (document.all) { // grab the x-y pos.s if browser is IE
			tempX = event.clientX + document.body.scrollLeft;
			tempY = event.clientY + document.body.scrollTop;
		}
		else {  // grab the x-y pos.s if browser is NS
			tempX = e.screenX;
			tempY = e.screenY;
		}  
		if (tempX < 0){tempX = 0;}
		if (tempY < 0){tempY = 0;}
		
		if (tempX > menuright && menu == 1){
			menu = 0;
			showmenu(0);
			}
		return true;
	
}
function playsound() {
	if(document.getElementById("S5")){
		if(sound == true){
			document.getElementById("S5").innerHTML = "";
			sound = false;
			document.getElementById("soundpic").src = root + "pictures/menu/sound2.gif"
		}
		else {
			document.getElementById("S5").innerHTML = snd;
			sound = true;
			document.getElementById("soundpic").src = root + "pictures/menu/sound1.gif"
				}
	}
}
document.onmousemove = getMouseXY;
//showmenu(1);
