var LoggedIn = 0;
var Userwin;
var ConfCookie;
var AllCookies = document.cookie.split("; ");
for (var i=0;i<AllCookies.length;i++) {
	var cpair = AllCookies[i].split("=");
	if (cpair[0] == 'Conf')  ConfCookie = unescape(cpair[1]); 
}
if (ConfCookie) {
	var AllConfSettings = ConfCookie.split("&");
	for (var i=0;i<AllConfSettings.length;i++) {
		var spair = AllConfSettings[i].split(":");
		if (spair[0] == 'Userwin') Userwin = spair[1];
	}
}

var ie=document.all;
var ns6=document.getElementById && !document.all;

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function getmousepos(e) {
	if (document.documentElement && document.documentElement.scrollTop && window.event) {
		curX = window.event.x + document.documentElement.scrollLeft;
		curY = window.event.y + document.documentElement.scrollTop;
	}
	else if(ie) {
		curX = window.event.x + window.document.body.scrollLeft;
		curY = window.event.y + window.document.body.scrollTop;
	}
	else if(ns6) {
		curX = e.pageX;
		curY = e.pageY;
	}
}

function SocialBookmarks() {
	var bml1 = '<a rel="nofollow" target="_blank" href="http://';
	var bml2 = encodeURIComponent(document.title)+'"><img alt="Lesezeichen bei ';
	var bml3 = ' setzen" border=0 vspace=4 src="/pics/bookmarks/';
	var bmlu = encodeURIComponent(location.href);
	
	document.write('<br>Lesezeichen hinzufügen:<br>');
	document.write(bml1+'www.mister-wong.de/index.php?action=addurl&bm_url='+bmlu+'&bm_description='+bml2+'Mr.Wong'+bml3+'wong.gif"></a>');
	document.write(bml1+'del.icio.us/post?url='+bmlu+'&title='+bml2+'del.icio.us'+bml3+'delicious.gif"></a>');
	document.write(bml1+'yigg.de/neu?exturl='+bmlu+'&exttitle='+bml2+'Yigg'+bml3+'yigg.gif"></a>');
	document.write(bml1+'linkarena.com/bookmarks/addlink/?url='+bmlu+'&title='+bml2+'Linkarena'+bml3+'linkarena.gif"></a>');
	document.write(bml1+'www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+bmlu+'&title='+bml2+'Google'+bml3+'google.gif"></a>');
	document.write(bml1+'www.webnews.de/einstellen?url='+bmlu+'&title='+bml2+'Webnews'+bml3+'webnews.gif"></a>');
	document.write(bml1+'www.folkd.com/submit/'+bmlu+'&title='+bml2+'Folkd'+bml3+'folkd.gif"></a>');
	document.write(bml1+'www.wikio.de/vote?domain=www.smsmich.de&title='+bml2+'Wikio'+bml3+'wikio.gif"></a>');
	document.write(bml1+'myweb2.search.yahoo.com/myresults/bookmarklet?u='+bmlu+'&t='+bml2+'Yahoo'+bml3+'yahoo.gif"></a>');
	document.write(bml1+'www.icio.de/add.php?url='+bmlu+'&title='+bml2+'icio'+bml3+'icio.gif"></a>&nbsp;&nbsp;<br>');
}

function vgwort(token) {
	document.write('<div style="display:none;"><img src="http://vg03.met.vgwort.de/na/'+token+'" width="1" height="1" alt="" align="right"></div>');
}

function userthumb(UserID) {
	var ipop = document.getElementById("innerpop");
	if ( ipop == null ) return;
	x_final = curX+30;
	y_final = curY-20;
	ipop.innerHTML = "&nbsp;";
	ipop.style.left = x_final +"px";
	ipop.style.top = y_final +"px";
	ipop.style.height = "38px";
	ipop.style.width = "38px";
	ipop.style.padding = "0px";
	ipop.style.display = "block";
	ipop.style.backgroundImage = 'url(/userpics/list/'+UserID.substr(0,2)+'/'+UserID+'.jpg)';
	ipop.style.backgroundPosition = "center center";
}

function closeuserthumb() {
	var ipop = document.getElementById("innerpop");
	if ( ipop == null ) return;
	ipop.style.display = "none";
	ipop.style.backgroundImage = "none";
}

function OpenInnerpop(divurl,width,height,xoff,yoff) {
	var ipop = document.getElementById("innerpop");
	if ( ipop == null ) return;
	x_final = curX+xoff;
	if (x_final < 1) { x_final = 10; }
	y_final = curY+yoff;
	if (y_final < 100) { y_final = 100; }
	ipop.style.left = x_final +"px";
	ipop.style.top = y_final +"px";
	ipop.style.height = height+"px";
	ipop.style.width = width+"px";
	ipop.style.padding = "0px";
	ipop.style.display = "block";
	ipop.innerHTML = '<iframe width='+width+' height='+height+' frameborder=no scrolling=no border=0 src="' + divurl + '"></iframe>';
	ipop.innerHTML = '<iframe id="innerpopframe" width='+width+' height='+height+' frameborder=no scrolling=no border=0 src=""></iframe>';
	document.getElementById("innerpopframe").src = divurl;
}
function userinfo(UserID, iref) { 
	if (Userwin == "popup") { var win = window.open('/win-userinfo.php?view=' + UserID + '&iref=' + iref,'userinfo','height=550,width=555,scrollbars=yes,resizable=no'); }
	else if (Userwin == "blankpop") { var win = window.open('/win-userinfo.php?view=' + UserID + '&iref=' + iref,UserID,'height=550,width=555,scrollbars=yes,resizable=no'); }
	else { var win = window.open('/user/'+UserID+'.php?iref=' + iref,'_top'); }
}
function gbook(UserID) { 
	if (Userwin == "popup") { var win = window.open('/win-gaestebuch.php?view=' + UserID,'userinfo','height=550,width=555,scrollbars=yes,resizable=no'); }
	else if (Userwin == "blankpop") { var win = window.open('/win-gaestebuch.php?view=' + UserID,UserID,'height=550,width=555,scrollbars=yes,resizable=no'); }
	else { var win = window.open('/user/gaestebuch.php?view=' + UserID,'_top'); }
}
function userfoto(UserID,n)	{ 
	if (Userwin == "popup") { var win = window.open('/win-userfoto.php?viewpic=' + UserID + '&nr=' + n,"userinfo","height=550,width=555,scrollbars=yes,resizable=no"); }
	else if (Userwin == "blankpop") { var win = window.open('/win-userfoto.php?viewpic=' + UserID + '&nr=' + n,UserID,"height=550,width=555,scrollbars=yes,resizable=no"); }
	else { var win = window.open('/user/userfoto.php?viewpic=' + UserID + '&nr=' + n,'_top'); }
}

var closeaktiv;
var dropping;
var vc;
var AllMenues = new Array('userbereich','community','lifestyle','sms','handys','tarife','specials','ghov','sparte','pobo','sets');

function dropdown(DivID,height) {
	var dropobj = document.getElementById('drop_'+DivID);
	if (dropobj == null) return;
	if (dropobj.style.display == "block") return;
	closealldrops();

	var dropY = document.getElementById('bigsizebanner').offsetHeight + 92;

//	// O2-Wallpaper:
//	if (document.getElementById('limx1')) {
//		dropY += document.getElementById('limx1').offsetHeight;
//	}
	if (ie) { dropY += 6; }
	dropobj.style.height = "10px";
	dropobj.style.display = "block";
	dropobj.style.top = dropY+"px";
	curOpened = DivID;
	window.clearInterval(closeaktiv);
	dropping = window.setInterval("dropmovedown('"+DivID+"',"+height+")",3);
}

function dropmovedown(DivID, endheight) {
	curHeight = document.getElementById('drop_'+DivID).style.height;
	curHeight = Math.round(curHeight.substr(0, curHeight.length-2)) +10;
	document.getElementById('drop_'+DivID).style.height = curHeight + "px";
	if (endheight <= curHeight) {
		window.clearInterval(dropping);
		closeaktiv = window.setInterval("closealldrops('"+DivID+"')",800);
	}
}

function closealldrops() {
	if (vc) return false;
	window.clearInterval(dropping);
	window.clearInterval(closeaktiv);
	for (var m = 0; m < AllMenues.length; m++) {
		closeobj = document.getElementById('drop_'+AllMenues[m]);
		if ( closeobj == null ) continue;
		closeobj.style.display = "none";
		closeobj.style.height = "10px";
		closeimg = document.getElementById('navimg_'+AllMenues[m]);
		if ( closeimg == null ) continue;
		closeimg.src = '/pics/nav/navbtn_down.gif';
	}
}

function showTipp(DivID) {
	showDiv(DivID,200,0,10,10);
}

function showDiv(DivID,width,height,xoff,yoff) {
	var divobj = document.getElementById(DivID);
	if (divobj == null) return;
	if (curX == 0) { curX = 300; }
	if (curY == 0) { curY = 200; }
	x_final = curX+xoff;
	if (x_final < 1) { x_final = 10; }
	y_final = curY+yoff;
	if (y_final < 100) { y_final = 100; }

	// damit das Popup nicht rechts aus dem Browser rausläuft:
	if (width + x_final > document.body.clientWidth) {
		x_final = document.body.clientWidth - width - 20;
	}
	
	if (height == 0) { divobj.style.height = "auto"; }
	else {
		// damit das Popup im vertikal sichtbaren Bereich der Seite bleibt und nicht zu weit unten erscheint:
		if (height < document.body.clientHeight && y_final + height > window.document.body.scrollTop + document.body.clientHeight) {
			y_final = window.document.body.scrollTop + document.body.clientHeight - height - 15;
		}
		
		// damit das Popup im vertikal sichtbaren Bereich der Seite bleibt und nicht zu weit oben erscheint:
		if (height < document.body.clientWidth && y_final < window.document.body.scrollTop) {
			y_final = window.document.body.scrollTop + 15;
		}
		divobj.style.height = height+"px";
	}
	if (ie) { divobj.style.filter = "progid:DXImageTransform.Microsoft.Shadow(color=#101010,direction=135, Strength=4)"; }

	divobj.style.left = x_final+"px";
	divobj.style.top = y_final+"px";
	divobj.style.width = width+"px";
	divobj.style.display = "block";
}

function toggleNav(navID, height) {
	var NavImg = document.getElementById('navimg_'+navID);
	var NavDiv = document.getElementById('drop_'+navID);

	if (NavDiv.style.display == "none") { 
		subnavdown(navID,height)
		NavImg.src = "/pics/nav/navbtn_up.gif"; 
	}
	else { 
		NavDiv.style.display = "none"; 
		NavImg.src = "/pics/nav/navbtn_down.gif"; 
	}
}

function subnavdown(DivID,height) {
	var dropobj = document.getElementById('drop_'+DivID);
	if (dropobj == null) return;
	if (dropobj.style.display == "block") return;
	closealldrops();

	var dropY = document.getElementById('bigsizebanner').offsetHeight + 115;
	if (ie) { dropY += 5; }

	dropobj.style.height = "10px";
	dropobj.style.display = "block";
	dropobj.style.top = dropY+"px";
	curOpened = DivID;
	window.clearInterval(closeaktiv);
	dropping = window.setInterval("dropmovedown('"+DivID+"',"+height+")",3);
}



function hideDiv(DivID) {
	var divobj = document.getElementById(DivID);
	if (divobj != null) { divobj.style.display = "none"; }
}

var MsgFileNr = 1;
function AddMsgFile() {
	if (MsgFileNr >= 5) {
		alert('Mehr als 5 Dateien sind leider nicht möglich.');
		return false;
	}
	MsgFileNr++;
	document.getElementById('MsgUploads'+MsgFileNr).style.display = "block";
}

document.onmousemove = getmousepos;
document.onmousedown = closealldrops;

