function getCookie(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 setCookie(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=/; rangersguild.com";
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function radioOpen()
{
	radiostatus=getCookie('radio')
	var version=navigator.appVersion

	if ( (radiostatus == "yes") && (version.indexOf("MSIE 6.0")==-1) )
	{
		radiowindow = window.open("","guildradio");
		radiowindow.focus();
		return "";
	}

	radiowindow=window.open("../radio/radioframes.htm","guildradio","height=155,width=366");
	return"";
}

function chatOpen(room)
{
	chatstatus=getCookie('chat')	

	if (chatstatus=="yes")
	{
		chatwindow = window.open("","guildchat");
		chatwindow.focus();
		return "";
	}
	
	chatwindow=window.open('../forums/chat/chatframes.php?room='+room,'guildchat', 'toolbar=0,scrollbars=0,location=1,statusbar=0,menubar=0,resizable=1,height=600,width=800');
	return "";
}

function notLoggedIn()
{
	alert('You need to be a registered Guildmember and be logged in to do that.');
}

function hideDiv()
{
	if (document.getElementById)
	{ // DOM3 = IE5, NS6
		document.getElementById('loginbox').style.visibility = 'hidden';
	}
	else
	{
		if (document.layers)
		{ // Netscape 4
			document.loginbox.visibility = 'hidden';
		}
		else
		{ // IE 4
			document.all.loginbox.style.visibility = 'hidden';
		}
	}
}

function showDiv()
{
	if (document.getElementById)
	{ // DOM3 = IE5, NS6
		document.getElementById('loginbox').style.visibility = 'visible';
		document.getElementById('loginbox').style.visibility = 'visible';
	}
	else
	{
		if (document.layers)
		{ // Netscape 4
//			document.loginbox.visibility = 'visible';
			document.loginbox.display = 'block';
		}
		else
		{ // IE 4
			document.all.loginbox.style.visibility = 'visible';
		}
	}
}

function Show_Stuff(theSpan)
{
	if (theSpan.style.display == "none")
	{
		theSpan.style.display = "block";
	}
	else
	{
		theSpan.style.display = "none";
	}
}