// Define the jg namespace to wrap all Jumpy Gym javascript
var jg = jg ? jg :{
	

	modal : function(options){
		 /**
		 * Modal window function 
		 * 
		 * @file - the file or url to be displayed in the content area
		 * @width - the width of the window
		 * @height - the height of the window
		 * @left - the left position of the window (corresponds to css left)
		 * @right - the top position of the window (corresponds to css top)
		 * @title - the title of the window
		 * @closeHandler - 
		 * 
		 */
		
		var config = {
			file: '',
			title: '',
			height: 300,
			width: 300,
			left: $(window).width()/2-width/2,
			top: $(window).height()/2-height/2
		};
		 
		var options = $.extend(config, options); 
	},	
	
	loadModal : function(options){	
		// set conatiner dimensions
		$('.modal-ml').height(option.height-18);
		$('.modal-mr').height(option.height-18);
		$('.modal-tl').width(option.width-8);
		$('.modal-ml').width(option.width-8);
		$('.modal-bl').width(option.width-8);
		$('#modal').css('top', fpos.top); 
		$('#modal').css('left', $(window).width()/2-option.width/2); 
		$('.modal-overlay').height($(document).height()); 
		$('.modal-overlay').width($(document).width()); 
		$('.modal-overlay').show();
		$('#modal').show();
		// Ajax request
		$.get(option.file, function(data){
			$('#modal').show(3000,function(){
				$('#modal-content').empty();
				$(data).appendTo('#modal-content');
			});
		});
	},
		
	closeModal : function(){
		$('#modal').hide();
		$('.modal-overlay').hide();
		$('modal-content').empty();
	}

};
