function initPrivacy(privateFields){
    // Let "Custom" be the default setting
    var index = '4';
    /*
     * Remove the trailing comma, split the string into an array, sort the elements
     * alphabetically, and rejoin the elements as a single string
    */
    privateFields = privateFields.replace(/^(.*),$/i,'$1').split(',').sort().join(',');
    switch(privateFields){
        case LEVEL_0_HIDE.split(',').sort().join(','):
            index = '0';
            break;
        case LEVEL_1_HIDE.split(',').sort().join(','):
            index = '1';
            break;
        case LEVEL_2_HIDE.split(',').sort().join(','):
            index = '2';
            break;
        case '':
            index = '3';
            break;
    }
    $('input[name="privacy"][value="' + index + '"]').click();
}
/********************************************************
 * Based on the privacy fields specifed during page load,
 * select the appropriate radio button setting
********************************************************/
Based on the privacy fields specifed during page load,
select the appropriate radio button setting
Based on the privacy fields specifed during page load select the appropriate radio button setting
function initPrivacy(privateFields){
    var index = '4';
    privateFields = privateFields.replace(/^(.*),$/i,'$1').split(',').sort().join(',');
    switch(privateFields){
        case LEVEL_0_HIDE.split(',').sort().join(','):
            index = '0';
            break;
        case LEVEL_1_HIDE.split(',').sort().join(','):
            index = '1';
            break;
        case LEVEL_2_HIDE.split(',').sort().join(','):
            index = '2';
            break;
        case '':
            index = '3';
            break;
    }
    $('input[name="privacy"][value="' + index + '"]').click();
}
function initPrivacy ( privateFields ) { var index = '4' ; privateFields = privateFields . replace ( / ^(.*),$ / i , '$1' ) . split ( ',' ) . sort ( ) . join ( ',' ) ; switch ( privateFields ) { case LEVEL_0_HIDE . split ( ',' ) . sort ( ) . join ( ',' ) : index = '0' ; break ; case LEVEL_1_HIDE . split ( ',' ) . sort ( ) . join ( ',' ) : index = '1' ; break ; case LEVEL_2_HIDE . split ( ',' ) . sort ( ) . join ( ',' ) : index = '2' ; break ; case '' : index = '3' ; break ; } $ ( 'input[name="privacy"][value="' + index + '"]' ) . click ( ) ; }
Based on the privacy fields specifed during page load,
 select the appropriate radio button setting
Based on the privacy fields specifed during page load select the appropriate radio button setting
// Let "Custom" be the default setting
 /*
     * Remove the trailing comma, split the string into an array, sort the elements
     * alphabetically, and rejoin the elements as a single string
    */