 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();
 }
function open_window(src, id, 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('/'+src+'?id='+id,'photo','resizable=1, scrollbars=1, toolbar=0, status=0, width='+width+', height='+height+', left='+left+', top='+top);
   info.focus();
 }


function sendVote(id,direct){
    if ( id > 0 && direct != '' ){
        $('#vote_up_'+id).html('<img src="/img/spacer.gif" width="7" height="10" />');
        $('#vote_down_'+id).html('<img src="/img/spacer.gif" width="7" height="10" />');
        $('#vote_up_'+id).addClass('up_str_null');
        $('#vote_down_'+id).addClass('down_str_null');
        
        $.post(
        '/votes.php',
        {
            act: "vote",
            id: id,
            direct: direct
        },
        function (data){
            res_list = data.split("<!--split-->");
            var good = res_list[0];
            var msg = res_list[1];
            if ( good == 'good' ){
                if ( msg > 0 ){
                    $('#vote_data_'+id).attr('class','up_ball');
                }
                else if( msg == 0 ){
                    $('#vote_data_'+id).attr('class','null_ball');
                }
                else{
                    msg = '&minus;'+Math.abs(msg);
                    $('#vote_data_'+id).attr('class','down_ball');
                }
                if ( msg != '' ){
                    $('#vote_data_'+id).html(msg);
                }
            }
            else{
            }
        }
        );
    }
}
