
<?php
/**
 * Language switcher template
 *
 * @see Mage_Page_Block_Switch
 */
?>
<?php if(count($this->getStores())>1): ?>
<li class="lang">
<div class="block-language">
  <div class="block-content dropdown">
    <a title="<?php echo $this->__('Select Your Language') ?>" data-hover="dropdown" data-toggle="dropdown" class="dropdown-toggle" href="#"> 
        <span class="icon-flag"></span>
        <span class="name"><?php echo substr(Mage::app()->getLocale()->getLocaleCode(),0,2);?></span>
    </a>
    <ul class="dropdown-menu">
      <?php foreach ($this->getStores() as $_lang):?>
        <li>
          <a href="<?php echo $_lang->getCurrentUrl();?>" title="<?php echo $this->htmlEscape($_lang->getName()) ?>"
            <?php if(substr(Mage::app()->getLocale()->getLocaleCode(),0,2)==$this->htmlEscape(substr($_lang->getName,0,2))) { ?>
              class="dropdown-toggle selected "<?php } else {?> class="dropdown-toggle"<?php }?> >
                  <span class="name"><?php echo $this->htmlEscape(substr($_lang->getCode(),0,2)); ?></span>
          </a>
        </li>
      <?php endforeach; ?>
    </ul>
  </div> <!--block-content dropdown-->
</div> <!--block-language-->
</li>
<?php endif; ?>      
      