// -----------------------------------------------------------------------------------
// Rollover Funktionen
// -----------------------------------------------------------------------------------

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// -----------------------------------------------------------------------------------
// Suche auf jeder Seite
// -----------------------------------------------------------------------------------

function topsearch(searchtype,searchvalue){
	createCookie('topseachformtype',searchtype,365);

	if(searchtype == "yahoo"){
		url = "http://de.yhs.search.yahoo.com/yhs/search?ei=UTF-8&fr=yhs-goolive&partnerid=yhs-goolive&lyt=st&p="+searchvalue;
		window.open(url);
		return false;
	}
	else if(searchtype == "nickname"){
		url = "/index.php?ext=user_showvcard&username="+searchvalue;
		top.location.href = url;
		return false;
	}
	else if(searchtype == "userid"){
		url = "/index.php?ext=user_showvcard&user_id="+searchvalue;
		top.location.href = url;
		return false;
	}
	else if(searchtype == "people"){
		url = "/index.php?ext=usersuche&action=results&searchstr=yahoosearch,"+searchvalue;
		top.location.href = url;
		return false;
	}
	else if(searchtype == "forum"){
		url = "/index.php?ext=forum&action=searchresults&searchstr=keywords,"+searchvalue+"|searchoptions,1|searchtype,3&s=1";
		top.location.href = url;
		return false;
	}
}

// -----------------------------------------------------------------------------------
// Anhand des Cookies Such Drop Down setzen
// -----------------------------------------------------------------------------------

function setTopSearchSelected(){
	topseachformtype = readCookie('topseachformtype');
	if(topseachformtype != null){
		selectDropdown($('topsearchform').searchtype,topseachformtype);
	}
}

// -----------------------------------------------------------------------------------
// Schatten anzeigen
// -----------------------------------------------------------------------------------

function showShadow(frontObj){
	//container initialisieren
	var container = new Element('div');
	
	container.setProperty('id','gooShadow');
	//Container stylen
	container.setStyles({
			'position' : 'absolute',
			'left' : 0,
			'top' : 0,
			'width' : window.getScrollWidth(),
			'height' : window.getScrollHeight(),
			'z-index' : frontObj.getStyle('z-index').toInt()-1,
			'opacity' : 0.5,
			'background-color' : '#000'
	});
	container.injectInside(document.body);
}

function hideShadow(){$('gooShadow').remove();}

// -----------------------------------------------------------------------------------
// String UTF8 kodieren
// -----------------------------------------------------------------------------------

function utf8_encode(rohtext) {
	// dient der Normalisierung des Zeilenumbruchs
	rohtext = rohtext.replace(/\r\n/g,"\n");
	var utftext = "";
	for(var n=0; n<rohtext.length; n++)
	{
		// ermitteln des Unicodes des  aktuellen Zeichens
		if(rohtext.charAt(n) == "\xdfx"){
			utftext += '%C3%9F';
			continue;
		}

		var c=rohtext.charCodeAt(n);
		// alle Zeichen von 0-127 => 1byte
		if (c<128)
		utftext += String.fromCharCode(c);
		// alle Zeichen von 127 bis 2047 => 2byte
		else if((c>127) && (c<2048)) {
			utftext += String.fromCharCode((c>>6)|192);
			utftext += String.fromCharCode((c&63)|128);}
			// alle Zeichen von 2048 bis 66536 => 3byte
			else {
				utftext += String.fromCharCode((c>>12)|224);
				utftext += String.fromCharCode(((c>>6)&63)|128);
				utftext += String.fromCharCode((c&63)|128);
			}
	}
	return utftext;
}

function utf8_decode(utftext) {
	var plaintext = ""; var i=0; var c=c1=c2=0;
	// while-Schleife, weil einige Zeichen uebersprungen werden
	while(i<utftext.length)
	{
		c = utftext.charCodeAt(i);
		if (c<128) {
			plaintext += String.fromCharCode(c);
			i++;
		}
		else if((c>191) && (c<224)) {
			c2 = utftext.charCodeAt(i+1);
			plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
			i+=2;
		}
		else {
			c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
			plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
			i+=3;
		}
	}
	return plaintext;
}


// -----------------------------------------------------------------------------------
// Cookie Funktionen
// -----------------------------------------------------------------------------------

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

// -----------------------------------------------------------------------------------
// Formular Hilfsfunktionen
// -----------------------------------------------------------------------------------

// Ein Wert in einem Select Menü markieren
function selectDropdown(dropdown,selectedValue){
	
	for (i = 0; i < dropdown.length; ++i){
		if (dropdown.options[i].value == selectedValue){
			dropdown.options[i].selected = true;
		}else{
			dropdown.options[i].selected = false;
		}
	}

}

// -----------------------------------------------------------------------------------
// Positionen und Positionierung
// -----------------------------------------------------------------------------------

function getElementx(obj){
	var lPos = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			lPos += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
	lPos += obj.x;
	return lPos;
}
function getElementy(obj){
	var oPos = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			oPos += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
	oPos += obj.y;
	return oPos;
}

document.onmousemove = mouse_pos;

function mouse_pos(evt) {
	if(!evt) evt = window.event;
	var pos = new Object();
	pos.left = evt.clientX;
	pos.top = evt.clientY;
	var b = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ?
	window.document.documentElement : window.document.body || null;
	if (b)
	{
		pos.scrollLeft= pos.left + b.scrollLeft;
		pos.scrollTop = pos.top + b.scrollTop;
	}
	else if(document.layers)
	{
		// Netscape 4.
		pos.scrollLeft = evt.pageX;
		pos.scrollTop = evt.pageY;
		pos.left = evt.pageX - window.pageXOffset;
		pos.top = evt.pageY - window.pageYOffset;
	}
	xmouse = pos.left;
	ymouse = pos.top;
}

// -----------------------------------------------------------------------------------
// Browserversion
// -----------------------------------------------------------------------------------

var useragent = navigator.userAgent;
var bName = (useragent.indexOf('Opera') > -1) ? 'Opera' : navigator.appName;
var pos = useragent.indexOf('MSIE');
if (pos > -1)
{
	bVer = useragent.substring(pos + 5);
	var pos = bVer.indexOf(';');
	var bVer = bVer.substring(0,pos);
}
var pos = useragent.indexOf('Opera');
if (pos > -1)
{
	bVer = useragent.substring(pos + 6);
	var pos = bVer.indexOf(' ');
	var bVer = bVer.substring(0, pos);
}
if (bName == "Netscape")
{
	var bVer = useragent.substring(8);
	var pos = bVer.indexOf(' ');
	var bVer = bVer.substring(0, pos);
}
if (bName == "Netscape" && parseInt(navigator.appVersion) >= 5)
{
	var pos = useragent.lastIndexOf('/');
	var bVer = useragent.substring(pos + 1);
}

// -----------------------------------------------------------------------------------
// Suche im Header
// -----------------------------------------------------------------------------------

function ShowTopsearchinfo(element){
	// Ermittle Position
	if(element == 1){
		var x = getElementx($('topsearchform').searchtype)-70;
	}else{
		var x = getElementx($('topsearchform').searchtype)+30;
	}
	var y = getElementy($('topsearchform').searchtype)-90;
	// Position setzen
	$('topsearchinfo').style.display = 'block';
	$('topsearchinfo').style.left = x+'px';
	$('topsearchinfo').style.top = y+'px';
	// Loader anzeigen
	showloader($('topsearchinfo'));
	// Laden
	var searchtype = $('topsearchform').searchtype.value;
	LD('templatesv2/tpl_inc/topsearchinfo_'+searchtype+'.html',$('topsearchinfo'));
}

// -----------------------------------------------------------------------------------
// Awaystatus anzeigen
// -----------------------------------------------------------------------------------

function ShowAwaystatusForm(){
	// Position ermitteln
	var x = getElementx($('topuserpart'))+70;
	var y = getElementy($('topuserpart'))-40;
	// Position setzen
	$('changeawaystatus').style.display = 'block';
	$('changeawaystatus').style.left = x+'px';
	$('changeawaystatus').style.top = y+'px';
	// Loader anzeigen
	showloader($('changeawaystatus'),1,315,113);
	// Daten laden
	LD('/index.php?ext=awaystatus',$('changeawaystatus'));
}

function BlendoutAwaystatusForm(){
	$('changeawaystatus').innerHTML = '';
	$('changeawaystatus').style.display = 'none';
}

function AwaystatusMouseOver(){
	oldonlinestatussymbol = $('onlinestatussymbol').src;
	$('onlinestatussymbol').src = "http://static.goolive.org/media/static/images/online_hover.gif";
}

function AwaystatusMouseOut(){
	$('onlinestatussymbol').src = oldonlinestatussymbol;
}

function showAwayMessageHinweis(){
	// Position ermitteln
	var x = getElementx($('topuserpart'))+20;
	var y = getElementy($('topuserpart'))+90;
	// Position setzen
	$('awaystatusinfo').style.display = 'block';
	$('awaystatusinfo').style.left = x+'px';
	$('awaystatusinfo').style.top = y+'px';
	// Loader anzeigen
	showloader($('awaystatusinfo'),1,150,150);
	// Daten laden
	LD('/templatesv2/tpl_inc/awaystatusinfo.html',$('awaystatusinfo'));
}

// -----------------------------------------------------------------------------------
// Logout
// -----------------------------------------------------------------------------------

function ShowOfflinemessageForm(){
	// Position ermitteln
	var x = getElementx($('topuserpart'))+400;
	var y = getElementy($('topuserpart'))+150;
	// Position setzen
	$('offlinemessage').style.display = 'block';
	$('offlinemessage').style.left = x+'px';
	$('offlinemessage').style.top = y+'px';
	// Loader anzeigen
	showloader($('offlinemessage'),2,200,200);
	// Daten laden
	LD('/index.php?ext=offlinemessage',$('offlinemessage'));
}

function BlendoutOfflinemessage(){
	$('offlinemessage').innerHTML = '';
	$('offlinemessage').style.display = 'none';
}

// -----------------------------------------------------------------------------------
// Neue Nachrichten anzeigen
// -----------------------------------------------------------------------------------

function checkmymail(){
	// Speichern
	var jSonRequest = new Json.Remote("/extensionsv2/mod_newmail/checkmail.php",{onComplete: function(ret){
	var soundobj 	= "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"1\" height=\"1\"><param name=\"movie\" value=\"/templatesv2/mod_newmail/sound"+ret.soundfile+".swf\" /><param name=\"quality\" value=\"high\" /><embed src=\"/templatesv2/mod_newmail/sound"+ret.soundfile+".swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"1\" height=\"1\"></embed></object>";

	//Chat oeffnen?
	if(ret.open_chat == 1)
	{
	    window.open('index.php?tpl=blank&ext=jchat&action=chatroom','CHAT',
                            'width=770,height=520,scrollbars=no,resizable=no, status=no, location=no, toolbar=no');
	}

		// Sound abspielen?
		if(ret.playsound == 1){
			var soundhtml = soundobj;
		}else{
			var soundhtml = "";	
		}

		// Anzahl der Nachrichten
		var newmsg = ret.newmsg;

		// Anzeigen
		if(ret.logged != 1){
			document.getElementById('mail-flag').style.visibility = "hidden";
			document.getElementById('mail-icon').innerHTML = '';
		} else if(newmsg >= 1) {
			document.getElementById('mail-flag').innerHTML = newmsg;
			document.getElementById('mail-flag').style.visibility = "visible";
			document.getElementById('mail-icon').innerHTML = "<a href=\"/index.php?ext=msgin\"><img src=\"http://static.goolive.org/media/static/images/common/menu_mail_icon_ani.gif\" width=\"33\" height=\"38\" alt=\"\" /></a>"+soundhtml;
		} else {
			document.getElementById('mail-flag').style.visibility = "hidden";
			document.getElementById('mail-icon').innerHTML = "<a href=\"/index.php?ext=msgin\"><img src=\"http://static.goolive.org/media/static/images/common/menu_mail_icon.png\" width=\"33\" height=\"38\" alt=\"\" /></a>";
		}
	}}).send();
}

// -----------------------------------------------------------------------------------
// Sonstige Funktionen
// -----------------------------------------------------------------------------------

function show_flash(src, width, height, quality){
	document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" +width+ "\" height=\"" +height+ "\">");
	document.write("<param name=\"quality\" value=\"" +quality+ "\" />");
	document.write("<param name=\"movie\" value=\"" +src+ "\" />");
	document.write("<param name=\"wmode\" value=\"transparent\" />");
	document.write("<embed src=\"" +src+ "\" quality=\"" +quality+ "\" width=\"" +width+ "\" height=\"" +height+ "\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
	document.write("</object>");
}

// Ein Dokument über URL laden und in einen Container füllen
function LD(url,target,loadObj){

	if(typeof(loadObj)!='undefined'){
		loadObj.setStyle('display','');
	}

	var myXHR = new XHR({
		method: 'get',
		onSuccess: function(response){

			if(typeof(loadObj)!='undefined'){
				loadObj.setStyle('display','none');
			}

			if(typeof(target)!='undefined'){
				target.setHTML(this.response.text);
			}
		}
	}).send(url,'');
}
/**
* LoadDocumentAdvanced
*/
function LDA(url,options){

	if(typeof(options.loadObj)!='undefined'){
		options.loadObj.setStyle('display','');
	}

	if(typeof(options.target)=='undefined'){
		alert('Target ist undefined in Function LDA');
	}

	var myXHR = new XHR({
		method: 'get',
		onSuccess: function(response){

			if(typeof(options.loadObj)!='undefined'){
				options.loadObj.setStyle('display','none');
			}

			options.target.setHTML(this.response.text);

			if(typeof(options.onready)!='undefined'){
				options.onready(options.target);
			}
		}
	}).send(url,'');
}

// target = Ziel Element
// jswindow = 1 (links) oder 2 (rechts) oder keine Angabe (kein Fenster, nur Loader)
// width = Breite
// height = Höhe
function showloader(target,jswindow, width, height){
	if(typeof(width)=='undefined'){
		width = 100;
	}else{
		width = width+10;
	}
	if(typeof(height)=='undefined'){
		height = 100;
	}else{
		height = height+10;
	}
	if(jswindow == 1){
		target.setHTML('<table width="'+width+'" height="'+height+'" border="0" cellspacing="0" cellpadding="0"><tr><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/lt.gif" width="5" height="5" /></td><td background="http://static.goolive.org/media/static/js/tip_balloon/t.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="50" height="5" /></td><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/rt.gif" width="5" height="5" /></td></tr><tr><td background="http://static.goolive.org/media/static/js/tip_balloon/l.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="5" height="5" /></td><td align="center" valign="middle" bgcolor="#FFFFFF"><img src="http://static.goolive.org/media/static/images/jsloader.gif" border="0"></td><td background="http://static.goolive.org/media/static/js/tip_balloon/r.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="5" height="5" /></td></tr><tr><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/lb.gif" width="5" height="5" /></td><td background="http://static.goolive.org/media/static/js/tip_balloon/b.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="50" height="5" /></td><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/rb.gif" width="5" height="5" /></td></tr></table>');
	}
	else if(jswindow == 2){
		target.setHTML('<table width="'+width+'" height="'+height+'" border="0" cellspacing="0" cellpadding="0"><tr><td height="5">&nbsp;</td><td height="19"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="15" height="5" /></td><td width="15"><img src="http://static.goolive.org/media/static/js/tip_balloon/stemt.gif" width="15" height="19" /></td><td width="15" height="19"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="15" height="5" /></td><td height="5">&nbsp;</td></tr><tr><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/lt.gif" width="5" height="5" /></td><td height="5" background="http://static.goolive.org/media/static/js/tip_balloon/t.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="15" height="5" /></td><td width="15" bgcolor="#FFFFFF"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="15" height="5" /></td><td background="http://static.goolive.org/media/static/js/tip_balloon/t.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="15" height="5" /></td><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/rt.gif" width="5" height="5" /></td></tr><tr><td background="http://static.goolive.org/media/static/js/tip_balloon/l.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="5" height="5" /></td><td colspan="3" align="center" valign="middle" bgcolor="#FFFFFF"><img src="http://static.goolive.org/media/static/images/jsloader.gif" border="0"></td><td background="http://static.goolive.org/media/static/js/tip_balloon/r.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="5" height="5" /></td></tr><tr><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/lb.gif" width="5" height="5" /></td><td colspan="3" background="http://static.goolive.org/media/static/js/tip_balloon/b.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="50" height="5" /></td><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/rb.gif" width="5" height="5" /></td></tr></table>');
	}
	else{
		target.setHTML('<img src="http://static.goolive.org/media/static/images/jsloader.gif" border="0">');
	}
}

// Fenster zentrieren
// --> Alle Fenster
function CenterScreen(width,height){
	var leftPos = screen.width?(screen.width - width)/2:0;
	var topPos = screen.height?(screen.height - height)/2:0;
	this.focus();
	this.moveTo(leftPos,topPos);
}

// Profil eines Benutzers aufrufen
function JumpProfile(username,user_id){
	if(user_id.length >= 1){
		location.href = "/index.php?ext=user_showvcard&user_id="+user_id;
	}else{
		location.href = "/index.php?ext=user_showvcard&username="+username;
	}
}

// Fotoalbum Bild öffnen
function OpenFoto(foto_id){
	IFrameWindow("index.php?tpl=blank&ext=user_fotoalbum&action=showpic&fotoalbum_id="+foto_id,600,650);
}

// -----------------------------------------------------------------------------------
// Iframe Window
// -----------------------------------------------------------------------------------
function helpWindow(width,titel,content){
	// Position aus Cookie laden
	var x = x = readCookie('IframeWindow_x');
	
	if(x == null){
		var x = getElementx($('topuserpart'))+200;	
	}
	
	
	var y = window.getScrollTop()+50;
	// Scrollen
	if(scrolling == null){
		var scrolling = 'auto';
	}
	
	// POsition setzen
	$('IframeWindow').style.display = 'block';
	$('IframeWindow').style.left = x+'px';
	$('IframeWindow').style.top = y+'px';
	// Anzeigen
	var html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/lt.gif" width="5" height="5" /></td><td height="5" background="http://static.goolive.org/media/static/js/tip_balloon/t.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="50" height="5" /></td><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/rt.gif" width="5" height="5" /></td></tr><tr><td background="http://static.goolive.org/media/static/js/tip_balloon/l.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="5" height="5" /></td><td align="left" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="left"><b>'+titel+'</b></td><td width="20" height="20" align="right" valign="middle"><a href="javascript:closeIframeWindow();"><img src="http://static.goolive.org/media/static/images/window_close_n.gif" width="20" height="20" border="0" onmouseover="javascript:this.src=\'/templatesv2/style/window_close_h.gif\';" onmouseout="javascript:this.src=\'/templatesv2/style/window_close_n.gif\';" title="Fenster schließen" /></a></td></tr><tr><td height="5" colspan="2" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #000000;"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="30" height="5" /></td></tr></table><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td style="padding:5px;" width="'+width+'">'+content+'</td></tr></table></td><td background="http://static.goolive.org/media/static/js/tip_balloon/r.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="5" height="5" /></td></tr><tr><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/lb.gif" width="5" height="5" /></td><td background="http://static.goolive.org/media/static/js/tip_balloon/b.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="50" height="5" /></td><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/rb.gif" width="5" height="5" /></td></tr></table>';
	$('IframeWindow').setHTML(html);
}


// -----------------------------------------------------------------------------------
// Iframe Window
// -----------------------------------------------------------------------------------
function IFrameWindow(url,width,height,scrolling){
	// Position aus Cookie laden
	var x = x = readCookie('IframeWindow_x');
	
	if(x == null){
		var x = getElementx($('topuserpart'))+200;	
	}
	
	
	var y = window.getScrollTop()+50;
	// Scrollen
	if(scrolling == null){
		var scrolling = 'auto';
	}
	
	// Position setzen
	$('IframeWindow').style.display = 'block';
	$('IframeWindow').style.left = x+'px';
	$('IframeWindow').style.top = y+'px';
	// Anzeigen
	var html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/lt.gif" width="5" height="5" /></td><td height="5" background="http://static.goolive.org/media/static/js/tip_balloon/t.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="50" height="5" /></td><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/rt.gif" width="5" height="5" /></td></tr><tr><td background="http://static.goolive.org/media/static/js/tip_balloon/l.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="5" height="5" /></td><td align="left" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td id="msg_window_draghandler" style="cursor: move;"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="30" height="5" /></td><td width="20" height="20" align="right" valign="middle"><a href="javascript:closeIframeWindow();"><img src="http://static.goolive.org/media/static/images/window_close_n.gif" width="20" height="20" border="0" onmouseover="javascript:this.src=\'/templatesv2/style/window_close_h.gif\';" onmouseout="javascript:this.src=\'/templatesv2/style/window_close_n.gif\';" title="Fenster schließen" /></a></td></tr><tr><td height="5" colspan="2" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #000000;"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="30" height="5" /></td></tr></table><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td style="padding:5px;"><iframe src="'+url+'" width="'+width+'" height="'+height+'" frameborder="0" marginheight="0" marginwidth="0" scrolling="'+scrolling+'"></iframe></td></tr></table></td><td background="http://static.goolive.org/media/static/js/tip_balloon/r.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="5" height="5" /></td></tr><tr><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/lb.gif" width="5" height="5" /></td><td background="http://static.goolive.org/media/static/js/tip_balloon/b.gif"><img src="http://static.goolive.org/media/static/images/spacer.gif" width="50" height="5" /></td><td width="5" height="5"><img src="http://static.goolive.org/media/static/js/tip_balloon/rb.gif" width="5" height="5" /></td></tr></table>';
	$('IframeWindow').setHTML(html);
	// Daten laden
	$('IframeWindow').makeDraggable({
		container : $(document.body),
		handle : $('msg_window_draghandler'),
		onComplete : function(){
			// Position neu ermitteln
			var x = getElementx($('IframeWindow'));
			// Im Cookie speichern
			createCookie('IframeWindow_x',x,1);
		}
	});
	showShadow($('IframeWindow'));
}

function closeIframeWindow(){
	$('IframeWindow').style.display = 'none';
	$('IframeWindow').setHTML('');
	hideShadow();
}

// -----------------------------------------------------------------------------------
// Nachrichtensystem
// -----------------------------------------------------------------------------------

// Neue Nachricht schreiben
function NewMessage(userid){
	IFrameWindow('index.php?ext=messenger&show=writemsg&user_id='+userid,500,500,'no');
}
function ShowOutMessage(id){
	IFrameWindow('index.php?ext=messenger&show=showoutmsg&msg_id='+id,500,500,'no');
}
function sendfile(user_id){
	IFrameWindow('index.php?tpl=blank&ext=filetransfer&action=showform&user_id='+user_id,500,500,'no');
}

var openMessage = function(obj,id){
	// Position aus Cookie laden
	var x = readCookie('msgwindow_x');
	var y = readCookie('msgwindow_y');
	// Positionen neu ermitteln, wenn diese nicht im Cookie gespeichert sind 
	if(x == null){
		x = getElementx($('topuserpart'))+200;
	}
	if(y == null){
		y = getElementy($('topuserpart'))+150;
	}
	// POsition setzen
	$('msgOverlay').style.display = 'block';
	$('msgOverlay').style.left = x+'px';
	$('msgOverlay').style.top = y+'px';
	// Loader anzeigen
	showloader($('msgOverlay'));
	// Daten laden
	LDA("index.php?ext=messenger&show=showmsg&msg_id="+id,{
		target : $('msgOverlay'),
		onready : function(target){
			ClickMsg(obj,id);
			target.makeDraggable({
				container : $(document.body),
				handle : $('msg_window_draghandler'),
				onComplete : function(){
					// Position neu ermitteln
					var x = getElementx($('msgOverlay'));
					var y = getElementy($('msgOverlay'));
					// Im Cookie speichern
					createCookie('msgwindow_x',x,1);
					createCookie('msgwindow_y',y,1);
				}
			});
		}
	});
}

var closeMessage = function(){
	$('msgOverlay').setHTML('');
	$('msgOverlay').style.display = 'none';
}

var openSmileyList = function(target,txtField){
	var smileyLoader = Json.Remote('index.php?ext=smileylist',{
		onComplete:function(list){
			var smileyList = Json.evaluate(list);

			var sImg;

			for(var i=0; i < smileyList.length; ++i){
				sImg = new Element('img',{
					'src' : smileyList[i].replace,
					'search' : smileyList[i].search
				});
				sImg.addEvent('click',function(){
					txtField.value += this.getProperty('search');
				});
				sImg.injectInside(target);
			}

			target.setStyle('display','');
		}
	});
}

// -----------------------------------------------------------------------------------
// Tabsystem-Funktionen
// -----------------------------------------------------------------------------------

/*

color_activ: Hintergrundfarbe von aktiven Tabs
color_activ_font: Schriftfarbe von aktiven Tabs
color_inactiv: Hintergrundfarbe von inaktiven Tabs
color_inactiv_font: Schriftfarbe von inaktiven Tabs
color_border: Rahmenfarbe
color_hover: Hintergrundfarbe von Mouse Over
color_hover_font: Schriftfarbe von Mouse Over


<ul id="gootabs" > 
<li onclick="activate_tab('gootabs',1)"><a class="active" id="gootabs1">Zusagen</a></li> 
<li onclick="activate_tab('gootabs',2)"><a class="" id="gootabs2">Vielleicht</a></li> 
<li onclick="activate_tab('gootabs',3)"><a class="" id="gootabs3">Absagen</a></li>
<li onclick="activate_tab('gootabs',4)"><a class="" id="gootabs4">Kommentare</a></li>
</ul> 


*/
                            
function write_css(color_activ, color_activ_font,color_inactiv,color_inactiv_font, color_border, color_hover, color_hover_font)
{              
	document.write('<style type="text/css">');
	document.write('.gootab{');
	document.write('padding: 3px 10px;margin-left: 0;font: bold 11px Verdana;list-style-type: none;text-align: left;border-bottom-width: 1px;');
	document.write('border-bottom-style: solid; border-bottom-color: ' + color_border + ';');
	document.write('}');
	
	document.write('.gootab li{');
	document.write('display: inline;margin: 0;');
	document.write('}');
	
	document.write('.gootab li a{');
	document.write('text-decoration: none;padding: 3px 7px;margin-right: 3px;background-color: ' + color_inactiv + ';');
	document.write('color: ' + color_inactiv_font + ';border-top-width: 1px;border-right-width: 1px;');
	document.write('border-bottom-width: 0px;border-left-width: 1px;border-top-style: solid;border-right-style: solid;border-bottom-style: none;border-left-style: solid;');
	document.write('border-top-color: ' + color_border + '; border-right-color: ' + color_border + ';border-bottom-color: ' + color_border +' ;border-left-color: #CCCCCC;}');
	document.write('.gootab li a:hover{background-color: ' + color_hover + ';color: ' + color_hover_font + ';}');
	document.write('.gootab li.selected a{position: relative;top: 1px;padding-top: 4px;font: bold 12px Verdana;');
	document.write('background-color: ' + color_activ + ';color: ' + color_activ_font + ';}');
	document.write('</style>');

}

function activate_tab(menue,tab)
{                                                             
	   for(i=1;i<=1000;i++)
	   {
			   if(document.getElementById(menue + i)){
					document.getElementById(menue + i).className = "";              
			   }else{
					break;
			   }
	   }              
													  
	   document.getElementById(menue + tab).className="selected";
}

/*

color_activ: Hintergrundfarbe von aktiven Tabs
color_activ_font: Schriftfarbe von aktiven Tabs
color_inactiv: Hintergrundfarbe von inaktiven Tabs
color_inactiv_font: Schriftfarbe von inaktiven Tabs
color_border: Rahmenfarbe
color_hover: Hintergrundfarbe von Mouse Over
color_hover_font: Schriftfarbe von Mouse Over


<ul id="gootabs" > 
<li onclick="activate_tab('gootabs',1)"><a class="active" id="gootabs1">Zusagen</a></li> 
<li onclick="activate_tab('gootabs',2)"><a class="" id="gootabs2">Vielleicht</a></li> 
<li onclick="activate_tab('gootabs',3)"><a class="" id="gootabs3">Absagen</a></li>
<li onclick="activate_tab('gootabs',4)"><a class="" id="gootabs4">Kommentare</a></li>
</ul> 

color_activ, color_activ_font,color_inactiv,color_inactiv_font, color_border, color_hover, color_hover_font


*/

// CSS Styles für Tabs setzen
write_css("#FFFFFF","#000000","#CCCCCC","#666666","#CCCCCC","#FF6600","#FFFFFF");