<div id="sidebar">
<?php
// Function <span class="posthilit">to</span> generate three different IDs

function get_rands($min, $max, $amount)
{
   echo("min: ($min), max: ($max), amount: ($amount)<br>\n");
   $amount = (int) $amount;
      
   $rands = array();
   $rand = false;
   $i = 0;
   
   for($i = 0; $i < $amount; ++$i)
   {
	  echo ("in for<br>\n");
	  
      while(!$rand || in_array($rand, $rands))
      {
	      
	     echo("\tin while<br>\n");
         $rand = rand($min, $max);
      }
      
      $rands[] = $rand;
   }
   
   
return $rands;
}


 
/** The images that would be shown. Editing Explanation: 'source_to_image' => 'website_link'
*/
$images = array(
      'image1.jpg' => 'http://www.scopeproduction.com',
      'image2.jpg' => 'http://www.gimlicommunityweb.com',
      'image3.jpg' => 'http://www.gimlicurlingclub.ca',
      'image4.jpg' => 'http://www.gokbl.com/',
      'image5.jpg' => 'http://www.elektrus1.ca',
      'image6.jpg' => 'http://www.bordertownhog.com/',
);
//** You don't have <span class="posthilit">to</span> edit below this line **//
// Initiating the $image array
$image = array();
// ID that would be provided for each image
$i = 0;
// The KEY is the image and the $value is the <span class="posthilit">link</span>

foreach($images as $key => $value)
{
   $image[$i]['<span class="posthilit">LINK</span>'] = $value;
   $image[$i]["IMAGE"] = $key;
   ++$i;
}
$id = get_rands(0,5,6);

 
// Get 3 different IDs
$id = get_rands(1,3,3);

// Printing the <span class="posthilit">random</span> IDs for debug... remove or comment when not needed
//print_r($id);
 
// Assign IDs <span class="posthilit">to</span> the variables
$id1 = $id[0];
$id2 = $id[1];
$id3 = $id[2];
$id4 = $id[3];
$id5 = $id[4];
$id6 = $id[5];

foreach ($id as $key => $value) {
	echo("key: ($key), value: ($value)<br>\n");
}//end foreach
 
// Defining three different images and links for use
 
// Group 1
$link1 = $image[$id1]['<span class="posthilit">LINK</span>'];
$image1 = $image[$id1]['IMAGE'];
//echo("image1: ($image1)<br>\n");
// Group 2
$link2 = $image[$id2]['<span class="posthilit">LINK</span>'];
$image2 = $image[$id2]['IMAGE'];
//echo("image2: ($image2)<br>\n");
// Group 3
$link3 = $image[$id3]['<span class="posthilit">LINK</span>'];
$image3 = $image[$id3]['IMAGE'];
//echo("image3: ($image3)<br>\n");
/*
// Group 4
$link4 = $image[$id4]['<span class="posthilit">LINK</span>'];
$image4 = $image[$id4]['IMAGE'];
echo("image4: ($image4)<br>\n");
// Group 5
$link5 = $image[$id5]['<span class="posthilit">LINK</span>'];
$image5 = $image[$id5]['IMAGE'];
echo("image5: ($image5)<br>\n");
// Group 5
$link6 = $image[$id6]['<span class="posthilit">LINK</span>'];
$image6 = $image[$id6]['IMAGE'];
echo("image6: ($image6)<br>\n");
*/

// Echoing the HTML...
//echo("image1 = ($image1), image2: ($image2), image3: ($image3)<br>\n");


echo <<<EOT
<div class="box">
<a href="$link1" target="_blank"><img src="$image1" alt="$image1"  border="0"/></a></div>
<div class="box">
<a href="$link2" target="_blank"><img src="$image2" alt="$image2"  border="0"/></a></div>
<div class="box">
<a href="$link3" target="_blank"><img src="$image3" alt="$image3"  border="0"/></a></div>
EOT;
 
?>
</div>
