
// Added by Harris

function showContent(elts, settings, callback) {
  elts.contentWrapper
    .css({ // Reset the CSS at the start position
		width: settings.width+'px',
		height: settings.height+'px',
		marginLeft: (settings.marginLeft)+'px',
		marginTop: (settings.marginTop)+'px',
		opacity: 0
    })
    .show()
    .animate({ // Set the height
		width: settings.width+'px',
		height: settings.height+'px',
		marginLeft: (settings.marginLeft)+'px',
		marginTop: (settings.marginTop)+'px',
		opacity: 1
    }, {complete: callback, duration: 300});
}

function hideContent(elts, settings, callback) {
  elts.contentWrapper
	.animate({
		opacity: 0
	}, {complete: callback, duration: 200});
}

function resize(elts, settings, callback) {
  elts.contentWrapper
	.animate({
		height: settings.height+'px'
	}, {complete: callback, duration: 150});
}

jQuery(function($) {
	$.nyroModalSettings({ 
		minWidth: 400, 
		minHeight: 400,
		showContent: showContent,
		hideContent: hideContent,
		resize: resize,
		closeButton: '',
		css: {
			bg: {
				position: 'absolute',
				left: '-9999px'
			}
		}
	});
}); 

function change_meal(url, src_obj, hori) {
	// Hide other modal windows
	hide_click_menu(newjax.calendar.open_menu);
	jQuery.nyroModalRemove();
	// Get object
	var j = jQuery;
	var obj = j("#" + src_obj);
	// Get start position
	var offset = obj.offset();
	var left = offset.left + 200;
	if (hori == 'left')
		left = offset.left - 200 + obj.width() + 2;
	// Call nyroModal manually as jQuery is clobbered by prototype
	j.nyroModalManual({ 
		url: url,
		css: {
			wrapper: {
				position: 'absolute',
				left: left+'px',
				top: (offset.top+200)+'px'
			}
		}
	});
}

function itempreview(type, id) {
	var j = jQuery;
	var url = "itempreview.php?type=" + type + "&id=" + id;
	j.fancybox({
		'href' : url,
		'type' : 'iframe',
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'overlayOpacity':	'0.5'
	});
}

