<div class="block-title"> <span>Select Your Language</span> </div>
<div class="dropdown">
<?php if (count($languages) > 1) { ?>
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data"  class="block-content">
    <?php foreach ($languages as $language) { ?>
     <?php if ($language['code'] == $language_code) { ?>
     <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" title="<?php echo $language['name']; ?>"> <span class="icon-flag" style="background-image: url(image/flags/<?php echo $language['image']; ?>)" margin-top:2px"></span><span class="name"><?php echo $language['name']; ?></span> </a>
     <?php } ?>
          <?php } ?>
   <ul class="dropdown-menu" id="language">   
   <?php foreach ($languages as $language) { ?>
       <a tabindex="-1" onclick="$('input[name=\'language_code\']').attr('value', '<?php echo $language['code']; ?>'); $(this).parent().parent().submit();"><span class="icon-flag" style="background-image: url(image/flags/<?php echo $language['image']; ?>)"></span><?php echo $language['name']; ?></a></li>
    <?php } ?>
    </ul>
    <input type="hidden" name="language_code" value="" />
    <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />

</form>
<?php } ?>
    </div>
