$(function() {

	var playerFlash;
	
	$("a[rel].video").overlay({

			target: '#videoOverlay',
			top: 'center',
			left: 'center',
			
			// use the Apple effect for overlay
			//effect: 'apple',
			expose: 'black', 
			
			// when overlay is opened, load our player
			onLoad: function() {
				var target = this.getTrigger().attr("rel");
				if(target.indexOf("http") != 0)
					target = "http://video.logdigger.com/" + target;
				swfobject.embedSWF(
					target,
					"video", 640, 498, "9.0.115", 
					
"http://static.logdigger.com/js/swfobject_2_2/expressInstall.swf", 
					//flashvars, params, attributes, 
					{autostart:true}, null, null,
					function(e) {
						if(e.success) {
							playerFlash = e.ref;
						}
					}
				);
			},
			
			// when overlay is closed, unload our player
			onClose: function() {
				if(playerFlash) {
					swfobject.removeSWF("video");
					$("#videoOverlay").append('<div id="video"></div>');
					delete playerFlash;
				}				
			}
    }); 

});

