/**
 * @author Rusk
 */
/*
document.getElementById('ShowLastComments').onclick = function(){
	showById('LastComment', this);
	return false;
}
document.getElementById('LastComment').style.visibility = "hidden"
document.getElementById('LastComment').style.display = "none"
*/
titleFunction = function() {
	this.oldTitle = this.title;
	this.title = ""
	var titleWindowNode = document.createElement('div');
	var titleTextNode = document.createTextNode(this.oldTitle);
	titleWindowNode.setAttribute('id', 'title_' + this.oldTitle);
	titleWindowNode.setAttribute('class', 'titleWindow'); // For FF
	titleWindowNode.setAttribute('className', 'titleWindow'); // For IE
	titleWindowNode.appendChild(titleTextNode);
	document.body.appendChild(titleWindowNode);
	this.onmousemove = function(e) {
		pos = getMousePosition(e);
		titleWindow = document.getElementById('title_' + this.oldTitle);
		
		mouseX = getMousePosition(e)['x'];
		windowX = windowSize('x');
		if (windowX - mouseX < titleWindow.offsetWidth + 35) {
			var margingRight = windowX - mouseX - titleWindow.offsetWidth - 20;
		} else {
			var margingRight = 15;
		}
		
		titleWindow.style.top = pos['y'] + 25 + "px";
		titleWindow.style.left = pos['x'] + margingRight + "px";
	}
	this.onmouseout = function() {
		document.body.removeChild(document.getElementById('title_' + this.oldTitle));
		this.title = this.oldTitle;
		this.onmousemove = function() {
			return false
		}
	}
}
function titleShow(tag) {
	var elems = document.getElementsByTagName(tag);
	for (i=0 ; i<elems.length ; i++) {
		if (elems.item(i).title != "") {
			if(typeof elems.item(i).onmouseover == "function") {
				elems.item(i).oldFunction = elems.item(i).onmouseover;
				elems.item(i).titleFunction = titleFunction;
				elems.item(i).onmouseover = function() {
					this.titleFunction()
					this.oldFunction()
				}
			} else {
				elems.item(i).onmouseover = titleFunction
			}
		}
	}
}
/*
function titleShowAll() {
	titleShow('a')
	titleShow('img')
	titleShow('div')
	titleShow('span')
	titleShow('area')
}
*/
