<?php
$sql1 = "SELECT * FROM info WHERE category_id='$pid' AND lang_id=1 AND publish='yes' ORDER BY priority";
$result1 = mysql_query($sql1);
while ($myrow=mysql_fetch_array($result1)) {
$id=$myrow['id'];
$category_id=$myrow['category_id'];
$insert_id=$myrow['insert_id'];

$result2 = mysql_query("SELECT * FROM info WHERE insert_id='$insert_id' AND lang_id='$lang'",$dbh);
$myrow=mysql_fetch_array($result2);
$name=$myrow['name'];
$text=$myrow['text'];
$script=$myrow['script'];
$image=$myrow['image'];
$file=$myrow['file'];
?>

<div style="margin-bottom:10px">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td valign="top"> 
<div>

              <div class="titles"> <?php echo $name ?> </div>
              <div style="padding-bottom:10px"><?php echo $text ?></div>
                  
                   <?php if ($file!='') { ?>
                  <div style="padding-top: 2px; padding-bottom: 2px"> 
                 &raquo; <a href="<?php echo $sitepath ?>images/info/files/<?php echo $insert_id ?><?php echo $file ?>" class="links" target="_blank">Download file</a> 
                  </div>
                  <?php } ?>
                  
</div>               
                  </td>
                <td valign="top" align="right"> 
                  <?php if ($image==yes) { ?>
                  <div style="float:right; padding-left:10px"> 
                  <a href="<?php echo $sitepath ?>images/info/<?php echo $insert_id ?>.jpg" onclick="return hs.expand(this)" class="plinks"><img src="<?php echo $sitepath ?>images/info/thumbs/<?php echo $insert_id ?>.jpg" alt="<?php echo $name ?>"></a> 
                  </div>
                  <?php }?>
                </td>
              </tr>
            </table>
            
<?php
$sql4 = "SELECT * FROM photos WHERE info_id='$insert_id' ORDER BY priority";
$result4 = mysql_query($sql4);
while ($myrow=mysql_fetch_array($result4)) {
$photoid=$myrow['id'];
$photo=$myrow['name'];
$ppriority=$myrow['priority'];
?>
<?php if ($photo=='') { 
$photo=$company1;
}?>
 <?php include 'photo.php';?>
<?php } ?>   
<div style="clear:both"></div> 
                  
<?php echo $script ?>                 
</div>
                        
<?php }?>