function getFlashVersion(){
   var d, n = navigator, m, f = 'Shockwave Flash';
   if((m = n.mimeTypes) && (m = m["application/x-shockwave-flash"]) && m.enabledPlugin && (n = n.plugins) && n[f]) {d = n[f].description}
   else if (window.ActiveXObject) { try { d = (new ActiveXObject((f+'.'+f).replace(/ /g,''))).GetVariable('$version');} catch (e) {}}
   return d ? d.replace(/\D+/,'').split(/\D+/) : [0,0];
};

function runMovie(src, id, w, h, needFlashVersion, pictureOnNotExistFlash){ 
    if (!needFlashVersion) {
        needFlashVersion = 8;
    }
    
    var ver = new String(getFlashVersion());
    if (ver.indexOf(',') != -1) {
        ver = ver.slice(0, ver.indexOf(','));
    }
    ver = parseInt(ver);

    if (ver >= needFlashVersion) {
        // установлена нужная или выше версия плагина, можно показать флешку
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + needFlashVersion + ',0,0,0" width="' + w +'" height="' + h +'" id="' + id + '" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + src + '" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="' + src + '" quality="high" wmode="transparent" width="' + w + '" height="' + h +'" name="' + id + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
    } else {
        // флеша нет, или старый
        if (!pictureOnNotExistFlash) {
            document.write('Сайт требует поддержки Flash плеера версии не ниже ' + needFlashVersion + '');
        } else {
            document.write(pictureOnNotExistFlash);
        }
    }
}

var winCol = new Date();
function wshow(url, width, height)
{
    if (!width) width = 640;
    if (!height) height = 480;
    window.open(url, (winCol++), 
                'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' 
                + width + 
                ',height=' + height + 
                ',left=' + ((screen.width - width) / 2) + 
                ',top=' + ((screen.height - height) / 2));
    return false;
}
