<h2><?php echo ucfirst($this->site[$immovable['offer_type']]).' | '.ucfirst($this->site[$immovable['building_type']]); ?></h2>
<div class="content">
    <div id="gallery">
        <div id="gallery_image" style="width:100%;height:400px; overflow:hidden;"></div>
        <div id="gallery_bottom_panel">
            <table width="590">
                <tr>
                    <td width="150" align="left"><a id="prev_image" href=""><?php echo ucfirst($this->site['poprzednie_zdjecie']); ?></a></td>
                    <td><div id="gallery_counter">0/0</div></td>
                    <td width="150" align="right"><a id="next_image" href=""><?php echo ucfirst($this->site['nastepne_zdjecie']); ?></a></td>
                </tr>
            </table>
        </div>
        <div id="gallery_links">
            <?php
                if(!empty($immovable['images']) && is_array($immovable['images']))
                {
                    foreach($immovable['images'] as $k=>$v)
                    {
                            $imgPath = '/files/img/galleries/'.$immovable['gallery_id'].'/'.$v['path'];
                            list($width, $height, $type, $attr) = getimagesize(substr($imgPath, 1));                        
                        echo '<a href="'.$imgPath.'" alt="'.$width.'__'.$height.'" ></a>';
                    }
                }
            ?>
        </div>
        <div id="gallery_item_data">
        <?php

            if(!empty($immovable['localization']))
                echo '<p class="big_brown">'.$immovable['localization'].'</p>';

            if(!empty($immovable['plot_type']) && ($immovable['building_type_id']==3))
                echo '<p>'.ucfirst($this->site['typ']).': <b>'.$immovable['plot_type'].'</b></p>';

            if(!empty($immovable['price']))
                echo '<p>'.ucfirst($this->site['cena']).': <b>'.$immovable['price'].'</b></p>';

            if(!empty($immovable['surface']))
                echo '<p>'.ucfirst($this->site['powierzchnia']).': <b>'.$immovable['surface'].'</b></p>';

            if(!empty($immovable['floor']))
                echo '<p>'.ucfirst($this->site['pietro']).': <b>'.$immovable['floor'].'</b></p>';

            if(!empty($immovable['rooms']))
                echo '<p>'.ucfirst($this->site['ilosc_pokoi']).': <b>'.$immovable['rooms'].'</b></p>';

            if(!empty($immovable['garage_surface']))
                echo '<p>'.ucfirst($this->site['powierzchnia_garazowa']).': <b>'.$immovable['garage_surface'].'</b></p>';

            echo '<br/><br/>';
            echo '<p>'.$immovable['description'].'</p>';
        ?>
            <a href="/<?php echo strtolower($lang['shortname']).'/'.url_title(strtolower($this->site['nieruchomosci'])).'.html'; ?>" class="offer_details_link"><?php echo ucfirst($this->site['wroc']); ?> >></a>
        </div>
        
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        var currentImageIndex =0;
        var imageNumber = $("#gallery_links a").size();

        $("#gallery_links a").click(function(){
            var href= $(this).attr('href');
            var alt = $(this).attr('alt');
            var sizes = alt.split("__");

               $('#gallery_image').fadeOut('slow', function() {
                $("#gallery_image").html('<p><img src="'+href+'" height="400"/></p>');
                //$("#gallery_image").css('width','100%');
                //$("#gallery_image").css('height','400px');

                $(this).fadeIn('slow',function(){
                    applyShadow();        
                });
            });           
        });

        function changePhoto()
        {
            $("#gallery_links a").filter(function(index){
             return index == currentImageIndex;
            }).click();
            $("#gallery_counter").text((currentImageIndex+1)+"/"+imageNumber);
        }
        changePhoto();
        
        $("#prev_image").click(function(){
            if(currentImageIndex >= 1)
            {
                currentImageIndex--;
                changePhoto();
            }
           return false;
        });
        $("#next_image").click(function(){
            if(currentImageIndex < (imageNumber-1))
            {
                currentImageIndex++;
                changePhoto();
            }
           return false;
        });
    });
</script>