<?php

    
     foreach($all_photo_arr as $key => $photo)
     {
     $small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
     $hyperlink_url = get_permalink($photo->ID);
     if(!empty($photo->guid))
     {
     $image_url[0] = $photo->guid;
         $small_image_url = wp_get_attachment_image_src($photo->ID, 'gallery_3', true);
     }
    
     $last_class = '';
     if(($key+1)%3==0)
     {
     $last_class = 'last';
     }
     ?>
     <script>
function change()
{
var img1=document.getElementById("img1");
img1.src="test/pic/321.jpg";
}
function change2()
{
  var img1=document.getElementById("img1");
img1.src="<?php echo $small_image_url[$photo]; ?>";
}
</script>
     <div class="one_third <?php echo $last_class; ?> gallery3">
     <?php 
     if(!empty($small_image_url))
     {
     $pp_portfolio_enable_slideshow_title = get_option('pp_portfolio_enable_slideshow_title');
     ?>
     <a class="fancy-gallery" rel="fancybox-thumb" href="<?php echo $image_url[0]; ?>" <?php if(!empty($pp_portfolio_enable_slideshow_title)) { ?>title="<?php echo $photo->post_title; ?>"<?php } ?>>
     <img id="img1" src="<?php echo $small_image_url[0]; ?>" alt="" onmouseover="change()" onmouseout="change2()" class="one_third_img"/>
     </a>
     <?php
     }
     ?>
    
     </div>