Problem attaching duplicate functions to events

Problem attaching duplicate functions to events

So we are developing an ASPX website which uses a master page and content pages. Some pages have a GridView to look at data in a database and we have created a global js function to do a delete confirmation when the delete button is pressed for a given record. The problem is that on initial page load the confirm is poping up twice. Then after a postback the delete is only poping up once. So the popup function is obviously being added to the delete button even more than once.

The weird issue is that this is only happening with IE and not with FireFox (actually thats probablely not wierd at all cause IE is retarded). Anyhow, we need a way to see if the function has been attached and not attach it again if it already exists for the click event of that button.

This is the global js file that is attached to the page:

function enableDeleteConfirm(){
    $(".StdGridView a:contains('Delete')").click(function(e){
        var result = confirm("Are you sure you want to delete this?");
        if (!result){
            e.preventDefault();
        }
    });
}

function pageLoad(){
   enableDeleteConfirm();
}

$(document).ready(function(){
   enableDeleteConfirm();
});

The $(document).ready is needed because it only happens once, and never again after postbacks. The pageload is needed to get the times when there are only post backs. According to my developer who created this function both are indeed required. But we figure there has to be a check to see if enableDeleteConfirm() was already ran. We tried creating a global variable and using an if statement inside the enableDeleteConfirm() but it seems that on postbacks that global variable no longer keeps it old status.

I have access to cs code behind file, perhaps I can check if its a page load from their and assign a variable in cs for the js function to test?

Any ideas? Has this happened to anyone else?