<?php

function Prezeraj_charP2($idP){
 ?>
   </div> <!--welcome-->
	 <div id="content">
			<p>	<h1>Ponuka</h1>
				<div class="fineline"></div>
 
  	<?php
  $link = mysql_connect('mysql.ic.cz', 'yw_castav', 'majkamartin');
		if ($link) 
		{
			if (mysql_select_db('yw_castav', $link)) 
	{
				$sql= "SELECT * FROM works WHERE workid='" . $idP ."'";
        mysql_query("SET NAMES utf8");
					$result = mysql_query($sql, $link);
					if (mysql_num_rows($result)==1){
		      	$row = mysql_fetch_assoc($result);
								$nazov = $row['name'];
					    	$id=$row['workid'];				
						    $kratkypopis = $row['shorttext'];
						    $dlhypopis = $row['longtext'];
						    $uvodnyobrazok= $row['image'];
      mysql_free_result($result);

      }
        

        ?>
        
        <div class="praca">
           <img src="<?php echo "$uvodnyobrazok" ?>" width="109" height="108" alt="Pic 2" class="left" style="margin-left:20px;" />
				  	<h2><?php echo "$nazov" ?></h2>
						<p style="margin-left:10px;" ><?php echo "$kratkypopis" ?></p>
					  <p style="margin-left:10px;"><?php echo "$dlhypopis" ?></p>
					  </br>
					  </br>
					  
			<!----------------------------------------->
    <?php  }//if mysql select
    mysql_close($link);   
    ZobrazGaleria("work/".$nazov."/");  
    ZobrazForum($idP);
    

    }
    
     if (isset($_SESSION['admin']) && ($_SESSION['admin']==1) ){
     ?>
				<form action="system.php" name="form2" method="post">
						<p><input type="hidden" name="akce" value="zmaz_pracu"/></p>
            <p><input type="hidden" name="id_prace" value="<?php echo "$idP";?>"></p>
	  				<input class="button" name="zmaz_pracu" type="submit" value="Zmaž" />
	       </form>   
	<?php 
    } 
    ?>
    <p class="more" id="intro">
            <?php echo "<a class=\"bar-litPonuka\" href=\"system.php?akce=ponuka\">menej</a>";?>
          
   </p>  
      
      
      <!-------------------->
      	</div>
				
					
	
		<div class="fineline"></div>
			<?php       
  $link = mysql_connect('mysql.ic.cz', 'yw_castav', 'majkamartin');
		if ($link) 
		{
			if (mysql_select_db('yw_castav', $link)) 
	{
	      $sql = "SELECT * FROM works";
				mysql_query("SET NAMES utf8");
				$result = mysql_query($sql, $link);
				if ($result){
					while ($row = mysql_fetch_assoc($result)){	
						$nazov = $row['name'];
						$id=$row['workid'];				
						$kratkypopis = $row['shorttext'];
						$dlhypopis = $row['longtext'];
						$uvodnyobrazok= $row['image'];
						if($id!=$idP){
	?>	
								
        <div class="praca">
           <img src="<?php echo "$uvodnyobrazok" ?>" width="109" height="108" alt="Pic 2" class="left" style="margin-left:20px;" />
				  	<h2><?php echo "$nazov" ?></h2>
						<p  style="margin-left:10px;"><?php echo "$kratkypopis" ?></p>
					  
					  </br>
					  </br>
					  <p class="more" id="intro">
            <?php echo "<a class=\"bar-litPonuka\" href=\"system.php?akce=ponuka&id=".$id."\">viac</a>";?>
            </p>
				</div>
					
	<?php if (isset($_SESSION['admin']) && ($_SESSION['admin']==1) ){?>
				<form action="system.php" name="form2" method="post">
						<p><input type="hidden" name="akce" value="zmaz_pracu"/></p>
            <p><input type="hidden" name="id_prace" value="<?php echo "$id";?>"></p>
	  				<input class="button" name="zmaz_pracu" type="submit" value="Zmaž" />
	       </form>   
	<?php 
    } 
    ?>
		<div class="fineline"></div>
  <?php
  }//end if
	  }
    ?>
			</p>
			</div><!--end content div!!-->
 <div class="clear"></div>
 
     <?php
	if (mysql_num_rows($result)==0){
	 			echo "Zatiaľ nemáme ziadnu ponuku";
		}
	  mysql_free_result($result);
	}
	else{
		echo '<p style="color: #FF0000;">Nastal problém pri spojení s databázou - ' . mysql_errno($link) . ': ' . mysql_error($link) . '</p>';
  }
} // end vyber db
mysql_close($link);
}
}

function Prezeraj_charPF2($idP,$forumP){
 ?>
   </div> <!--welcome-->
	 <div id="content">
			<p>	<h1>Ponuka</h1>
				<div class="fineline"></div>
 
  	<?php
  $link = mysql_connect('mysql.ic.cz', 'yw_castav', 'majkamartin');
		if ($link) 
		{
			if (mysql_select_db('yw_castav', $link)) 
	{
				$sql= "SELECT * FROM works WHERE workid='" . $idP ."'";
        mysql_query("SET NAMES utf8");
					$result = mysql_query($sql, $link);
					if (mysql_num_rows($result)==1){
		      	$row = mysql_fetch_assoc($result);
								$nazov = $row['name'];
					    	$id=$row['workid'];				
						    $kratkypopis = $row['shorttext'];
						    $dlhypopis = $row['longtext'];
						    $uvodnyobrazok= $row['image'];
      mysql_free_result($result);

      }
        ?>
        
        <div class="praca">
           <img src="<?php echo "$uvodnyobrazok" ?>" width="109" height="108" alt="Pic 2" class="left" style="margin-left:20px;" />
				  	<h2><?php echo "$nazov" ?></h2>
						<p  style="margin-left:10px;"><?php echo "$kratkypopis" ?></p>
					  <p style="margin-left:10px;"><?php echo "$dlhypopis" ?></p>
					  </br>
					  </br>
					  
			<!----------------------------------------->
    <?php  
    ZobrazGaleria("work/".$nazov."/");  
    if($forumP==1){ZobrazForum($idP);}
    else{ ZobrazForum2($idP);}
    
    
    }//if mysql select
    ?>
    <p class="more" id="intro">
            <?php echo "<a class=\"bar-litPonuka\" href=\"system.php?akce=ponuka\">menej</a>";?>
          
   </p>  
      
      
      <!-------------------->
      	</div>
		<?php
    mysql_close($link);

    }
   if ($_SESSION['admin']){?>
				<form action="system.php" name="form2" method="post">
						<p><input type="hidden" name="akce" value="zmaz_pracu"/></p>
            <p><input type="hidden" name="id_prace" value="<?php echo "$idP";?>"></p>
	  				<input class="button" name="zmaz_pracu" type="submit" value="Zmaž" />
	       </form>   
	<?php 
    } 
    ?>
		<div class="fineline"></div>
				
	<?php      
  $link = mysql_connect('mysql.ic.cz', 'yw_castav', 'majkamartin');
		if ($link) 
		{
			if (mysql_select_db('yw_castav', $link)) 
	{
	     $sql = "SELECT * FROM works";
				mysql_query("SET NAMES utf8");
				$result = mysql_query($sql, $link);
				if ($result){
					while ($row = mysql_fetch_assoc($result)){	
						$nazov = $row['name'];
						$id=$row['workid'];				
						$kratkypopis = $row['shorttext'];
						$dlhypopis = $row['longtext'];
						$uvodnyobrazok= $row['image'];
						if($id!=$idP){
	?>	
								
        <div class="praca">
           <img src="<?php echo "$uvodnyobrazok" ?>" width="109" height="108" alt="Pic 2" class="left" style="margin-left:20px;" />
				  	<h2><?php echo "$nazov" ?></h2>
						<p style="margin-left:10px;" ><?php echo "$kratkypopis" ?></p>
					  
					  </br>
					  </br>
					  <p class="more" id="intro">
            <?php echo "<a class=\"bar-litPonuka\" href=\"system.php?akce=ponuka&id=".$id."\">viac</a>";?>
            </p>
				</div>
					
	<?php if ($_SESSION['admin']){?>
				<form action="system.php" name="form2" method="post">
						<p><input type="hidden" name="akce" value="zmaz_pracu"/></p>
            <p><input type="hidden" name="id_prace" value="<?php echo "$id";?>"></p>
	  				<input class="button" name="zmaz_pracu" type="submit" value="Zmaž" />
	       </form>   
	<?php 
    } 
    ?>
		<div class="fineline"></div>
  <?php
  }//end if
	  }
    ?>
			</p>
			</div><!--end content div!!-->
 <div class="clear"></div>
 
     <?php
	if (mysql_num_rows($result)==0){
	 			echo "Zatiaľ nemáme ziadnu ponuku";
		}
	  mysql_free_result($result);
	}
	else{
		echo '<p style="color: #FF0000;">Nastal problém pri spojení s databázou - ' . mysql_errno($link) . ': ' . mysql_error($link) . '</p>';
  }
} // end vyber db
mysql_close($link);
}
}


?>
