var fade_timer;
var overlay_conf = {
        top:50,
        mask:"#161616",
        onBeforeLoad:function() {
            if (this.getOverlay().find('.video').length > 0) {
                id = this.getOverlay().find('.video').attr('id').substr(6);
                var params = { allowScriptAccess: "always",allowFullScreen:true };
                var atts = { id: 'video_emb_' + id };

                if (this.getOverlay().find('.video').find('#video_emb_' + id).length == 0) {
                    embdiv = $(document.createElement('div'));
                    embdiv.attr('id','video_emb_' + id);
                    this.getOverlay().find('.video').append(embdiv);
                }
                
                w = 1280
                h = 720
                if ($(window).height() < 900) {
                    w = 720
                    h = 480
                }
                swfobject.embedSWF("http://www.youtube.com/v/" + id + "?enablejsapi=1&playerapiid=video_emb_" + id+"&version=3&hd=1&showinfo=0", 
                                   "video_emb_" + id, w, h, "8", null, null, params, atts);
                
            }
        },
        onLoad:function() {
            this.getOverlay().width(this.getOverlay().find('.fullim').width());
            this.getOverlay().css('left',($(window).width()-this.getOverlay().width())/2);
            curr_overlay = this;
            if (fade_timer != undefined) clearTimeout(fade_timer);
            return true;
        }
    }
var openOverlay = function(id) {
    c = overlay_conf;
    c.load = true;
    $('#i'+id).overlay(c).load();
}

$(function() {
$('.imn').click(function() {
    i = parseInt($(this).attr('id').substr(3));
    if (i == NaN) return;
    c = overlay_conf;
    c.load = true;
    $('#i'+i).overlay(c).load();
});
});

