function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
    }
}

$(document).ready(function() {
    var w = $(window).width();
    var h = $(window).height();
    //$("div.VideoContainer").css("margin-top",(h-225)/2 + "px");
    //if (location.href.toLowerCase().indexOf("reel") > -1 || location.href.toLowerCase().indexOf("creative") > -1) {
    if (location.href.toLowerCase().indexOf("gallery") > -1) {
        Shadowbox.init({
            overlayOpacity: 0.8
        }, setupDemos);

        //$("ul.gallery").prettyGallery({ itemsPerPage: 3, animationSpeed: 'normal', navigation: 'bottom' });        
    }
    if (location.href.toLowerCase().indexOf("reel") > -1) {
        $("div.reel_sector").mouseover(function() {
            $(this).css("color", "#ffffff");
        })
        $("div.reel_sector").mouseout(function() {
            $(this).css("color", "#888");
        })
    }
    if (location.href.toLowerCase().indexOf("reel") > -1) {
        $("div.reel_sector2").css("cursor", "pointer");
        $("div.reel_sector2").mouseover(function() {
            $(this).css("color", "#fff");
        })
        $("div.reel_sector2").mouseout(function() {
            $(this).css("color", "#888");
        })
    }
});

function setupDemos() {
    Shadowbox.setup("a.VideoLinks", {
		gallery: "gallery",
        height: 360,
        width: 640,
		continuous: true,
        counterType: "default",
        flashVars: {
            autoplay: "1"
        }
    });
}