<?php if($postcount=="1") { ?>
	
    <div class="panelwrap clearfix" style="height:<?php echo $DYN_galleryheight; ?>px">

<?php } ?>


	<div class="panel <?php if($postcount!="1") { ?> border-left <?php } else { ?> border-first <?php } ?>">
    
<?php if($DYN_groupgridcontent!="text") { ?> 

    <?php if($DYN_videotype) { // Check "Preview Image" field is completed ?>    
   
		<div class="container videotype <?php if($DYN_imageeffect=="shadow") { echo $DYN_shadowsize; ?> shadow<?php } elseif($DYN_imageeffect=="reflection") { ?>reflection<?php } elseif($DYN_imageeffect=="shadowreflection") { echo $DYN_shadowsize; ?> shadowreflection<?php } ?>">
			<div class="gridimg-wrap" style="width:<?php echo $DYN_imgwidth; ?>px;height:<?php echo $DYN_imgheight; ?>px">
                             			
				<?php           
 
				$vidurl = $DYN_movieurl;
				$file = basename($vidurl); 
				$parts = explode(".", $file); 
				//File name 
				$vidid = $parts[0]; 
  				if($DYN_videotype=="youtube") {
				
					$vidid = strstr($vidid,'='); // trim id after = 
					$vidid = substr($vidid, 1); // remove =			
					
				} elseif($DYN_videotype=="swf" || $DYN_videotype=="jwp") {
					$vidid = $vidurl;
				}
				
				if($DYN_videotype=="youtube") { ?>
				
				<iframe class="youtube-player" type="text/html" width="<?php echo $DYN_imgwidth; ?>" height="<?php echo $DYN_imgheight; ?>" src="http://www.youtube.com/embed/<?php echo $vidid; ?>?autoplay=<?php echo $DYN_videoautoplay ?>&amp;wmode=opaque&amp;title="></iframe>
				
				<?php } elseif($DYN_videotype=="vimeo") { ?>
				
				<iframe src="http://player.vimeo.com/video/<?php echo $vidid; ?>?autoplay=<?php echo $DYN_videoautoplay ?>&amp;title=0&amp;byline=0&amp;portrait=0" width="<?php echo $DYN_imgwidth; ?>" height="<?php echo $DYN_imgheight; ?>"></iframe>
				
				<?php } elseif($DYN_videotype=="swf") {?>
				
			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="<?php echo $DYN_imgwidth; ?>" height="<?php echo $DYN_imgheight; ?>">
				<param name="movie" value="<?php echo $vidid; ?><?php if($DYN_videotype!="swf") { ?>&amp;autoplay=<?php echo $DYN_videoautoplay ?><?php } ?>" />
                <param name="wmode" value="transparent" />
                <param name="allowfullscreen" value="true" />
				<param name="allowscriptacess" value="always" />
           		<!--[if !IE]>-->                
				<object type="application/x-shockwave-flash" data="<?php echo $vidid; ?><?php if($DYN_videotype!="swf") { ?>&amp;autoplay=<?php echo $DYN_videoautoplay ?><?php } ?>" width="<?php echo $DYN_imgwidth; ?>" height="<?php echo $DYN_imgheight; ?>">
                <param name="wmode" value="transparent" />
                <param name="allowfullscreen" value="true" />
				<param name="allowscriptacess" value="always" />				
                <!--<![endif]-->
				<div>
					<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
				</div>
				<!--[if !IE]>-->
				</object>
				<!--<![endif]-->
			</object>
				
			<?php } elseif($DYN_videotype=="jwp") {?>

            <div id="<?php echo $slide_id; ?>"></div>
            <script type="text/javascript">
              jwplayer('<?php echo $slide_id; ?>').setup({
                'id': 'player_<?php echo $slide_id; ?>',
                'width': '<?php echo $DYN_imgwidth; ?>',
                'height': '<?php echo $DYN_imgheight; ?>',
                'file': '<?php echo $vidid; ?>',
				<?php if($DYN_imgwidth <="250") { ?>
				'controlbar': 'false',
				<?php } ?>
				'wmode': 'transparent',
				'controlbar.idlehide':'true',
				'stretching': 'exactfit',
                'image': '<?php echo dyn_getimagepath($DYN_previewimgurl); ?>',
				'players': [
					{type: 'flash', src: '<?php echo get_option('jwplayer_swf'); ?>'},
					{type: 'html5'},
                    {type: 'download'}
                ]
              });
			  
			jQuery(document).ready(function() {
    			jQuery('#<?php echo $slide_id; ?>').addClass('jwplayer'); 
				if("1"=="<?php echo $DYN_videoautoplay; ?>") {
					jQuery('#<?php echo $slide_id; ?>').addClass('autostart'); 
					if("1"=="<?php echo $postcount; ?>") {
					jQuery('#<?php echo $slide_id; ?>').addClass('first'); 
					} 
				}
			});		
            </script>

			<?php } ?>

    	
			</div><!-- / gridimg-wrap -->
		</div><!-- / container -->		    
        
    <?php } elseif($DYN_previewimgurl) { // Check "Preview Image" field is completed ?>            
 
   
		<div class="container <?php if($DYN_imageeffect=="shadow") { echo $DYN_shadowsize; ?> shadow<?php } elseif($DYN_imageeffect=="reflection") { ?>reflection<?php } elseif($DYN_imageeffect=="shadowreflection") { echo $DYN_shadowsize; ?> shadowreflection<?php } ?>">
			<div class="gridimg-wrap">
                	
				<?php if($DYN_lightbox=="yes") { ?><a href="<?php if($DYN_movieurl) { echo $DYN_movieurl; } else { echo $DYN_previewimgurl; } ?>" rel="prettyPhoto[gallery]" <?php if($DYN_movieurl) { ?> class="galleryvid" <?php } else { ?> class="galleryimg" <?php } ?> style="height:<?php echo $DYN_imgheight;?>px"><?php } elseif(!$DYN_disablegallink) { ?><a href="<?php if($DYN_galexturl) { echo $DYN_galexturl; } else { echo get_permalink($post->ID); } ?>" title="<?php if($DYN_slidesetid) { echo $DYN_posttitle; } else { the_title(); } ?>"><?php } ?>
                
					<img <?php if($DYN_imageeffect=="reflection" || $DYN_imageeffect=="shadowreflection") { ?>class="reflect"<?php } ?> src="<?php bloginfo('template_directory'); ?>/lib/scripts/timthumb.php?src=<?php echo dyn_getimagepath($DYN_previewimgurl); ?>&amp;h=<?php echo $DYN_imgheight; ?>&amp;w=<?php echo $DYN_imgwidth; ?>&amp;zc=<?php if($DYN_imgzoomcrop!="zoom") {?>0<?php } else {?>1<?php } ?>" alt="<?php if($DYN_slidesetid) { echo $DYN_posttitle; } else { the_title(); } ?>" width="<?php echo $DYN_imgwidth; ?>" height="<?php echo $DYN_imgheight; ?>" />
				<?php if(!$DYN_disablegallink || $DYN_lightbox=="yes") { ?>
					</a>
				<?php } ?>
            	
			</div><!-- / gridimg-wrap -->
		</div><!-- / container -->				
				
	<?php } elseif($image) { // Check image exists within post ?>
            	
         <div class="container <?php if($DYN_imageeffect=="shadow") { echo $DYN_shadowsize; ?> shadow<?php } elseif($DYN_imageeffect=="reflection") { ?>reflection<?php } elseif($DYN_imageeffect=="shadowreflection") { echo $DYN_shadowsize; ?> shadowreflection<?php } ?>">
            <div class="gridimg-wrap">
                   
				<?php if($DYN_lightbox=="yes") { ?><a href="<?php if($DYN_movieurl) { echo $DYN_movieurl; } else { echo $image; } ?>" rel="prettyPhoto[gallery]" <?php if($DYN_movieurl) { ?> class="galleryvid" <?php } else { ?> class="galleryimg" <?php } ?> style="height:<?php echo $DYN_imgheight;?>px" ><?php } elseif(!$DYN_disablegallink) { ?><a href="<?php if($DYN_galexturl) { echo $DYN_galexturl; } else { echo get_permalink($post->ID); } ?>" title="<?php echo the_title(); ?>"><?php } ?>
                
					<img <?php if($DYN_imageeffect=="reflection" || $DYN_imageeffect=="shadowreflection") { ?>class="reflect"<?php } ?> src="<?php bloginfo('template_directory'); ?>/lib/scripts/timthumb.php?src=<?php echo dyn_getimagepath($image); ?>&amp;h=<?php echo $DYN_imgheight; ?>&amp;w=<?php echo $DYN_imgwidth; ?>&amp;zc=<?php if($DYN_imgzoomcrop!="zoom") {?>0<?php } else {?>1<?php } ?>" alt="<?php the_title(); ?>" width="<?php echo $DYN_imgwidth; ?>" height="<?php echo $DYN_imgheight; ?>" />
				<?php if(!$DYN_disablegallink || $DYN_lightbox=="yes") { ?>
					</a>
				<?php } ?>
                
			</div><!-- / gridimg-wrap --> 
		</div><!-- / container-->		         
     
    
	<?php }
	
	} ?>        
        

<?php if($DYN_groupgridcontent!="image" && $DYN_slidesetid=="") { ?>         
        
		<div class="panelcontent" <?php if($DYN_groupgridcontent=="text") { ?>style="padding-top:15px;"<?php } ?>>
			<h2><?php if(!$DYN_disablegallink) { ?><a href="<?php if($DYN_galexturl) { echo $DYN_galexturl; } else { echo get_permalink($post->ID); } ?>" title="<?php echo the_title(); ?>"><?php } ?><?php echo the_title(); ?><?php if(!$DYN_disablegallink) { ?></a><?php } ?></h2>

<?php if($DYN_groupgridcontent!="titleimage") { ?> 

			<?php global $more; $more = FALSE; ?>
			<?php if ( empty($post->post_excerpt) ) {
    					
				the_excerpt_reloaded($DYN_galleryexcerpt, '<a>', 'content', false);
				if(!$DYN_disablegallink && !$DYN_disablereadmore) { ?>
				<a href="<?php if($DYN_galexturl) { echo $DYN_galexturl; } else { echo get_permalink($post->ID); } ?>"><?php echo GEN_TERM_A; ?></a>
				<?php }
			} else {
						
				the_excerpt(); 
				if(!$DYN_disablegallink && !$DYN_disablereadmore) { ?>
				<a href="<?php if($DYN_galexturl) { echo $DYN_galexturl; } else { echo get_permalink($post->ID); } ?>"><?php echo GEN_TERM_A; ?></a>
				<?php }
    					

			} 
			
			} ?>
       		
		</div><!-- /panelcontent --> 			
			
<?php } elseif($DYN_groupgridcontent!="image" && $DYN_slidesetid!="") { ?>  

		<div class="panelcontent">
			<h2><?php if(!$DYN_disablegallink) { ?><a href="<?php if($DYN_galexturl) { echo $DYN_galexturl; } ?>" title="<?php echo $DYN_posttitle; ?>"><?php } ?><?php echo $DYN_posttitle; ?><?php if(!$DYN_disablegallink) { ?></a><?php } ?></h2>
			
			<?php if($DYN_groupgridcontent!="titleimage")  { ?>
            
			<?php echo do_shortcode($DYN_description);
			
			if(!$DYN_disablegallink && !$DYN_disablereadmore) { ?>
			<p><a href="<?php if($DYN_galexturl) { echo $DYN_galexturl; } ?>"><?php echo GEN_TERM_A; ?></a></p>
			<?php }			
			
			} ?>
       		
		</div><!-- /panelcontent --> 
     
<?php } ?>
	
    </div><!-- /panel -->     
        

<?php if($postcount=="3") { 
	$postcount="0";
?>
	</div><!--  / panelwrap -->
<?php } ?>    