// Misc functions

// Google APIs load
	google.setOnLoadCallback(function() {  
		$('A[rel="external"]').click( function() {
			window.open( $(this).attr('href') );
			return false;
		});
		$('A[rel="external nofollow"]').click( function() {
			window.open( $(this).attr('href') );
			return false;
		});
		/*$("a.fancybox").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'outside',
			'overlayOpacity' : 0.7,
			'overlayColor' : '#000',
			'padding' : 1,
			'cyclic' : true
		});*/
		$("a.fancyboxyt").click(function() {
			$.fancybox({
				'padding'		: 1,
				'overlayOpacity' : 0.7,
				'overlayColor' : '#000',
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'		: 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'cyclic' : true,
				'swf'			: {
					 'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
			
			return false;
		});
// Fancybox
	function manual_fancybox(fb_caption, fb_href, fb_type, fb_width, fb_height){
		if(fb_width) {
			width = fb_width;
			height = fb_height;
			autoScale = false;
		} else {
			width = 'auto';
			height = 'auto';
			autoScale = true;
		}
		$.fancybox({
			'href'			: fb_href,
			'title'   		: fb_caption,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'outside',
			'overlayOpacity' : 0.7,
			'overlayColor' : '#000',
			'type'				: 'image',
			'width'				: width,
			'height'			: height,
			'autoScale'     	: autoScale,
			'type'				: fb_type,
			'padding' : 1,
			'cyclic' : true
		});
	}
	
	});  
	

	
// Twitter @Anywhere
	twttr.anywhere(onAnywhereLoad);
	function onAnywhereLoad(twitter) {
		twitter.hovercards();
		twitter("a.b_twitter, li.twitter a").hovercards({
      		infer: true
    	});
		/*twitter("li.twitter a").hovercards({
      		infer: true
    	});*/
	};





