$(document).ready(function(){ 
	
	$("a.videobox").click(function() {
		$.fancybox ({
				'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				//'href': ('http://www.youtube.com/v/BS7IqgKTRDA'),
				'type' : 'swf',
				'swf' : {'wmode':'transparent','allowfullscreen':'true'},
				"padding": 0,
				"speedIn": 300,
				"speedOut": 300,
				"changeSpeed": 300,
				"transitionIn": "elastic",
				"transitionOut": "elastic",
				"titlePosition": "over",
				"titleShow": true,
				"easingIn": "swing",
				"easingOut": "swing",
				"showCloseButton": true,
				"showNavArrows": true, 
				"enableEscapeButton": true,
				"overlayShow": true,
				"overlayOpacity": 0.4,
				"overlayColor": "#666",
				"centerOnScroll": false,
				"hideOnContentClick": false,
				"onComplete" : function() {
					$("#fancybox-wrap").hover(function() {
					$("#fancybox-title").show();
					}, function() {
					$("#fancybox-title").hide();
				});
			}
			//,"titleFormat": function(title, currentArray, currentIndex, currentOpts) { return '<span id="fancybox-title-over">Bild ' + (currentIndex + 1) + ' von ' + currentArray.length + (title.length ? ' : &nbsp; ' + title : '') + '<\/span>';}
		});
		return false; 
	});
	
	
	if ($("*").is(".jqfancybox")) {
		$(".jqfancybox").fancybox({
			"padding": 0,
			"speedIn": 300,
			"speedOut": 300,
			"changeSpeed": 300,
			"transitionIn": "elastic",
			"transitionOut": "elastic",
			"titlePosition": "over",
			"titleShow": true,
			"easingIn": "swing",
			"easingOut": "swing",
			"showCloseButton": true,
			"showNavArrows": true,
			"enableEscapeButton": true,
			"overlayShow": true,
			"overlayOpacity": 0.4,
			"overlayColor": "#666",
			"centerOnScroll": false,
			"hideOnContentClick": false,
			"onComplete" : function() {
				$("#fancybox-wrap").hover(function() {
				$("#fancybox-title").show();
				}, function() {
					$("#fancybox-title").hide();
				});
			},  "titleFormat": function(title, currentArray, currentIndex, currentOpts) { return '<span id="fancybox-title-over">Bild ' + (currentIndex + 1) + ' von ' + currentArray.length + (title.length ? ' : &nbsp; ' + title : '') + '<\/span>';}
		});
	}
});
