jQuery(function ($) {
	$("input.osx, a.osx").click(function (e) {
		e.preventDefault();	

		$("#osx-modal-content").modal({
			overlayId: 'osx-overlay',
			containerId: 'osx-container',
			closeHTML: '',
			minHeight:80,
			opacity:65, 
			position:['0',],
			overlayClose:true,
			onOpen:OSX.open,
			onClose:OSX.close
		});
	});

	var OSX = {
		container: null,
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx-modal-content", self.container).show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = 742; //$("#osx-modal-data", self.container).height() + 60;
                        d.container.animate(
							{height: h}, 
							200,
							function () {
								$("div.close", self.container).show();
								$("#osx-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this;
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {
					self.close(); // or $.modal.close();
				}
			);
		}
	};
	
});