function send(){

var Message = $('#comment').val();
var Value = $('#comment_value').attr('checked');
var Pid = $('#pid').val();

if(Value ? Value = "1" : Value = "0");

$.post(
'/req/addcomment.php', {
comment:Message,
vote:Value,
pid:Pid
},
addCommentResult
);

}

function addCommentResult(result){
if(result){
var R = $('r', result).text();
if(R == 2) alert('Вы уже оставляли отзыв к этом производителю пенобетона');
var Author = $('author', result).text();
var Comment = $('comment', result).text();
var Value = $('value', result).text();
var this_html = "<b>"+Author+"</b><br />"+Comment+"<br /><br />";
this_html = this_html.replace(/\n/g, '<br />');
$('#new_comment'+Value).html(this_html);
$('#new_comment'+Value).animate({height:'show'}, 500);
}
else alert('Ошибка отправки отзыва');
}

function openId(id){
$('div:visible', '#drafts').animate({height:'hide'}, 300);
$('#draft'+id).animate({height:'show'},700);
}

function enlarge(el){

var url = $('img',el).attr('src')

var topPosition = $('body').scrollTop();
topPosition += 20;

$('<div id="bigimage" style="background:#ffffff; border:1px solid #fe0002; padding:10px 10px 3px; position:absolute; top:'+topPosition+'px; left:20px; color:#fe0002; text-align:center; font-weight:bold; font-family: verdana; cursor:pointer; z-index:15" onclick="closeImage()"><img src="'+url+'" alt="" border="0" /><br />Закрыть</div>').appendTo('body').animate({opacity:'show'},400);
}

function closeImage(){
$('#bigimage').animate({opacity:'hide'}, 400, 'easein', function(){$('#bigimage').remove()});
}
