How can I simplify a long javascript switch case statement?
<p>I have the code below. It looks long and complicated and now I have to add some more conditions. Is there any way I can simplify this code. All I can think of is combining the City and Menu switches but then if I do that I have to do get the pk value one way for City and another way for Menu. Does javascript offer any other way to do the same thing as a switch? Sorry for the long code listing but I thought I should include everything.</p>

<pre><code>function getParams(entity) {

 var store = window.localStorage;
 var table = "Content";

 switch (entity) {
    case "City":
        if (store.getItem('AccountID')) {
            pk = store.getItem('AccountID') + "04" + "000";
            return {
                pk: pk,
                param: '?pk=' + pk,
                table: table,
                rc: true
            }
        } else {
            paramOnFailure("Please reselect Account");
            return { rc: false }
        }
        break;
    case "Menu":
        if (store.getItem('AccountID')) {
            pk = store.getItem('AccountID') + "00" + "000";
            return { 
                pk: pk,
                param: '?pk=' + pk,
                table: table,
                rc: true
            }
        } else {
            paramOnFailure("Please reselect Account");
            return { rc: false }
        }
        break;
    case "Page":
        if (store.getItem('AccountID') &amp;&amp; store.getItem('PageID')) {
            pk = store.getItem('AccountID') + store.getItem('PageID') + "000";
            return {
                pk: pk,
                param: '?pk=' + pk,
                table: table,
                rc: true
            }
        } else {
            paramOnFailure("Please reselect Account and Page Type");
            return { rc: false }
        }
        break;
    case "Question":
        if (store.getItem('AccountID') &amp;&amp;
            store.getItem('CityID') &amp;&amp; 
            store.getItem('TopicID') ) {
            pk = store.getItem('AccountID') + store.getItem('CityID');
            return {
                pk: pk,
                param: '?pk=' + pk + '&amp;rk=' + store.getItem('TopicID'),
                table: "Question",
                rc: true
            }
        } else {
            paramOnFailure("Please reselect Account, City and Topic");
            return { rc: false }
        }
        break;
    case "Reference":
        if (store.getItem('ReferenceID')) {
            pk = store.getItem('ReferenceID');
            return { 
                pk: pk,
                param: '?pk=' + pk,
                table: "Reference",
                rc: true
            }
        } else {
            paramOnFailure("Please reselect Reference");
            return { rc: false }
        }
        break;
    case "Topic":
        if (store.getItem('AccountID') &amp;&amp; store.getItem('CityID')) {
            pk = store.getItem('AccountID') + "05" + store.getItem('CityID');
            return { 
                pk: pk,
                param: parameters = '?pk=' + pk,
                table: table,
                rc: true
            }
        } else {
            paramOnFailure("Please reselect Account and City");
            return { rc: false }
        }
        break;
    default:
        ;
}
</code></pre>
