function modalWindow() {
	// define the object's variables
	this.container = null;
	this.content = null;
	this.contentObject = null;
	this.rendered = false;
	this.bound = false;
	
	this.open = function(e) {
		// if the modal window has not been rendered
		if(!this.rendered) {
			// grab the body tag
			var body = $('body');
			// create the modal container
			var modalContainer = document.createElement('div');
			// if an element was passed in
			if(e) {
				// grab the name of the element
				var id = (e.name) ? e.name : '';
				// set the id of the modal window
				modalContainer.id = id;
			}
			// set the modal window's class name
			modalContainer.className = 'modalWindow';
			// set the local container var to the modal container element
			this.container = modalContainer;
			// create the "shield" (the div that covers the background)
			var modalShield = document.createElement('div');
			// set the shield's class name
			modalShield.className = 'modalShield';
			// append the shield to the container
			this.container.appendChild(modalShield);
			// append the content to the container
			this.container.appendChild(this.content);
			// prepend the default modal elements to the body tag
			body.prepend(this.container);
			// set the width of the modal shield
			modalShield.style.width = $(document).width() + 'px';
			// set the height of the modal shield
			modalShield.style.height = $(document).height() + 'px';
			// we are now rendered
			this.rendered = true;
		}
		// call the show function
		this.show();
	}
	
	this.show = function() {
		// "open", but hide the modal window
		//this.container.style.visibility = 'hide';
		this.container.style.display = 'block';
		// get the top value
		var modalTop = ($(window).height() / 2) - ($(this.content).outerHeight() / 2);
		if(modalTop < 0) { modalTop = 0; }
		// set the top value of the modal window
		this.content.style.top = modalTop + $(window).scrollTop() + 'px';
		// now display the modal open
		//this.container.style.visibility = 'visible';
		
		// if we have a content object defined
		if(this.contentObject) {
			// if the content object has a callback function
			if(this.contentObject.callBack) {
				// call the content object's callback function
				this.contentObject.callBack(this.container);
			}
		}
		
		// bind the default close elements
		this.bindClose();
	}
	
	this.close = function() {
		// "close" the modal window
		this.container.style.display = 'none';
	}
	
	this.bindClose = function(e) {
		// set a local variable to keep the scope of "this"
		var self = this;
		// if an element was provided
		if(e) {
			// bind a click event to that element to close the window
			$(e).click(function() {
				// call the close function
				self.close();
				return false;
			});
		}
		// if the object's default elements have not been bound
		if(!this.bound) {
			// bind click events to the default closing elements
			$('.close, .modalShield', this.container).click(function() {
				//call the close function
				self.close();
				return false;
			});
			// set bound to true
			this.bound = true;
		}
	}
	
	this.buildContent = function(content) {
		var modalContentContainer = document.createElement('div');
		modalContentContainer.className = 'modalContentContainer';
		// create the modal content div
		var modalContent = document.createElement('div');
		// assign the classname
		modalContent.className = 'modalContent';
		// create the close "button"
		var closeButton = document.createElement('a');
		// assign a href value to the close button
		closeButton.href = '#';
		// assign the class name
		closeButton.className = 'close';
		// setup some text for the close button
		var closeButtonText = document.createTextNode('Close');
		// add the text to the close button
		closeButton.appendChild(closeButtonText);
		// add the close button to the content
		//modalContent.appendChild(closeButton);
		modalContentContainer.appendChild(closeButton);
		modalContentContainer.appendChild(modalContent);
		// if the content passed in is an object
		if(typeof(content) == 'object') {
			// add the passed in content to the local contentObject variable
			this.contentObject = content;
			// if the content object has a draw function
			if(this.contentObject.draw) {
				//call the content draw function
				content = this.contentObject.draw(modalContent);
				// append the result to the modal content
				// the draw function should return a valid element object, it shouldn't just return a string of text
				// i.e.
				// var div = document.createElement('<div>');
				// div.innerHTML = '<p>This is some inner html</p><ul><li>unordered lists rock!</li></ul>';
				// (the inner html can contain any content, even elements)
				// return div;
				// (there you have it; this is a very basic example BTW)
				if(typeof(content) == 'object') {
					modalContent.appendChild(content);
				} else {
					// just append whatever content it is
					modalContent.innerHTML += content;
				}
			}
		// if the content passed in is not an object
		} else {
			// just append whatever content it is
			modalContent.innerHTML += content;
		}
		
		this.content = modalContentContainer;
	}
	
	this.setContent = function(content) {
		// call the buildContent function
		this.buildContent(content);
		// return the object
		return this;
	}
}

