$(document).ready(function () {
    $("a.triggoverlay").click(function() { 
        destination = $(this).attr("href");
        cta = $(this).attr("rel");
        $("#overlay a").attr("href", destination);
        flowplayer("a.fplayer","/flowplayer/flowplayer.commercial-3.1.0.swf", { 
            key: '#@b43dbbf2e0c9dbe5a6c', 
            clip: { 
                scaling: 'fit',
                onCuepoint: [[-2000], function() {  
                    if (cta) {
                        var myContent = this.getPlugin("myContent");  
                        myContent.setHtml(cta);
                        myContent.show();
                    }
                }]
            }, 
            canvas: { 
                background: '#333333', 
                backgroundGradient: 'none'
            },
            plugins: { 
                myContent: {
                    url: '/flowplayer/flowplayer.content-3.1.0.swf', 
                    bottom: '30%', 
                    borderRadius: 10,
                    backgroundColor: '#0084c9',
                    opacity: 1,
                    display: 'none',
                    style: { 
                        'p': { fontSize: 16, fontWeight: 'bold' },
                        'a': { textDecoration: 'underline' }        
                    }
                } 
            }
        }); 
        $("#overlay").overlay({ 
            closeOnClick: true, 
            finish:  { 
                top: 30
            }, 
            onBeforeLoad: function(content) {
                this.getBackgroundImage().expose({color: '#444'});
                this.getContent().find("a.fplayer").flowplayer(0).load();
            },
            onLoad: function(content) { 
                
            }, 
            onClose: function(content) {
                $.expose.close();
                $f().unload(); 
                //$('#overlay').unbind().removeData(); 
            }
        });
        $("#overlay").overlay().load();
        return false; 
    });
});

