Topic: javascript date formatter

Hi Guys
I have a date formatter piece of javascript that turns a date eg 011211 into 01/12/2011.
I'm just wondering where I would add this to the code to activate it for things like OrderDate in Direct Invoice.?
Thanks
Pete

function addSlashes(input) {
    var v = input.value;
    var startYear = '';
    // If it's only 2 digits and 2 digits long, add one slash
    if (v.match(/^\d{2}$/) !== null) {
        input.value = v + '/';
        // If up to year, add slash again.
    } else if (v.match(/^\d{2}\/\d{2}$/) !== null) {
        input.value = v + '/';
    }
    // If six chars, add year
    
    if (v.match(/^\d{2}\/\d{2}\/\d{2}$/)) {
        
        // 24/12/08 
// substring from - to (to is char position so always > from)

        if (v.substring(6,8)>30) {
            startYear = '19';
        }
        else {
            startYear = '20';
        }
        input.value = input.value.substring(0,6)  + startYear + input.value.substring(6,8);
    }
}