	var lngSelectedIndex = -1;
	
	function setSearchstatus( o ) {
		document.forms[0].showsearch.value = ( ( o.style.display == "none" ) ? 1 : 0 );
		document.forms[0].submit(  );
	}
	
	function writeMessage(  ) {
		var oWin
		var w, h;
		
		w = 500;
		h = 420;
		
		if ( top.frames["content"] )
			top.frames["content"].focus(  );
			
		oWin = window.open( "write.aspx?intGroupID=" + groupId, "winWrite" + new Date().valueOf(), "width=" + w + ", height=" + h + ", resizable=yes, menubar=no, scrollbars=auto, status=yes, directory=no, buttons=no" )
		oWin.opener = self
	}

	function goToPage( i ) 
	{
		with(document.forms[0]) 
		{
			p.value = "" +i;
			submit();
		}
	}
	
	function runSearch( o ) {
	
		o.p.value = 1;
	
		if( groupId == -2 ) {
			if(!isMember) { 
				alert("Du har precis försökt söka bland alla dina grupper med en sökning. Den funktionaliteten är endast tillgänglig för de medlemmar som betalar Aktieguidens frivilliga medlemsavgift.\n\nDet går, precis som tidigare, bra att gå in i en grupp och söka där." );
				return false;
			} else {
				return true;
			}
		} else if (groupId < 1) {
			alert( "Du kan inte söka bland Mina bokmärken, Mina inlägg och Senaste inläggen i mina grupper." );
			return false;
		} else {			
			return true;
		}
	}
	
	function openGroup( o ) {
		var i = o.options[ o.selectedIndex ].value;
		var j;
		
		if ( i == "" )
			return;
		
		j = i.split( ";" );
		
		j[0] = parseInt( j[0] );
		
		o.form.s.value = "";
		o.form.p.value = "1";
		
		if ( j[0] == -1 ) {
			o.options[ o.selectedIndex ].value = j[0];
		} else if ( j[0] == -2 ) {
			o.options[ o.selectedIndex ].value = j[0];
		} else if ( j[0] == "" ) {
			o.selectedIndex = lngSelectedIndex;
		} else {
			o.options[ o.selectedIndex ].value = j[0];

			if ( j[1].toLowerCase() == "true" ) {
				parent.fraRight.location.href = "/docs/group/welcome.aspx?intGroupID=" + j[0];
				o.form.hp.value = 1;
			} else {
				o.form.hp.value = 0;
			}
		}
		
		o.form.submit(  );
	}
	
	function openGroup2( i ) {
		var j;
		var o = document.forms[0].intGroupID;
		
		if ( i == "" )
			return;

		j = i.split( ";" );
		
		j[0] = parseInt( j[0] );
		
		o.form.s.value = "";
		o.form.p.value = "1";
		
		if ( j[0] == -1 ) {
			o.value = j[0];
		} else if ( j[0] == -2 ) {
			o.value = j[0];
		} else {
			o.value = j[0];
			
			if ( j[1].toLowerCase() == "true" ) {
				parent.fraRight.location.href = "/docs/group/welcome.aspx?intGroupID=" + j[0];
				o.form.hp.value = 1;
			} else {
				o.form.hp.value = 0;
			}
		}
		
		o.form.submit(  );
	}
	
	function resetListBox( o ) {
		if ( o.options[ o.selectedIndex ].value == "" )
			o.selectedIndex = 1;
	}
	
	function refreshImg(  ) {
	}	
	
	function toggleSort( b ) {
		document.forms[0].so.value = ( b ? "1" : "0" );
		document.forms[0].submit(  );
	}
	
	function showLegend(  ) {
		if( !document.all )
			return;

		if( document.all["oLegend"] ) {
			document.all["oLegend"].style.posLeft = event.x + document.body.scrollLeft;
			document.all["oLegend"].style.posTop = event.y + document.body.scrollTop;
			document.all["oLegend"].style.display = "block";
		}
	}
	
	function hideLegend(  ) {
		if( !document.all )
			return;
		
		if( ( event.srcElement == event.toElement ) || ( event.srcElement.contains( event.toElement ) ) ) // || ( event.toElement == oLegend ) )
			return;

		if( document.all["oLegend"] )
			document.all["oLegend"].style.display = "none";
	}
	
	function changeRefreshRate( o ) {
		if ( o.options[ o.selectedIndex ].value == "" )
			return;
		document.forms[0].submit(  );
	}
	
	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.backgroundColor = "#ECECEC";
		}

		with( o.cells[2] ) {
			style.borderRight = "1px solid black";
			style.borderTop = "1px solid black";
			style.borderBottom = "1px solid black";
			style.backgroundColor = "#ECECEC";
		}
	}
	
	function lolight( o, ignoreEvent ) {
		if(ignoreEvent != true)
			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.backgroundColor = "#FFFFFF";
		}
		
		with( o.cells[2] ) {
			style.borderRight = "1px solid white";
			style.borderTop = "1px solid white";
			style.borderBottom = "1px solid white";
			style.backgroundColor = "#FFFFFF";
		}
	}
	
	var flashCounter = 0;
	var closeTimer = null;
	function flashGroup(groupID)
	{
		if(flashCounter < 10)
		{
			if(flashCounter % 2 == 0)
				lolight(document.getElementById("grouptr" + groupID), true);
			else
				highlight(document.getElementById("grouptr" + groupID));
			flashCounter++;
			setTimeout("flashGroup(" + groupID + ")", 500);
		}
		else
		{
			closeTimer = setTimeout("hideDropMenu();", 8000);
		}
	}
	
	
	function openDropMenu( oList, oMenu ) {
		if(closeTimer != null) clearTimeout(closeTimer);
		if( oMenu.style.display != "none" ) {
			hideDropMenu( oMenu );
		} else {
			toggleSelect( "hidden" );
			
			oMenu.style.left = getOffsetLeft( oList );
			oMenu.style.top = getOffsetTop( oList ) + oList.offsetHeight;
			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;
		}
		event.cancelBubble = true;
		
	}
	
	function hideDropMenu( oMenu ) {
		if(closeTimer != null) clearTimeout(closeTimer);
		toggleSelect( "" );
		if( uplevelBrowser ) {
			if( !oMenu ) oMenu = divGroups;
			oMenu.style.display = "none";
		}
	}
	
	function toggleSelect( vis ) {
		var oTags = document.getElementsByTagName( "SELECT" );
		var i;
		
		for( i = 0; i < oTags.length; i++ ) {
			oTags[i].style.visibility = vis;
		}
	}
	
	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 );
	}
	
	function markAsRead()
	{
		var f = document.forms[0];
		f.markAsRead.value = 1
		f.submit();
	}
	
	
