/*****************************************************
*	Modal window Object
*	Creator: 
*	Desc: Load a modal view for different tools in the app (generally ajax).
******************************************/

	var appModal = function() {    
		// constructor 
		var appModal = this;
		this.speed = 650;      
		
		function init() {       
			$(".loadmodal").live("click", function(){						appModal.open(this);	});
			$("#modalWindow").delegate("#modalClose","click", function(){	appModal.close();	});
		}   
		 
		init();
	 };
	 	 
	appModal.prototype = {    
		open : function(caller) {       
	 		var loadUrl = $(caller).attr("href")
			$("#modalWindow").css("display","block");
			$("#modalWindow").animate({
				"opacity":1,
				"marginTop":"0px"
			},this.speed);
			this.speed = 300;
		 }, 
		close : function(caller) {       
		 			$("#modalWindow").animate({
			"opacity":0,
			"marginTop":"-60px"
		},this.speed,function(){
			$("#modalWindow").css("display","none");
		});
		 }
	}	
	
	var appModalInstance = new appModal();
