/*  Copyright © 2006-2010 by Walerian "Cobra" Walawski - http://walerian.info/
 *  Feel free to use code below however you'd like, but please keep this comment intact.
 */

// StatCounter
var sc_project=5626467;
var sc_invisible=1;
var sc_partition=60;
var sc_click_stat=1;
var sc_security="57f8a50f";

// Let's make document.getElementById shorter ;-) (by-id)
function bid(name)
{
	return document.getElementById(name);
}

// <body> onload
function postLoad()
{
	toolTip();
}
window.onload = postLoad;

// Cancel if too short...
function cancelIfTooShort(tag,require)
{
	if(tag.value.length<require)
	{
		return false;
	}
}

// Tooltip
function toolTip()
{
	// Check
	for(var i=0,d,dE,D=document,span;d=D.getElementsByTagName('*')[i++];)
	{
		if(d.getAttribute('title'))
		{
			d.onmouseover=function(e)
			{
				if(this.getAttribute('title')!=undefined)
				{
					// Tags
					var inner=this.getAttribute('title');
					var inner=inner.replace(/\[n\]/g,'<br>');
					var inner=inner.replace(/\[b=(.*)\]/g,'<b>$1</b>');
					var inner=inner.replace(/\[img=(.*)\]/g,'<img src="$1" alt="X">');
					
					// Add tooltop
					var e=e||event;
					box=D.createElement('span');
					box.id='tooltip';
					box.innerHTML=inner;
					with(box.style)
					{
						position='absolute';
						top=e.clientY+(dE=D.documentElement).scrollTop+15+'px';
						left=e.clientX+dE.scrollLeft+15+'px';
					}
					// Old box? (Gecko [maybe not only] bug) - part 1
					if(this.title!=null&&this.title!='')
					{
						this.title_ex=this.title;
					}
					this.title='';
					D.body.appendChild(box);
				}
			}
			d.onmouseout=function()
			{
				if(this.getAttribute('title')!=undefined&&this.title_ex!=undefined)
				{
					this.title=this.title_ex;
					D.body.removeChild(box);
					// Old box? (Gecko [maybe not only] bug) - part 2
					if(bid('tooltip')!=null)
					{
						D.body.removeChild(bid('tooltip'));
					}
				}
			}
		}
	}
}

