function EmbedVideo(video, img, width, height)
{
    var flashvars = {};
    flashvars.videoPath = video;
    flashvars.imagePath = img;
    flashvars.viewInfoButton = "false";
    flashvars.viewFullscreenButton = "false";
    flashvars.viewScaleButton = "false";
    flashvars.viewVolumeControls = "false";
    flashvars.viewTime = "true";
    flashvars.viewBigPlayButton = "true";
    flashvars.videoLoop = "true";
    flashvars.videoAutoPlay = "true";
    flashvars.videoBufferTime = "10";
    flashvars.color1 = "0x5a3444";
    flashvars.color2 = "0x351b25";
    flashvars.alpha1 = "1";
    flashvars.alpha2 = "1";
    flashvars.tlInterval = "100000";
    flashvars.soundVolume = "1";
    flashvars.controlHeight = "22";
    flashvars.borderColor = "0x000000";
    flashvars.borderAlpha = "0";
    flashvars.filterAlpha = "0";
    flashvars.buttonColor = "0xefefef";
    flashvars.spacing = "2";
    flashvars.timeTextColor1 = "0xefefef";
    flashvars.timeTextColor2 = "0x888888";
    flashvars.scrubberHeight = "2";
    flashvars.scrubberColor1 = "0x000000";
    flashvars.scrubberAlpha1 = "1";
    flashvars.scrubberColor2 = "0xfcef37";
    flashvars.scrubberAlpha2 = "1";
    flashvars.fullSizeView = "3";

    var params = {};
    params.scale = "noscale";
    params.allowfullscreen = "false";
    params.allowscriptaccess = "always";
    params.salign = "tl";
    params.wmode = "transparent";

    var attributes = {};

    swfobject.embedSWF("media/videoPlayer.swf", "video", width, height, "9.0.0", false, flashvars, params, attributes);
}

function ShowVideo(url, img, width, height)
{
    $("#videoPlayer").show();
    EmbedVideo(url, img, width, height);
}

function CloseVideo()
{
    $("#videoPlayer").hide();
    RecycleSWF("video", "videoPlayer");
}
function replaceAll(text, strA, strB)
{
    return text.replace( new RegExp(strA,"g"), strB );    
}

$(function()
{       
    if ($(".scrollable").height() > $("#content-body").height())
        $(".scrollable").css("height", $("#content-body").height() + "px"); 
    
    $('.scrollable').jScrollPane({showArrows:true});
    
    $("#mini-gallery > .image a").lightBox({overlayBgColor:"#333"});
    
    $("#mini-gallery > .image").each(function(index, obj){
        var pos = $(this).offset();
        var hei = $(this).height();
        
        var max = $("#content").height() + $("#content").offset().top;
        
        if (pos.top + hei > max)
            $(this).hide();
    });
});
