/*
Programmer: Darryl Ballard
Date created: 2009-09-15
Last updated: 2009-09-15
Version: 1.0.0

Requires:
	Prototype 1.6
	
Version History:
*/

var GST_Deletion_Confirmation = {
	class_to_activate:"confirm_delete",
	
	handle_click:function(e)
	{
		e = $(e);
		
		var item_label = this.getAttribute("title") ? ("\"" + this.getAttribute("title") + "\"") : "this item";
		
		var ret = confirm("Are you sure you want to delete " + item_label + "?");
		if (!ret) {
			e.stop();
			return false;
		}
		
		return true;
	},
	
	activate:function()
	{
		// Get all the deletion links
		var deletion_links = $$("a." + GST_Deletion_Confirmation.class_to_activate);
		
		for (var i = 0; i < deletion_links.length; i++) {
			deletion_links[i].observe("click", GST_Deletion_Confirmation.handle_click);
		} // end for(i)
	} // end activate()
};

// Require that Prototype is available
if (typeof Prototype == "undefined") {
	alert("GST Deletion Confirmation 1.0 requires the Prototype javascript framework.\n\nPlease check that it is included.");
} else {
	document.observe("dom:loaded", GST_Deletion_Confirmation.activate);
}

