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

$(document).ready(function () {

	$('#basic-modal input.basic, #basic-modal a.basic').click(function (e) {
		e.preventDefault();
		$('#basic-modal-content').modal();
		$("#progress").hide(0);
			$("#return").hide(0);
	});
	
//	$(".btn").click(function(){ 
//		$("#basic-modal-content").load(document.getElementById("book").action); 
//	});
	
	
	
	$("#book").submit(function(){
			
			var act=document.getElementById("book").act.value;
			var aj=document.getElementById("book").aj.value;
			var cnt=$("#basic-modal-content").html();
			// 'this' refers to the current submitted form
			var str = $(this).serialize();
			$("#bookform").hide(0);
			$("#progress").show(0);
			//$("#basic-modal-content").('<div style="margin: 80px 110px; width: auto"><img src="'+aj+'"  /></div>');
		   $.ajax({
		   type: "POST",
		   url: act,
		   data: str,
		   success: function(msg){

			$("#basic-modal-content").ajaxComplete(function(event, request, settings){

			$("#progress").hide(0);
			$("#return").css({opacity: 0});
			$("#return").show(0);
			
			$("#return").html(msg);
			$("#return").animate({opacity: 1},1500);
			//$("#basic-modal-content").show(0);

			});

			}

					 });

			return false;

			});
});

function set_val(info)
{
	document.getElementById("book").info.value=info;
}


