/*
 * SimpleModal lookandbook Style Modal Dialog
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2009 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: lookandbook.js 213 2009-09-17 04:10:02Z emartin24 $
 */

// Show Overlay
function showOverlay() {
	$("#lookandbook-modal-content").modal({
		overlayId: 'lookandbook-overlay',
		containerId: 'lookandbook-container',
		closeHTML: '',
		minHeight:80,
		opacity:65, 
		position:['0',],
		overlayClose:true,
		onOpen:lookandbook.open,
		onClose:lookandbook.close
	});
}

var lookandbook = {
		container: null,
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#lookandbook-modal-content", self.container).show();
				var title = $("#lookandbook-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#lookandbook-modal-data", self.container).height()
							+ title.height()
							+ 170; // padding
						d.container.animate(
							{height: h}, 
							600,
							function () {
								$("div.close", self.container).show();
								$("#lookandbook-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();
				}
			);
		}
	};

jQuery(function ($) {
	$("input.lookandbook, a.lookandbook").click(function (e) {
		e.preventDefault();	

		$("#lookandbook-modal-content").modal({
			overlayId: 'lookandbook-overlay',
			containerId: 'lookandbook-container',
			closeHTML: '',
			minHeight:300,
			opacity:65, 
			position:['0',],
			overlayClose:true,
			onOpen:lookandbook.open,
			onClose:lookandbook.close
		});
	});


	
	
});

