function smile(str){
	obj = document.Sad_Raven_Guestbook.mess;
	obj.focus();
	obj.value =	obj.value + str;
}
function openBrWindow(theURL,winName,features){
  	window.open(theURL,winName,features);
}
function inserttags(st_t, en_t){ 
	obj = document.Sad_Raven_Guestbook.mess;
	obj2 = document.Sad_Raven_Guestbook;
	if ((document.selection)) {
		obj.focus();
		obj2.document.selection.createRange().text = st_t+obj2.document.selection.createRange().text+en_t;
	}
	else 
	{
		obj.focus();
		obj.value += st_t+en_t;
	}
}

function gebi(id) {return document.getElementById(id);}

document.onclick = function() {
	gebi("help_div").style.display = "none";
}

function absPosition(obj) { // Опрелеляем top - left координаты блока obj
	this.x = 0;
	this.y = -150;
    while(obj) {
		this.x += obj.offsetLeft;
		this.y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return {x:this.x,y:this.y};
}

//alert (helpDate.length);

function clear_help(evt) {
	evt = evt || window.event;
	evt.cancelBubble = true;
	gebi("help_div").style.display = "none";
}
function contHelp (img, evt, id, rgt) {
	evt = evt || window.event;
	evt.cancelBubble = true;

	if (rgt)
		var rightFlag = true;
	else {
		var rightFlag = false;
		var bodyWidth = (window.innerWidth) ? window.innerWidth : window.document.body.clientWidth;
		if (bodyWidth - absPosition(img).x < 350) rightFlag = true;
	}

	var targetDiv = gebi("help_div");
	if(img && targetDiv) {
		gebi("help_div").className = "help_div";
		gebi("help_div").innerHTML=helpDate[id];
		var xRemainder = (rightFlag) ? -291 : 0;
		gebi("help_div").style.top = absPosition(img).y-2 + "px";
		gebi("help_div").style.left = absPosition(img).x + xRemainder + "px";
		gebi("help_div").style.display = "";
	}
	return false;
} 