/*
+++++++++++++++++++++++++++++++++++++++++++
++ Thanks Mod for UcoZ Forum             ++
++ Author: Alexeenko Ivan aka Vanofuture ++
++ Web-Page: http://xonline.net.ru/      ++
++ Do not remove or edit lines above!    ++
+++++++++++++++++++++++++++++++++++++++++++
*/

function searchForThanks(postId){
$.post('/blog/',{a:13,query:'post'+postId+'post'},function(data){
$('span.thankData',data).each(function(){
userVars=this.innerHTML.split('|');
checkThank(userVars[0],userVars[1],postId);});});}

function checkThank(uid,user,postId){
found=false;
$('#thankArea'+postId+' a').each(function(){
if(this.href=='http://'+location.host+'/index/8-'+uid){
found=true;}});
if(found!=true){setThank(uid,user,postId);}}

function setThank(uid,user,postId){
document.getElementById('thankArea'+postId).style.display='';
document.getElementById('thankArea'+postId).getElementsByTagName('td')[1].innerHTML+='<a href="http://'+location.host+'/index/8-'+uid+'" target="_blank" class="link">'+user+'</a>, ';}

function preAddThank(postId,uid){
foundAdd=false;
$('#thankArea'+postId+' a').each(function(){
if(this.href=='http://'+location.host+'/index/8-'+uid){
foundAdd=true;}});
if(foundAdd!=true){
addThank(uid,postId)}else{alert('Ошибка: вы уже благодарили за этот пост.');}}

function addThank(uid,postId){
$.get('/blog/0-0-0-0-1',{},function(data){
data=$('input[name="ssid"]',data).val();
$.post('/blog/',{jkd498:1,jkd428:1,title:'post'+postId+'post',a:2,ssid:data,numi:1},function(xml){text=$('*:first',xml).text();if(text.indexOf('Материал успешно добавлен')!=-1){setThank(uid,cur_user,postId);}});});}