function win_open(hght, wdth) {
    var d = window.document;
    var winHeight = 0;
    if (typeof window.innerHeight!='undefined') {
        winHeight = window.innerHeight;
    } else {
        if (d.documentElement && typeof d.documentElement.clientHeight!='undefined' && d.documentElement.clientHeight!=0) {
            winHeight = d.documentElement.clientHeight;
        } else {
            if (d.body && typeof d.body.clientHeight!='undefined') { winHeight = d.body.clientHeight; }
        }
    }
    now = new Date();
    win_width = wdth+40+20;
    win_heght = hght+200;
    if (win_heght > winHeight) { win_heght = winHeight; }
    return window.open('', now.getTime(), 'width=' + win_width + ', height=' + win_heght + ', menubar=yes, scrollbars=yes');
}

function navigation_map(hght, wdth, src) {
    newWindow = win_open(hght, wdth);
    newWindow.location.replace(src);
}

function bigPhoto(hght, wdth, img_tag, date_str, desc_str, file_str, lang) {
    alt = 'Фото пресс-службы Президента России';
    if (img_tag.indexOf('alt="') >= 0) {
      alt = img_tag.substring(img_tag.indexOf('alt="')+5);
      alt = alt.substring(0, alt.indexOf('"'));
    }
    newWindow = win_open(hght, wdth);
    var str = '<html><head>\n'+
              '<title>' + ((lang=='English')?'President of Russia':'Сайт Президента России') + '</title>\n'+
              '<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>\n'+
              '<style type="text/css">\n'+
              '* {margin:0; padding:0}\n'+
              '.text_under_photo {font:10px Arial, sans-serif; color:#666666; text-decoration:none}\n'+
              '.linkgrey {font:12px Arial, sans-serif; color:#666666}\n'+
              '</style>\n'+
              '</head>\n'+
              '<body>\n'+
              '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">\n'+
              '<tr><td height="15"><img src="/images/cp.gif" width="1" height="15" border="0" alt="" /></td></tr>\n'+
              '<tr><td height="1" bgcolor="#d4d4d4"><img src="/images/cp.gif" width="100%" height="1" border="0" alt=""/></td></tr>\n'+
              '<tr><td height="10"><img src="/images/cp.gif" width="1" height="10" border="0" alt=""/></td></tr>\n'+
              '<tr><td align="center" valign="top">\n'+
              '    <table width="' + wdth + '" border="0" cellpadding="0" cellspacing="0">\n'+
              '    <tr><td align="center" valign="top" height="' + hght + '">' + img_tag + '</td></tr>\n'+
              '    <tr><td align="right" class="text_under_photo">' + alt + '<br/></td></tr>\n'+
              '    <tr><td class="linkgrey" valign="top">\n';
   if (date_str != '') { str += '        <b>' + date_str + '</b><br/>\n'; }
   if (desc_str != '') { str += '        ' + desc_str + '<br/>\n'; }
   if (file_str != '') { str += '        ' + file_str + '<br/>\n'; }
   str +=     '        <img src="/images/photo_logo' + ((lang=='English')?'_eng':'') + '.gif" width="156" height="31" border="0" align="right" alt="" style="margin-top:10px"/>\n'+
              '    </td></tr>\n'+
              '    </table>\n'+
              '</td></tr>\n'+
              '<tr><td height="1" bgcolor="#d4d4d4"><img src="/images/cp.gif" width="100%" height="1" border="0" alt=""/></td></tr>\n'+
              '<tr><td height="15"><img src="/images/cp.gif" width="1" height="15" border="0" alt=""/></td></tr>\n'+
              '</table>\n'+
              '</body></html>\n';
    newWindow.document.writeln(str);
    newWindow.document.close();
}

function getImgTagWSize(file, alt,  hght, wdth ) {
    return '<img src="' + file + '" border=0 alt="' + alt + '" height="' + hght + '" width="' + wdth + '" />';
}

function getFileTag(file_url, ext, size, lang) {
    if (lang == 'English') {
        return '<a href="' + file_url + '" target="_blank"><img border="0" hspace="1" vspace="1" alt="hirez image" src="/images/quality_photo_eng.gif" height="42" width="175"><br/><span class="linkgrey">(format - ' + ext + ' / size - ' + size + ' kb)</span></a>';
    }
    return '<a href="' + file_url + '" target="_blank"><img border="0" hspace="1" vspace="1" alt="изображение высокого разрешения" src="/images/quality_photo.gif" height="42" width="175"><br/><span class="linkgrey">(формат - ' + ext + ' / размер - ' + size + ' kb)</span></a>';
}