/*
 * 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,v 1.7 2009/09/03 15:22:22 sang Exp $
 *
 */

function close_modal(){
	jQuery('#modal-screen').hide();
	jQuery('#modal-dialog').fadeOut("slow"); 
	
}

function showModalDialog(content){
	jQuery('#modal-screen').show();
	jQuery('#modal-dialog_content').html(content);
	
	/* need to dynamicly adjust the height of gray background or else firefox would not fully cover the screen with it */
	var pixelHeight = document.body.offsetHeight;
    jQuery('#modal-screen').height(pixelHeight + "px");
    
	jQuery('#modal-dialog').show();
}

function showLoginModal(content){
	jQuery('#login_modal-dialog_content').html(content);
	jQuery('#login_modal-dialog').show();
}

jQuery(document).ready(function () {
	jQuery('#add_edit_address').click(function (e) {
		e.preventDefault();
		jQuery('#modal-screen').show();
		jQuery('#modalContent2').modal();
	});
});


jQuery(document).ready(function () {
	jQuery('#request_catalog').click(function (e) {
		e.preventDefault();
		jQuery('#modal-screen').show();
		jQuery('#modalContent3').modal();
	});
});


jQuery(document).ready(function () {
	jQuery('#sendEmail').click(function (e) {
		e.preventDefault();
		jQuery('#modalContent').modal();
	});
});

function show_modal_views (contextPath, path){
	var url = contextPath+"/views/"+path;
	jQuery.ajax({
	   type: "POST",
	   url: url,
	   success: function(response){showModalDialog(response);}
	 });	
}

function show_modal(path){
	var url = path;
	jQuery.ajax({
	   type: "GET",
	   url: url,
	   success: function(response){showModalDialog(response);}
	 });	
}


