function runs twice

function runs twice

I have created some code that alerts me the contents of all the child divs inside a main div

function CheckEventLayout()
{
    //check all divs in area and resize overlapping divs
    var RunOnce;
    if( RunOnce != true )
    {
        var StartTimes = new Array();
        var EndTimes = new Array();
        var i = 0;
        $("div#day-view-overlay").children("div.day-view-appointment").each(function(){
            var DoOnce;
            if( DoOnce != true )
            {
                alert($(this).html());
                $(this).css({width:"99%"});
                var xData = $(this).attr("x-data");
                var xStart = xData.substring(0,4);
                var xEnd = xData.substring(4,8);
                StartTimes[i] = xStart;
                EndTimes[i] = xEnd;
                i++;
                DoOnce = true;
            }
            for(var n = 0; n <= StartTimes.length; n++)
            {
                /*alert(StartTimes[n]);
                alert(EndTimes[n]);*/
            }
            //Store height and position
            //Check Height and position against all divs in area
            //Set Z-Index and Left position and width if conflicts occur
        });
        RunOnce = true;
        /alert("function run ");/
    }
}

CheckEventLayout();


the problem is this code is on a page that is loaded via post and if you go off the page and then back onto it jquery seems to attach the function again so it runs twice, as you can see I tried adding runonce etc but because of the nature of the problem this doesn't help, So need help in unbinding this function before the script runs again.

any help much appriciated