function image_info (id) {
	var T = 0;
	var L = 0;
	var obj = document.getElementById("galery_" + id);
	while (obj.offsetParent) { 
		T += obj.offsetTop; 
		L += obj.offsetLeft;
		obj = obj.offsetParent; 
	}
	with (document.getElementById("galery_alt_" + id).style) { 
		visibility = "visible";
		left = (L - 17) + "px";
		top = (T - 15) + "px";
	}
}
function close_image_info (id) {
	with (document.getElementById("galery_alt_" + id).style) { 
		visibility = "hidden";
	} 
}
function setcookie (name, value, the_time) {
	var expDate = new Date();
	expDate.setTime (expDate.getTime() + (the_time * 60));
	document.cookie = name + "=" + escape (value) + "; expires=" + expDate.toGMTString ();
}
function close_answer (the_id) {
	$('#answer_'+the_id).slideUp('slow');
}
function add_answer (the_id, module, idi){
		var the_form = "<form name='answer' id='answer_form_" + the_id + "' action='' onsubmit=\"update_comments('" + module + "', " + the_id +", " + idi + "); return false;\" method=post><input type=hidden name=parent value='" + the_id + "'><textarea name=com_body rows=2 style='width:90%'></textarea>"+
			 "<br><input type=button value='скрыть' onclick='close_answer(" + the_id + ")'> <input type=submit value='добавить'></form>";
		var the_element = document.getElementById('answer_' + the_id);
		if (the_element.style.display == "none") {
			//the_element.style.display = "";
			the_element.innerHTML = the_form;
			$('#answer_'+the_id).slideDown('slow');
			document.answer.com_body.focus();
		}
		else {
			//the_element.style.display = "none";
			$('#answer_'+the_id).slideUp('slow');
			the_element.innerHTML = "";
		}
}
function update_comments (module, the_id, idi){
		var ajax = new dle_ajax();
		ajax.onShow ("");
		var varsString = "";
		ajax.setVar("id", idi);
		ajax.setVar("parent", the_id);
		ajax.setVar("module", module);
		ajax.setVar("com_body", document.getElementById("answer_form_" + the_id).com_body.value);
		ajax.requestFile = "/include/ajax/update_comments.php";
		ajax.method = "POST";
		ajax.element = "comments_div";
		ajax.sendAJAX(varsString);
}
function reload_captcha () {
	var rndval = new Date().getTime(); 
	document.getElementById('captcha_image').innerHTML = "<img src='/image.php?mod=bot&rnd=" + rndval + "' align='absmiddle' />";
}


$(document).ready(function () {
	$("#userblock").corner();
	$("#content").corner("bl br");
});

