var dhstats;
function showstatusmenu()
{
	clearTimeout(dhstats);
	document.getElementById('myln_submenu').style.display='block';
	document.getElementById('myln_messages').style.display='none';
	document.getElementById('myln_buddylist').style.display='none';
}

function hidestatusmenu()
{
	document.getElementById('myln_submenu').style.display='none';
	document.getElementById('myln_messages').style.display='block';
	document.getElementById('myln_buddylist').style.display='block';
}

function delayhidestatusmenu()
{
	clearTimeout(dhstats);
	dhstats = setTimeout("hidestatusmenu()", 400);
}

function showhide(obj) {
	if (document.getElementById(obj)) {
		if(document.getElementById(obj).style.display == 'none') {
			document.getElementById(obj).style.display = 'block';
		}
		else {
			document.getElementById(obj).style.display = 'none';
		}
	}
}

/******
 * Author: Sebastian Haller
 * Date: 2005
 * Div Control Class
 */

function divcrtl(name, hidedelay, objname)
{
	// hide it when user clicks
  var oldfunc = document.onclick;
  if (typeof oldfunc != 'function')
  {
		document.onclick = function() {eval(name+'.hide();');};
  }
  else
  {
    document.onclick = function()
	    {
	      oldfunc();
	      eval(name+'.hide();');
	    };
  }
	
	this.name = name; // name of object you are creating
	this.hidedelay = hidedelay; // hide how many miliseconds after onmouseout
	this.objname = objname;
	this.obj = null;
	
	this.op = window.opera;
	this.ie = document.all && !this.op;
	this.ns = document.getElementById && !this.ie && !this.op;
	
	this.timeout = null;
	if (this.ie)
	{
		document.write('<iframe id="iframe_'+objname+'" name="iframe_'+objname+'" src="/img/blank.gif"  style="position: absolute; left:0; top:0; width:0; height:0; visibility:hidden; filter:alpha(opacity=0); z-index: 1"></iframe>');
		this.iframeobjname = 'iframe_'+objname;
		this.iframeobj = null;
	}

	this.cancelbubble =
		function(e)
		{
			if (window.event)
				event.cancelBubble=true;
			else if (e.stopPropagation)
				e.stopPropagation();

			return false;
		};

	this.hide =
		function()
		{
			if (this.obj == null)
				return false;
		
			this.obj.style.left = this.obj.style.top = -500;
			this.obj.style.visibility = 'hidden';
		
			if (this.ie)
				this.iframeobj.style.visibility = 'hidden';

			clearTimeout(this.timeout);

			return false;
		};

	this.delayhide =
		function()
		{
			clearTimeout(this.timeout);

			if (this.hidedelay > 0)
				this.timeout = setTimeout(this.name+'.hide()', this.hidedelay);

			return false;
		};
	
	this.swap =
		function(obj, e, content, width)
		{
			this.obj = document.getElementById(this.objname);
			if (this.ie)
				this.iframeobj = document.getElementById(this.iframeobjname);
		
			this.cancelbubble(e);

			if (window.event)
				event.cancelBubble=true;
			else if (e.stopPropagation)
				e.stopPropagation();
			
			if (e.type=="click" && (this.obj.style.visibility=='hidden' || this.obj.style.visibility=='') || e.type=="mouseover")
				this.show(obj, content, width);
			else if (e.type=="click")
				this.hide();
		
			return false;
		};

	this.show =
		function(obj, content, width)
		{
			this.obj = document.getElementById(this.objname);
			if (this.ie)
				this.iframeobj = document.getElementById(this.iframeobjname);
		
			this.obj.innerHTML = content;
			if (width != '')
				this.obj.style.width = width;
			
			this.obj.style.left = this.obj.style.top = -500;
			this.obj.style.left = this.getoffset(obj, 'x') + "px";
			this.obj.style.top = this.getoffset(obj, 'y') + obj.offsetHeight + "px";
		
			this.obj.style.visibility = 'visible';
		
			if (this.ie)
			{
				this.iframeobj.style.left = this.obj.style.left;
				this.iframeobj.style.top = this.obj.style.top;
				this.iframeobj.style.width = this.obj.offsetWidth;
				this.iframeobj.style.height = this.obj.offsetHeight;
				this.iframeobj.style.visibility = 'visible';

			return false;
			}

			clearTimeout(this.timeout);
		};
	
	this.iecompat =
		function()
		{
			return (document.compatMode && document.compatMode != 'BackCompat') ? document.documentElement : document.body;
		};

	this.getoffset =
		function(obj, which)
		{
			var offset = (which == 'x') ? obj.offsetLeft : obj.offsetTop;
			var parent = obj.offsetParent;
			while (parent!=null)
			{
				offset += (which == 'x') ? parent.offsetLeft : parent.offsetTop;
				parent = parent.offsetParent;
			}
			
			// check, if there is enough space in the broser
			if (which == 'x')
			{
				var windowedge = this.ie ? this.iecompat().scrollLeft+this.iecompat().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
				if (windowedge-offset < this.obj.offsetWidth)
					offset -= this.obj.offsetWidth - obj.offsetWidth;
			}
			else
			{
				var topedge = this.ie ? this.iecompat().scrollTop : window.pageYOffset;
				var windowedge = this.ie ? this.iecompat().scrollTop+this.iecompat().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
				if (windowedge-offset < this.obj.offsetHeight)
				{
					offset -= this.obj.offsetHeight + obj.offsetHeight;
					if (offset-topedge < this.obj.offsetHeight)
						offset = topedge - obj.offsetHeight;
				}
			}
		
			return offset;
		};

	this.hidedynamic =
		function(e)
		{
			if (this.ie && !this.obj.contains(e.toElement))
				this.delayhide();
			else if ((this.ns || this.op) && e.currentTarget!=e.relatedTarget && !this.contains_ns(e.currentTarget, e.relatedTarget))
				this.delayhide();

			return false;
		};

	this.contains_ns =
		function(a, b)
		{
			while (b.parentNode)
				if ((b = b.parentNode) == a)
					return true;
			return false;
		};
	return true;
}


self.name="ln-page";
if(top!=self) {
	top.location=self.location
}
function show() {
	if(document.F.userm.value != "") {
		window.location = "index.php?db=community&sub=user&id="+document.F.userm.value;
	}
	if(document.F.userw.value != "") {
		window.location = "index.php?db=community&sub=user&id="+document.F.userw.value;
	}
}
function resize() {
	for(i=0;i<document.getElementsByTagName("img").length; i++) {
		if (document.getElementsByTagName("img")[i].id == 'ext') {
			if (document.getElementsByTagName("img")[i].width > 380 || document.getElementsByTagName("img")[i].height > 380) {
				if(document.getElementsByTagName("img")[i].width >= document.getElementsByTagName("img")[i].height) {
					document.getElementsByTagName("img")[i].width = 380;

					document.getElementsByTagName("img")[i].height = Math.ceil((380 * document.getElementsByTagName("img")[i].height) / document.getElementsByTagName("img")[i].width );
				}
				else {
					document.getElementsByTagName("img")[i].width = Math.ceil((380 * document.getElementsByTagName("img")[i].width) / document.getElementsByTagName("img")[i].height );

					document.getElementsByTagName("img")[i].height = 380;
				}
			}
		}
	}
}
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) 
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
function textCounter_shoutbox(field, countfield, maxlimit) {
if (field.value.length > maxlimit) 
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
