window.addEvent('domready', function(){

// grids save popup instance (uses clientcide 3rd party 'modal' script')
// attach 'submit' event handler to each instance of save button (with a class of 'myForm')
$$('.myForm').addEvent('submit', function(e) {
    	//Prevents the default submit event from loading a new page
    	e.stop();
		// creates a new instance of the Modal class
      		var savePopUp = new StickyWin.Fx.Modal({
		// visual fade of 300ms
    		fadeDuration: 300,
    		modalOptions: {
    			modalStyle: {
				// opacity of background overlay layer
    				'opacity':.6
    			}
    		}
    	});
	// send (submit) 'this' instance using AJAX
	// on complete pass the response
    	this.set('send', {onComplete: function(response) {
		// inject the response into the Modal dialog 
    		savePopUp.setContent(response);
		// display the dialog
    		savePopUp.show();
		// attach 'submit' event to 'save and close' button in Modal dialog
    	}});
    	// Sends 'this' form instance
    	this.send();
});


// grids save popup instance (uses clientcide 3rd party 'modal' script')
// attach 'submit' event handler to each instance of save button (with a class of 'editgroup')
$$('.editgroup').addEvent('submit', function(e) {
    	//Prevents the default submit event from loading a new page
    	e.stop();
		// creates a new instance of the Modal class
      		var editgroupPopUp = new StickyWin.Fx.Modal({
		// visual fade of 300ms
    		fadeDuration: 300,
    		modalOptions: {
    			modalStyle: {
				// opacity of background overlay layer
    				'opacity':.6
    			}
    		}
    	});
	// send (submit) 'this' instance using AJAX
	// on complete pass the response
    	this.set('send', {onComplete: function(response) {
		// inject the response into the Modal dialog 
    		editgroupPopUp.setContent(response);
		// display the dialog
    		editgroupPopUp.show();
		// attach 'submit' event to 'save and close' button in Modal dialog
    	}});
    	// Sends 'this' form instance
    	this.send();
});

// creates instance of tooltip (uses 3rd party Moodalbox script)
var toolTips = new Tips($$('.Tips'), {
	onShow: function(tip) {
		tip.fade('in');
	},
	onHide: function(tip) {
		tip.fade('out');
	}
});
  
});