function clickVideo(id,width,height,img){
	$(id).click(function () {
	    var url = $(this).attr('name');
	
	    $.fancybox({
	        'padding': 0,
	        'autoDimensions': false,
	        'width': width,
	        'height': height,
	        'content': '<div class="video-js-box vim-css">' +
	                    '<video id="video_head" class="video-js" autoplay="autoplay" width="'+width+'" height="'+height+'" controls="controls" preload="auto">' +
	                    '<source src="../media/video/' + url + '.mp4" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' />' +
	                    '<source src="../media/video/' + url + '.ogg" type=\'video/ogg; codecs="theora, vorbis"\' />' +
	                      '<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->' +
	                      '<object id="flash_fallback_1" class="vjs-flash-fallback" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash"' +
	                        'data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">' +
	                        '<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />' +
	                        '<param name="allowfullscreen" value="true" />' +
	                        '<param name="flashvars" value=\'config={"playlist":[{"url": "http://www.bebedue.com/media/video/' + url + '.flv","autoPlay":true,"autoBuffering":true}]}\' />' +
	                      '</object>' +
	                    '</video>' +
	                    '</div>',
	        'onStart': function(){
				//window.location.hash = id;
			},
	        'onComplete': function () { 
	        	$("#fancybox-content div:first").css({ 'overflow': 'visible' });
	        	
	        	if (Modernizr.video){
	        		VideoJS.setupAllWhenReady();
	        		myPlayer = $("#video_head")[0].player;
	        		//$("#fancybox-inner, #fancybox-content div:first").css({ 'overflow': 'visible' });
	        	};
	        }/*,
	        'onClosed': function () {
	        	$("#fancybox-inner").empty();
	        	window.location.hash = "";
	        }*/
	    });
	    return false;
	}); // fancyvideo
}

function modal(id,height,autodim,callback){

	$(id).fancybox({                		
                'showCloseButton':true,
                'autoDimensions':autodim,
		'padding':0,
		'margin':0,
		'width':950,
		'scrolling':'no',
		'height':height,
                'overlayOpacity':0.5,
		'onComplete': callback,
		'onStart': function(){
			window.location.hash = $(id).attr("id");
		}
	});
}
