Nested conditional statements (if, switch then if again)
<p>Quick question: is this kind of nesting possible?
An if statement first passing a switch and then another if statement so it won't affect other values that were not caught on switch?</p>

<pre><code>var cookie = ""; //some value previously setted by filtering a cookie, like a product id
var prod = "";
var img = "";
if ((cookie != null) &amp;&amp; (prod != '')) {
    switch (cookie) {
    case '001': case '002': case '003':
        prod = "Product01";
        img = "product01.jpg"
        break;
    case '004': case '005': case '006':
        prod = "Product02";
        img = "product02.jpg"
        break;
    case '007': case '008':
        prod = "Product03";
        img = "product03.jpg"
        break;
    case 'null':
        break;
    }
    if (window.location.pathname == 'somepage') {
        //jQuery code
    } else if (window.location.pathname == 'anotherpage') {
        //jQuery code
    } else {
        //jQuery code
    }
}
</code></pre>
