/*
* Generate an HTML block with links to delivery page and to Podmailing main website.
* Copyright (c) zSlide 2008
* Written by Quentin Harnay and Alexandre Leroy
*/

function gen_download_widget_240_85(filename, size, thumbnail, server, message_hash){
    code = new String("");
    code.toString = function() {
        base_url = 'http://file-sharing.vipeers.com';
        dl_url = 'http://'+server+'/file_sharing?message_hash='+message_hash+'&locale=en';
        return '<div style="background:url('+base_url+'/download.png); width:240px; height:85px; position:relative; font-family:arial,helvetica,clean,sans-serif;">'+
               '<a href="http://www.vipeers.com/" style="text-decoration: none;cursor: pointer;" '+
                'alt="'+unescape("File sharing &amp; Torrent hosting by VIPeers")+'" '+
                'title="'+unescape("File sharing &amp; Torrent hosting by VIPeers")+'" '+
                'target="_blank">'+
                '<div style="background:url('+base_url+'/download.png) no-repeat -80px -1px; width:157px; height:19px; position:absolute; top:1px; right:3px;">&nbsp;</div>'+
               '</a>'+
               '<div style="position: absolute; left: 2px; top: 0px;">'+
               '<div style="width:64px; height:64px; display:table-cell; vertical-align:middle; text-align:center; line-height:64px;">'+
               '<span style="display: inline-block;"></span>'+
               '<a href="'+dl_url+'" alt="'+
               unescape("Download this file") +'" title="'+
               unescape("Download this file") +'" '+
               'target="_blank">'+
               '<script type="text/javascript">'+
               'function onthumbloaded(thumb){'+
               'if (thumb.height > thumb.width)'+
               '{thumb.width=thumb.width/thumb.height*64; thumb.height=64;}'+
               'else if (thumb.width > thumb.height)'+
               '{thumb.height=thumb.height/thumb.width*64; thumb.width=64;}'+
               'else {thumb.width=64; thumb.height=64;}'+
               ';}'+
               'document.write(\'<img style="border: 0px none; vertical-align: middle;" src="'+thumbnail+'" onload="onthumbloaded(this);" />\');'+
               '</script>'+
               '</a></div></div>'+
               '<div style="padding:25px 2px 2px 70px; font-size:11px;">'+filename+'</div>'+
               '<div style="font-size: 10px; position:absolute; bottom:4px; left:4px; width:140px; text-align: center;">'+
               unescape("Size:")+' '+size +'</div>'+
               '<a href="'+dl_url+'" style="text-decoration:none; cursor:pointer;" alt="'+
               unescape("Download this file") + '" title="'+
               unescape("Download this file") + '" '+
               'target="_blank">'+
               '<div style="background:url('+base_url+'/download.png) no-repeat -145px -61px; width:93px; height:22px; position:absolute; bottom:2px; right:2px;">&nbsp;</div></a></div>';
    };
    document.write(code);
}
