
var CertPreviewsTimers={};
var CurrentCertPrev = null;

function ShowCertPrev(cert)
{
    var certBlockId = "cert_"+cert+"_block";

    var smallCertImageId = "cert_"+cert+"_smallimage";
    var bigCertImageId = "cert_"+cert+"_bigimage";
    if (CurrentCertPrev!=null && CurrentCertPrev.id != certBlockId)
    {
        Element.hide(CurrentCertPrev);
        CurrentCertPrev = null;
    }

    if ( typeof(CertPreviewsTimers[certBlockId])!='undefined' && CertPreviewsTimers[certBlockId]!=null)
    {
        clearTimeout(CertPreviewsTimers[certBlockId]);
        CertPreviewsTimers[certBlockId]=null;
    }

    var smallCertImage = $(smallCertImageId);
    var pos = Position.positionedOffset(smallCertImage);

    var pp = $(certBlockId);

//                           alert(bigCertImageId);
    var biWidth = Number($(bigCertImageId).style.width.replace(/px$/,""));

    if (biWidth==0) biWidth=288;
    pp.style.top=pos[1] + 20 +"px";
    pp.style.left=pos[0] - biWidth +80 +"px";
    CurrentCertPrev = pp;
    Effect.Appear(pp, {duration: 0.3});
}

function HideCertPrev(cert)
{
    var certBlockId = 'cert_'+cert+'_block';
    var pp = $(certBlockId);
    CertPreviewsTimers[certBlockId]=setTimeout(function(){ Effect.Fade(pp, {duration: 0.3}); }, 1000);
}

