// <script>

function Star(id)
{
	this.speed = parseInt(Math.random() * 500) + 100;
	this.x = parseInt(Math.random() * (document.body.offsetWidth - 40));
	this.y = -20;
	this.id = id;
	
	this.moveStar = _moveStar;
	
	
	function _moveStar()
	{
		if(document.all[this.id].style.display == "none")
			document.all[this.id].style.display = "";
		
		this.y += 5;
		if(this.y > (document.body.offsetHeight-30)) 
		{
			this.y = -10;
			this.speed = parseInt(Math.random() * 500) + 100;
			this.x = parseInt(Math.random() * (document.body.offsetWidth - 40));
		}
		
		document.all[this.id].style.left = this.x;
		document.all[this.id].style.top = this.y;
	
	}
}

var stars = 60;		
var starCollection;

function initStars(img)
{
	if(document.all["star0"] == null)
	{	
		starCollection = new Array(stars);
		for(var i = 0; i < stars; i++)
		{
			document.body.insertAdjacentHTML("beforeEnd", "<img src=\"" + img + "\" width=16 height=16 id=\"star" + i + "\" style=\"display: none; position: absolute;\">");
			starCollection[i] = new Star("star" + i);
			setInterval("starCollection[" + i + "].moveStar()", starCollection[i].speed);
		}
	}
	else
	{
		for(var i = 0; i < stars; i++)
		{
			if(document.all["star" + i] != null)
				document.body.removeChild(document.all["star" + i]);
		}
	}
	
}

function snow1()
{
	initStars("/fun/snowflake.gif");
}

function snow2()
{
	initStars("/fun/snowflake2.gif");
}

function snow3()
{
	initStars("/fun/snowflake3.gif");
}


function heart()
{
	initStars("/fun/heart.gif");
}


var lastMessageCount = 0;

function navigateTo(url) {
	fraRight.location.href = url;
}

function group_Apply( intGroupID, strName, intStatus ) {
	intNotify = ( intStatus & 2 );
	if(!isMember)
	{
		if((intStatus & 32) != 0)
			fraRight.location.href = "membersonly.aspx?intGroupID=" + intGroupID;
		else
			window.open( "/docs/group/apply_yourself.aspx?intGroupID=" + intGroupID + "&strName=" + escape( strName ) + "&intNotify=" + intNotify, "applyYourself", "width=500, height=400, menubar=no, scrollbars=auto, status=no, directory=no, buttons=no" )
	}
	else
	{
		window.open( "/docs/group/apply_yourself.aspx?intGroupID=" + intGroupID + "&strName=" + escape( strName ) + "&intNotify=" + intNotify, "applyYourself", "width=500, height=400, menubar=no, scrollbars=auto, status=no, directory=no, buttons=no" )
	}
}

function group_Join( intGroupID ) {
	fraRight.location.href = "/docs/group/autoapprove.aspx?intGroupID=" + intGroupID;
}

function group_showInfo( intGroupID ) {
	if( intGroupID != "" )
		fraRight.location.href = "/docs/group/group_info.aspx?intGroupID=" + intGroupID;
}


function readThread( intMessageID ) {
	if( intMessageID != "" )
		fraRight.location.href = "/docs/message/readthread.aspx?intMessageID=" + intMessageID;
}

function user_searchUser( strUserName ) {
	if( !strUserName ) {
		strUserName = getValue();
		if ( strUserName != "" )
			strUserName = strUserName.split( ";" )[1];
	}
	
	if ( strUserName != "" )
	{
		with(top.fraLeft.document.forms[0])
		{
			s.value = strUserName;
			st.value = 2;
			si.value = 30;
			submit();
		}
	}
}


function user_showInfo() {
	
	var userName = document.forms[0].strUID.value;
	if(userName != "" && userName.substring(0, 9) != "Inloggade") {
		var oWin;
		oWin = window.open("/useraction.aspx?action=userInfo&userName=" + escape(userName), "winUserInfo", "width=500,height=400,scrollbars=no,menubar=no,status=no,directory=no,buttons=no,location=no");
		oWin.opener = self;
	}
}

function user_logOut() {
	top.location.href = "/docs/login/logout.aspx";
}

function user_openInfo( intUserID ) {
	var oWin;
	oWin = window.open("/docs/login/userinfo.aspx?intUserID=" + intUserID, "winUserInfo", "width=500,height=400,scrollbars=no,menubar=no,status=no,directory=no,buttons=no,location=no");
	oWin.opener = self;
}

function sendNote(intUserID)
{
	user_sendNote(intUserID)
}

function user_sendNote(intUserID, bForce) {
	
	if(bForce) {
		intUserID = "";
	}
	
	if((!intUserID) && (!bForce)) {
		var userName = document.forms[0].strUID.value;
		if(userName != "" && userName.substring(0, 9) != "Inloggade") {
			oWin = window.open("/useraction.aspx?action=note&userName=" + escape(userName), "sendNote", "width=500,height=400,menubar=no,resizable=yes,scrollbars=auto,status=no,directory=no,buttons=no")
			oWin.opener = self
		}
	} else {		
		if(intUserID != "" || bForce) {
			oWin = window.open("/docs/login/note_write.aspx?intToUserID=" + intUserID, "sendNote", "width=500,height=400,menubar=no,resizable=yes,scrollbars=auto,status=no,directory=no,buttons=no")
			oWin.opener = self
		}
	}
}

function user_sendDeleteNote(userID, messageID)
{
	oWin = window.open("/docs/login/note_write.aspx?intToUserID=" + userID + "&showTemplates=1", "sendNote", "width=500,height=400,menubar=no,resizable=yes,scrollbars=auto,status=no,directory=no,buttons=no")
	oWin.opener = self
	
	fraRight.location.replace("/docs/message/readthread.aspx?intMessageID=" + messageID);
}
	

function user_sendNoteFromFavBox()	{
	var intUserID = getValue();
	
	if (intUserID.length != 0) {
		intUserID = intUserID[0].split(";")[0];
		user_sendNote(intUserID);
	}
}

function user_deleteNote(messageID)
{
	fraReloader.location.replace("/docs/login/note_delete.aspx?strNotes=" + messageID);
}

function user_markAsRead(messageID)
{
	fraReloader.location.replace("/docs/login/note.aspx?intNoteID=" + messageID + "&noGui=1");
}

function startChat() {
	var querystring = "";
	var users = getValue()
	for(var i = 0; i < users.length; i++)
		querystring += "&inviteUserID=" + users[i].split(";")[0];
		
	window.open("/docs/chat/chatserver.aspx?createSession=1" + querystring, "chat", "width=300,height=400,menubar=no,status=yes,resizable=yes");
}

function user_Chat( intUserID ) {
	window.open("/docs/chat/chatserver.aspx?createSession=1&inviteUserID=" + intUserID, "chat", "width=300,height=400,menubar=no,status=yes,resizable=yes");
}

function openChat( sessionID ) {
	window.open("/docs/chat/chatclient.aspx?sessionID=" + sessionID, "chat", "width=300,height=400,menubar=no,status=yes,resizable=yes");
}

function getTr( oEl ) {
	while ( oEl && oEl.tagName != 'TABLE' ) {
		if( oEl.tagName == 'TR' ) {
			return oEl;
			break;
		}
		oEl = oEl.parentElement;
	}
	return oEl
}


function user_readNote( intNoteID, oEl ) {
	var s;
	if ( oEl ) {
		oEl = getTr( oEl )
		if( oEl != null ) {
			oEl.style.fontWeight = 'normal';
			s = ((oEl.children[0].children[2].tagName == "A") ? 0 : 1);
			oEl.children[s].children[1].style.fontWeight = 'normal';	
			oEl.children[s+1].firstChild.style.fontWeight = 'normal';
		}
	}
	oEl = null;

	var oWin
	var winName;
		
	intNoteID = ( ( intNoteID ) ? intNoteID : "" );
	
	if(intNoteID == "" || intNoteID == "-1" || intNoteID == -1)
		winName = "note" + new Date().valueOf();
	else
		winName = "note" + intNoteID;
		
	oWin = window.open( "/docs/login/note.aspx?intNoteID=" + intNoteID, winName, "width=500, height=400, menubar=no, scrollbars=no, resizable=yes, status=no, directory=no, buttons=no" )
	oWin.opener = self
	oWin.focus();
}


function user_addFavorite(intUserID) {
	
	if( !intUserID) {
		var userName = document.forms[0].strUID.value;
		if(userName != "" && userName.substring(0, 9) != "Inloggade")
			fraRight.location.href = "/useraction.aspx?action=favorite&userName=" + escape(userName);
	} else
		if (intUserID.length != 0)
			fraRight.location.href = "/docs/settings/favorite_add.aspx?strReferer=/docs/settings/favorites.aspx&intFavoriteID=" + intUserID;
}

function getOffsetLeft( o ) {
	var w = 0;
		
	while( o.tagName != "BODY" ) {
		//alert( "Left: " + o.tagName + ": " + o.offsetLeft )
		if( ( o.tagName != "TR" ) && ( o.tagName != "FORM" ) && ( o.tagName != "P" ) && ( o.tagName != "A" ) )
			w += o.offsetLeft;
		o = o.parentElement;
	}
	
	return( w );
}
	
function getOffsetTop( o ) {
	var h = 0;
		
	while( o.tagName != "BODY" ) {
		//alert( "Top: " + o.tagName + ": " + o.offsetTop )
		if( ( o.tagName != "TR" ) && ( o.tagName != "FORM" ) && ( o.tagName != "P" ) && ( o.tagName != "A" ) )
			h += o.offsetTop;
		o = o.parentElement;
	}
	
	return( h );
}

//var oMenu = null;

function toggleSelect( vis ) {
	var oTags = document.all.tags( "SELECT" );
	var i;
	
	for( i = 0; i < oTags.length; i++ ) {
		oTags[i].style.visibility = vis;
	}
	
	oTags = fraLeft.document.all.tags( "SELECT" );
	
	for( i = 0; i < oTags.length; i++ ) {
		oTags[i].style.visibility = vis;
	}
	
	oTags = fraRight.document.all.tags( "SELECT" );
	
	for( i = 0; i < oTags.length; i++ ) {
		oTags[i].style.visibility = vis;
	}
}

function highlight( o ) {

	with( o.cells[0] ) {
		style.borderLeft = "1px solid black";
		style.borderTop = "1px solid black";
		style.borderBottom = "1px solid black";
		style.backgroundColor = "#ECECEC";
	}
	
	with( o.cells[1] ) {
		style.borderTop = "1px solid black";
		style.borderBottom = "1px solid black";
		style.borderRight = "1px solid black";
		style.backgroundColor = "#ECECEC";
	}
}

function lolight( o ) {
	if( o.contains( event.toElement ) )
		return;
		
	with( o.cells[0] ) {
		style.borderLeft = "1px solid #ECECEC";
		style.borderTop = "1px solid #ECECEC";
		style.borderBottom = "1px solid #ECECEC";
		style.backgroundColor = "#ECECEC";
	}
	
	with( o.cells[1] ) {
		style.borderTop = "1px solid white";
		style.borderBottom = "1px solid white";
		style.borderRight = "1px solid white";
		style.backgroundColor = "#FFFFFF";
	}
}

var oOpenMenu = null;

function openDropMenu( oList, oMenu, offsetLeft, offsetTop ) {
	if(oMenu)
	{
		if( oMenu.style.display != "none" ) {
			hideDropMenu( oMenu );
		} else {
			toggleSelect( "hidden" );
			
			if(offsetLeft == null) offsetLeft = -7;
			if(offsetTop == null) offsetTop = 5;
			
			oMenu.style.left = getOffsetLeft( oList ) + offsetLeft;
			oMenu.style.top = getOffsetTop( oList ) + oList.offsetHeight + offsetTop;
			oMenu.style.height = "";
			oMenu.style.display = "";
			
			if( oMenu.offsetHeight > ( document.body.offsetHeight - oMenu.style.posTop - 20 ) )
				oMenu.style.height = document.body.offsetHeight - oMenu.style.posTop - 20;
				
			oOpenMenu = oMenu;
		}
	}
	
	if(event)
		event.cancelBubble = true;
	
}

function hideDropMenu( oMenu ) {
	toggleSelect( "" );
	if( oMenu ) oMenu.style.display = "none";
	if( oOpenMenu != null ) oOpenMenu.style.display = "none";
	if( fraLeft.hideDropMenu ) fraLeft.hideDropMenu();
	if( fraRight.document.all["ct_menu"] != null) fraRight.document.all["ct_menu"].style.display = "none";
}

function doNothing()
{
}

function contextMenuButtonOver(button)
{
	if(button)
	{
		button.className = "contextMenuButtonHover";
	}
}

function contextMenuButtonOut(button)
{
	if(button)
	{
		button.className = "contextMenuButtonNormal";
	}
}

function user_latestMessage( intUserID ) {
	fraRight.location.href = "/docs/member/latestmessages.aspx?intUserID=" + intUserID;
}

function getValue(){
	var obj = document.forms["frmFavorites"].chkUser;
	var userIDs = new Array();
	if( !obj ) return( "" );
	
	if ( document.forms["frmFavorites"].chkUser.value )
		userIDs[0] = document.forms["frmFavorites"].chkUser.value;
	else
	{
		for ( var i = 0; i < obj.length; i++ ) {
			if ( obj[i].checked ) {
				userIDs[userIDs.length] = obj[i].value;
				obj[i].checked = false;
			}
		}
	}
	
	if(userIDs.length > 0)
		return userIDs;
	else	
		return "";
}


/**** Update dynamic stuff ****/
function setUnreadMessageCount( intMessages ) {
	if(intMessages != lastMessageCount)
	{
		if(document.all["oNewNotes"]) 
			document.all["oNewNotes"].innerText = intMessages;
		
		if(document.images["imgNewNote"])
			document.images["imgNewNote"].src = "/images/" + ( ( intMessages > 0 ) ? "top_meddel_anim.gif" : "top_meddel.gif" );
		
		if(document.all["unreadMenuItem"])
			document.all["unreadMenuItem"].disabled = (intMessages == 0);
	}
	lastMessageCount = intMessages;
}

var oFlash;
var iFlashType;

var iAddOpacity = 92/5;

var ifLoginNotification = 1;
var ifNewUserNotification = 2;
var ifMessageNotification = 3;
var ifChatInvitation = 4;
var ifTipNotification = 5;
var ifGroupInvitation = 6;
var ifGroupApply = 7;
var ifKickMessage = 8;
var ifBookmark = 9;
var ifTemporaryLockout = 10;

function flashMessage( sMessage, iType, sActionURL, sSubject, iFromUserID, sFromUserName, iMessageID ) {
	var t, l, w, h;
	var margin = 10;
	var body;
	var oDiv;
	var sHTML;
	var sLinkTitle;
	var sIcon;
	var sFlashTitle;
	var silent = false;
	
	if( !isIE5() )
		return( false );
		
	
	iFlashType = iType;
	
	body = document.body;
	if( !body ) setTimeout( "flashMessage( '" + sMessage + "', '" + sBGColor + "', iType )", 500 );
	
	w = 300;
	t = getOffsetTop( document.all["oMessageIcon"] ) + 20 + margin;
	l = getOffsetLeft( document.all["oMessageIcon"] ) + document.all["oMessageIcon"].offsetWidth - w - margin;

	switch(iType)
	{
		case ifLoginNotification:
			sFlashTitle = "Favorit online";
			sLinkTitle = "Chatta!";
			sIcon = "icon_fav_green.gif";
			break;
		case ifNewUserNotification:
			sFlashTitle = "Ny anv&auml;ndare";
			sLinkTitle = "Skicka meddelande!";
			sIcon = "icon_fav_green.gif";
			break;
		case ifMessageNotification:
			sFlashTitle = sSubject;
			sLinkTitle = "L&auml;s hela!";
			sIcon = "icon_fav_kontakta.gif";
			break;
		case ifChatInvitation:
			sFlashTitle = sSubject;
			sLinkTitle = "Till chatten!";
			sIcon = "icon_fav_chat2.gif";
			break;
		case ifTipNotification:
			sFlashTitle = sSubject;
			sLinkTitle = "L&auml;s inl&auml;gg!";
			sIcon = "icon_tip.gif";
			break;
		case ifGroupInvitation:
			sFlashTitle = sSubject;
			sLinkTitle = "G&aring; med i grupp!";
			sIcon = "navigation/icon_menu_mygroups.gif";
			break;
		case ifGroupApply:
			sFlashTitle = sSubject;
			sLinkTitle = "&Ouml;ppna ans&ouml;kan!";
			sIcon = "navigation/icon_menu_mygroups.gif";
			break;
		case ifKickMessage:
			sFlashTitle = "Viktigt meddelande";
			sLinkTitle = "Logga ut!";
			sIcon = "icon_fav_green.gif";
			silent = true;
			break;
		case ifBookmark:
			sFlashTitle = sSubject;
			sLinkTitle = "L&auml;s inl&auml;gg!";
			sIcon = "icon_tip.gif";
			break;
		case ifTemporaryLockout:
			sFlashTitle = "Viktigt meddelande";
			sLinkTitle = "Jag vill fortsätta!";
			sIcon = "icon_fav_green.gif";
			silent = true;
			break;
	}
	
	if(silent)
	{
		if( iFlashType == ifKickMessage )
		{
			top.location.replace("/docs/login/logout.aspx");
		}
		else if( iFlashType == ifTemporaryLockout )
		{
			top.location.replace("/docs/login/tempkickout.aspx");
		}
	}
	else
	{
		sHTML = '<div id="oFlash" onclick="this.style.display=\'none\'" style="filter:progid:DXImageTransform.Microsoft.Alpha( opacity=0 );overflow:hidden;background-color:#E6E6E6;border: 1px solid #666666;font:8pt verdana;position:absolute;top:' + t + 'px;left:'+ l + 'px;width:' + w + 'px;text-align:left;padding:4px; color:#000000;">' + 
				'<table border="0" cellpadding="2" cellspacing="0" width="100%" height="100%">' +
				'<tr><td width="1" valign="top"></td>' +
				'<td width="100%" valign="top"><b>' + sFlashTitle + '</b><br>';
				
		if(iType >=3 && iType <= 7) sHTML += 'Fr&aring;n: ' + sFromUserName + '<br>';
		
		sHTML += '<br>' + sMessage + '<br><br></td>' +
				'<td width="10" valign="top"><span style="cursor: hand; font-family: marlett;">r</span></td>' +
				'</tr><tr>' +
				'<td colspan="3">';
				
		if(iType != 1 && iType != 2 && iType != 8 && iMessageID > 0)
		{
			sHTML += '<a href="javascript:void user_markAsRead(' + iMessageID + ')"><img src="/docs/login/icons/read.gif" width="14" height="14" border="0" alt="Markera som läst" align="absmiddle"></a>&nbsp;';
			sHTML += '<a href="javascript:void user_deleteNote(' + iMessageID + ')"><img src="/images/icon_fav_tabort.gif" width="17" height="14" border="0" alt="Ta bort meddelande" align="absmiddle"></a>&nbsp;';
		}
				
		sHTML += '&nbsp;&raquo; <a class="InfoFlashLink" href="' + sActionURL + '"' +
				((iType != 1 && iType != 2 && iType != 8 && iMessageID > 0) ? ' onclick="user_markAsRead(' + iMessageID + ')"' : '') + 
				'>' + sLinkTitle + '</a><br>' +
				'</td></tr></table></div>';
	
		if( document.all["oFlash"] )
			document.all["oFlash"].outerHTML = sHTML;
		else
			body.insertAdjacentHTML( "beforeEnd", sHTML );
	
		oFlash = document.all["oFlash"];
		h = oFlash.offsetHeight;
		oFlash.style.posHeight = h;
	
		fadeFlash(92, iAddOpacity);
	}
}

var currentOpacity = 0;

function fadeFlash(finishOpacity, addOpacity)
{
	var delay = 100;
	
	if(bFadeFlash)
	{
		currentOpacity += addOpacity;
		if(currentOpacity > finishOpacity) currentOpacity = finishOpacity;
	}
	else
	{
		if(addOpacity > 0)
			currentOpacity = finishOpacity;
		else
			currentOpacity = 0;
	}			
	
	if(currentOpacity <= 0 || oFlash.style.display == "none") { 
		currentOpacity = 0;
		hideFlash();
		return;
	}
	
	oFlash.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + currentOpacity + ")";
	
	if((currentOpacity < finishOpacity) && (addOpacity > 0))
	{
		setTimeout("fadeFlash(" + finishOpacity + ", iAddOpacity)", delay);
	}
	else if((currentOpacity >= finishOpacity) && (addOpacity > 0))
	{
		setTimeout("fadeFlash(" + finishOpacity + ", -iAddOpacity)", iDuration * 1000);
	}
	else if((currentOpacity > 0) && (addOpacity < 0))
	{
		setTimeout("fadeFlash(" + finishOpacity + ", -iAddOpacity)", delay);
	}
}

function resizeFlash( h, s ) {
	
	if( !isIE5(  ) )
		return( false );
	
	if( oFlash.style.display == 'none' )
		return;
		
	oFlash.style.posHeight += s;
	
	if( s > 0 ) {
		if( oFlash.style.posHeight < h )
			setTimeout( "resizeFlash( " + h + ", " + s + " )", 20 );
		else
			setTimeout( "resizeFlash( " + h + ", -3 )", 10000 );
	} else {
		if( oFlash.style.posHeight > Math.abs( s ) )
			setTimeout( "resizeFlash( " + h + ", " + s + " )", 20 );
		else {
			hideFlash();
			if( iFlashType == ifChatInvitation )
				top.openChatInvitationPopup( oFlash.innerHTML );
		}
	}
}

function hideFlash(  ) {
	oFlash.style.display = "none";
}

function openChatInvitationPopup(html)
{
	var ms = new Date();
	window.open("/docs/chat/chatpopup.aspx?html=" + escape(html), "chatpopup" + ms.getMilliseconds(), "width=400,height=200,menubar=no");
}

function openKickPopup(html)
{
	var ms = new Date();
	window.open("/docs/misc/kickpopup.aspx?html=" + escape(html), "kickpopup" + ms.getMilliseconds(), "width=400,height=200,menubar=no");
}

function viewImage( sUrl ) {
	var fileID = sUrl.substring( sUrl.lastIndexOf( "=" ) + 1 );
	window.open( "/readfile.aspx?intFileID=" + fileID, "file" + fileID, "width=500, height=400, toolbar=no, menubar=yes, resizable=yes, scrollbars=auto" );
}

function setFrameSize(  ) {
	var iLW, iH, iRW;
	
	iLW = 285;
	iH = document.body.clientHeight - 114;
	iRW = document.all["oMainTD"].offsetWidth - iLW;
	
	document.all["fraLeft"].width = iLW;
	document.all["fraLeft"].height = iH;
	
	document.all["fraRight"].width = iRW;
	document.all["fraRight"].height = iH;
}

function switchToLight()
{
	top.location.href = "/light/";
}

function initFrames()
{
	//top.frames["fraLeft"].location.href = "/docs/message/listthreads.aspx";
	top.frames["fraRight"].location.href = "/docs/information/welcome.aspx";
}

function checkFrames()
{
	var left = top.frames["fraLeft"].document;
	if(!left || !left.body || left.body.childNodes.length == 0)
		top.frames["fraLeft"].location.href = "/docs/message/listthreads.aspx";
	
	var right = top.frames["fraRight"].document;
	if(!right || !right.body || right.body.childNodes.length == 0)
		top.frames["fraRight"].location.href = "/docs/information/welcome.aspx";
}
	

function debugFrames()
{
	alert("Inläggsframen\n=================================================\nKopiera innehållet med Ctrl+C och klistra in i Notepad. Spara som en textfil och skicka till Johan.\n\n" +
		"location.href: " + top.frames["fraLeft"].location.href + "\n" +
		"src: " + document.all["fraLeft"].src + "\n" +
		"HTML: " + document.all["fraLeft"].outerHTML + "\n")
		
	alert("Högerframen\n=================================================\nKopiera innehållet med Ctrl+C och klistra in i Notepad. Spara som en textfil och skicka till Johan.\n\n" +
		"location.href: " + top.frames["fraRight"].location.href + "\n" +
		"src: " + document.all["fraRight"].src + "\n" +
		"HTML: " + document.all["fraRight"].outerHTML + "\n")
		
	alert(top.frames["fraLeft"].document.all.tags("HTML")[0].outerHTML)
}

var favboxMode = 0;
function toggleFavBox(offset)
{
	var chatToggleEnabled = document.getElementById("ToggleChatButton") != null;
	var favBox = document.getElementById("sideBar");
	if(offset < 0 && favboxMode > -1)
		favboxMode--;
	else if(offset > 0 && favboxMode < 1)
		favboxMode++;
	
	if(chatToggleEnabled) {
		if(OnlineFavorites.style.display == "none")
			ToggleChatButton.src = "images/SideBox_Favorites.png"
		else
			ToggleChatButton.src = "images/SideBox_Chat.png"
	}
	
	switch(favboxMode)
	{
		case -1:
			favBox.style.display = "";
			favBox.style.width = "220px";
			favBox.firstChild.style.width = "207px";
			
			if(chatToggleEnabled) {
				if(GlobalChat.style.display == "none")
					ToggleChatButton.src = "images/SideBox_Favorites_Long.png"
				else
					ToggleChatButton.src = "images/SideBox_Chat_Long.png"
			}
			else {
				AnonChatButton.src = "images/SideBox_Anon_Long.gif"
			}
			break;
		case 1:
			favBox.style.display = "none";
			break;
		default:
			favBox.style.display = "";
			favBox.style.width = "150px";
			favBox.firstChild.style.width = "137px";
			
			if(chatToggleEnabled) {
				if(GlobalChat.style.display == "none")
					ToggleChatButton.src = "images/SideBox_Favorites.png"
				else
					ToggleChatButton.src = "images/SideBox_Chat.png"
			}
			else {
				AnonChatButton.src = "images/SideBox_Anon.gif"
			}
			break;
	}
	
	if(isIE5())
		setFrameSize();
}

