/*
 * SimpleModal Contact Form
 * 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: contact.js 212 2009-09-03 05:33:44Z emartin24 $
 *
 */


$(document).ready(function () {
	$('a.ver_mapa').click(function (e) {
		e.preventDefault();
		mapid = this.rel;
		jQuery.modal(
				'<iframe id="map-wrapper" src="/scripts/maps.php?id=' + mapid + '"></iframe>', {
				closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
				position: ["15%",],
				overlayId: 'simple-modal-overlay',
				containerId: 'simple-modal-container',
				close: true,
				overlayClose: true,
				onOpen: contact.open,
				onShow: contact.show,
				onClose: contact.close
			});
		return false;
	
		
	});

	// preload images
	var img = ['cancel.png', 'form_bottom.gif', 'form_top.gif', 'loading.gif', 'send2.png'];
	$(img).each(function () {
		var i = new Image();
		i.src = '../imagenes_aplicacion/' + this;
	});
});

var contact = {
	message: null,
	open: function (dialog) {
		dialog.overlay.fadeIn(200, function () {
			dialog.container.fadeIn(200, function () {
				dialog.data.fadeIn(200);
			});
		});
	},
	
	show: function (dialog) {
	},
	
	close: function (dialog) {
		$('#simple-modal-container').fadeOut(200, function (){
			dialog.overlay.fadeOut(200, function () {
				$.modal.close();
			});
		});
	}
};
