Q:

Unable to show Div based on If statement

Can anyone please help me to resolve this Javascript issue:
I need to show few div component based on the current website's hostname and need to do this only during the initial load of the Page. I've developed a Javascript code for this but unable to show/hide div components in the desired manner.
The following Javascript code always gives an "Uncaught SyntaxError: Unexpected token else" Error on the console.   
<html>
   <head>
       <script>

          var hostName = window.location.host;

          var div1 = document.getElementById('iframePortal');
          var div2 = document.getElementById('iframeNormal');

          If(String(hostName).indexOf('w3schools') !== -1)
          {
          document.getElementById('iframePortal').style.display = 'block';
          document.getElementById('iframeNormal').style.display = 'none';
          }
          else {
          document.getElementById('iframePortal').style.display = 'none';
          document.getElementById('iframeNormal').style.display = 'block';
          }
       </script>
    </head>
    <body>
         <div id="iframeNormal">
             some text 1
         </div>
         <div id="iframePortal">
             another 1

          </div>
        </body>
    </html>

A:

use if instead of If like this
if(hostName.indexOf('w3schools') !== -1)

