// Community

_sessionid = "";
_nick = "";
_servlet = "http://212.172.17.63/cassiopeia/NetCommunity";

function checkAddressBar()
{
	if(window.location.search)
	{
		a = window.location.search;
		
		if(a.indexOf("nick") > -1 || a.indexOf("sessionid") > -1)
		{
			if(/nick=(\w+)/.exec(a))
				_nick = RegExp.$1;
			
			if(/sessionid=(\d+|\w+)/.exec(a))
				_sessionid = RegExp.$1;
		
			return true;
		}
		else
			return false;
	}
	else
		return false;
}


function go_yamcom_modul(mod)
{
	if(checkAddressBar())
	{
		switch(mod.toLowerCase())
		{
			case "postcard":
			{
				_sessionid += "&service=index";
				self.location.href = _servlet + mod + "?&nick=" + _nick + "&sessionid=" + _sessionid;
				break;
			}
			
			case "toplist":
			{
				_sessionid += "&global=yes";
				self.location.href = _servlet + mod + "?&nick=" + _nick + "&sessionid=" + _sessionid;
				break;
			}
			
			case "memberguestbook":
			{
				memberguestbook();
				break;
			}

			default:
			{
				self.location.href = _servlet + mod + "?&nick=" + _nick + "&sessionid=" + _sessionid;
			}
		}
	}
	else
	{
		switch(mod.toLowerCase())
		{
			case "postcard":
			{
				self.location.href = _servlet + mod + "?service=index";
				break;
			}
			
			default:
			{
				self.location.href = _servlet + "?&module=" + mod;
			}
		}
	}
}


function go_yamcom_link(l)
{
	if(checkAddressBar())
	{
		if(l.toLowerCase() == "chat")
		{
			window.open(_servlet + "?service=chat&nick=" + _nick + "&sessionid=" + _sessionid, "chat_popup", "height=530, width=715");
		}
		else	
			self.location.href = _servlet + "?service=" + l + "&nick=" + _nick + "&sessionid=" + _sessionid;
	}
	else
		self.location.href = _servlet + "?service=" + l;
}


function go_content_link(l)
{
	if(checkAddressBar())
	{
		if(window.location.search.indexOf("?") > -1)
			self.location.href = l + "?&nick=" + _nick + "&sessionid=" + _sessionid;
		else
			self.location.href = l + "?&nick=" + _nick + "&sessionid=" + _sessionid;
	}
	else
		self.location.href = l;
}


function memberguestbook()
{
	window.open(_servlet + "Memberguestbook?service=index&nick=" + _nick + "&sessionid=" + _sessionid + "&nh=0&host=" + _nick, "gaestebuch", "width=450, height=450, scrollbars=1");
}


function openWindow(url)
{
	temp = Math.round(Math.random());
	window.open(url, "fenster_" + temp, "height=450, width=450, scrollbars=1");
}



// REMOVE UGLY l BORDERS
// original code by evil@chelu.ro
function unblur()
{
	this.blur();
}

function RemovelBoxes()
{
	if(!document.getElementById)
		return;

	ls = document.getElementsByTagName("a");

	for(i = 0; i < ls.length; i++)
	{
		ls[i].onfocus = unblur;
	}
}

function openGal(g, k)
{
	window.open("http://www.yam.de/media/gallerie/start.php?k=" + k + "&g=" + g , "popup_galerie_" + g, "height=640, width=600, statusbar=0, menubar=0");
}

//Psychotest Popup
function psychotest_popup (Adresse) {
  PsychoFenster = window.open(Adresse, "_blank", "innerWidth=465,width=485,height=610,left=150,top=150,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,toolbar=no,");
  PsychoFenster.focus();
}

function openRushtower()
{
	var neuesfenster = window.open("skin/yam/rushtower/start.html", "rushtower", "left=0, top=0, height=600, width=400");
	neuesfenster.moveTo((screen.width - 400) / 2, (screen.height - 600) / 2 - 20);
	
	//setTimeout('neuesfenster.focus();', 200);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function openHPdl()
{
	window.open("skin/yam/features/hp_dl/dl.html", "hpdl", "width=300, height=100, statusbar=0, menubar=0, scrollbars=0");
}

function openYamTV()
{
	window.open("http://www.yam.tv/skin/main.htm", "yamerte4tetv", "height=600,width=730,scrollbars=no");
}
   function openAdvent ( url, name ) 
{
      win = window.open(url, name, "width=877,height=561,scrollbars=no,left=5,top=5");
      win.focus();
}

