 function lib_open_img_window(src,width,height){ 
   if(width==0)
     width=500;
   width+=20;
   if(height==0)
     height=400;
   height+=20;
   if(height>600)
     height=600;
   var left = (screen.availWidth/2) - (width/2);
   var top = (screen.availHeight/2) - (height/2);
   info=window.open('/img_preview.php?src='+src,'info','resizable=1, scrollbars=1, toolbar=0, status=0, width='+width+', height='+height+', left='+left+', top='+top);
   info.focus();
 }
var lastReplyBoxId = 0;

function showReplyForm(id) {
    var replyBox = document.getElementById('reply_box' + id);
    var replyForm = document.getElementById('form' + id);
    if (lastReplyBoxId) {
        document.getElementById('reply_box' + lastReplyBoxId).style.display = 'none';
    }
    replyBox.style.display = 'block';
    lastReplyBoxId = id;
    if (replyForm.elements['author'].value == '') {
        replyForm.elements['author'].focus();
    } else {
        replyForm.elements['text'].focus();
    }
}

 function open_descr(id){
   width=450;
   height=500;
   var left = (screen.availWidth/2) - (width/2);
   var top = (screen.availHeight/2) - (height/2);
   info=window.open('/stats_table/'+id,'info','resizable=1, scrollbars=1, toolbar=0, status=0, width='+width+', height='+height+', left='+left+', top='+top);
   info.focus();
 }
 
  function open_members(id){
   width=600;
   height=700;
   var left = (screen.availWidth/2) - (width/2);
   var top = (screen.availHeight/2) - (height/2);
   info=window.open('/users.php?popup=Y&id='+id,'info','resizable=1, scrollbars=1, toolbar=0, status=0, width='+width+', height='+height+', left='+left+', top='+top);
   info.focus();
 }
 
  function OpenMatchStat(id){
   width=800;
   height=500;
   var left = (screen.availWidth/2) - (width/2);
   var top = (screen.availHeight/2) - (height/2);
   info=window.open('http://www4.marathonbet.com/tab_3t.phtml?event='+id,'info','resizable=1, scrollbars=1, toolbar=0, status=0, width='+width+', height='+height+', left='+left+', top='+top);
   info.focus();
 }
 
 function windowPopup(wUrl, wWidth, wHeight, wScrolls) 
{
    var xPos = (screen.availWidth  / 2) - (wWidth / 2);
    var yPos = (screen.availHeight / 2) - (wHeight / 2);
    if (!wScrolls) {
        wScrolls = 'yes';        
    } else {
        wScrolls = 'no';
    }
    window.open(wUrl, '', 'directories=no,location=no,menubar=no,resizable=yes,scrollbars='+wScrolls+',status=no,toolbar=no,width='+wWidth+',height='+wHeight+',left='+xPos+',top='+yPos);
}

function open_komand(id){
   width=600;
   height=700;
   var left = (screen.availWidth/2) - (width/2);
   var top = (screen.availHeight/2) - (height/2);
   info=window.open('/komand_get.php?popup=Y&id='+id,'info','resizable=1, scrollbars=1, toolbar=0, status=0, width='+width+', height='+height+', left='+left+', top='+top);
   info.focus();
 }
