var fuh = {};

fuh.parseDefaults = function(node) {
	
	if(!node) {
		node = $('body');
	}
	
//	var dialog = $('<div/>').dialog({
//		autoOpen: false,
//		resizable: false,
//		maxHeight: Math.round($(window).height() * (2 / 3))
//	});
//	
//	$(node).find('.fuh-dialog-link').click(function(e) {
//		e.preventDefault();
//		dialog.empty();
//		dialog.dialog('option', 'width', 150);
//		dialog.dialog('option', 'title', $(this).attr('title'));
//		dialog.addClass('fuh-loading');
//		dialog.dialog('open');
//		dialog.load($(this).attr('href'), function() {
//			dialog.removeClass('fuh-loading');
//			dialog.dialog('option', 'width', 'auto');
//			dialog.dialog('option', 'position', 'center');
//		});
//		return false;
//	});
	
	if($.fn.fancybox) {
		
		$(node).find('.fuh-dialog-link').each(function() {
			$(this).attr('href', $(this).attr('href') + '?format=ajax');
		});
		
		$(node).find('.fuh-dialog-link').fancybox({
			'titleShow'     : false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',			
		});	
	
		$(node).find(".fuh-fancy-box").fancybox({
			'titleShow'     : false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'type'			: 'image'			
		});
	}
};

(function($) {

	$(document).ready(function() {
		fuh.parseDefaults();
	});

})(jQuery);

