/*
Delete confirmation script.
Just specify your deletion links as normal, but give them the class 'delete_link'.
This JavaScript will modify all your links after the page has loaded and add a confirmation
dialog to each of them.
B:19/10/2006
Works in IE (6, 7)
*/
var deleteLinks = new Array();
deleteConfirmation = function() {
	var linksToModify = document.getElementsByTagName("a");
	for (var i = 0; i < linksToModify.length; ++i) {
        if (linksToModify[i].className == 'delete_link') {
            linksToModify[i].onmouseover = function() {
                window.status = 'Delete';
            }
            linksToModify[i].onmouseout = function() {
                window.status = '';
            }
            deleteLinks[i] = linksToModify[i].href;
            linksToModify[i].onclick = function(e) {
              
                var clickedObject = (e == null) ? window.event.srcElement : e.target;
                var clickedUrl = clickedObject.href ? clickedObject.href : clickedObject.parentNode.href;
                var id = clickedUrl.split('#del.');
                if (id.length == 1) {
					clickedUrl = clickedObject.parentNode.href;	
					id = clickedUrl.split('#del.');
				}
                
                var url = deleteLinks[id[1]];
                if (confirm('Are you sure you want to delete this item?')) {
                    window.navigate(encodeURI(url));
                }
            }
        	linksToModify[i].href = '#del.' + i;
    	} 
	}
}

if (window.attachEvent) window.attachEvent("onload", deleteConfirmation);