<?php
/**
 * The template for displaying the footer.
 *
 * @package WordPress
 */
?>
	
	</div>
	
		<?php
			$pp_footer_clients = get_option('pp_footer_clients');
			if(!empty($pp_footer_clients))
			{
			
			$wp_query = null; 
			$wp_query = new WP_Query(); 
			$wp_query->query('showposts=-1&post_type=client&orderby=menu_order&order=ASC');
		?>
	
		<div id="client_wrapper">
			<div class="ppb_title headingbg center clients"><h5><?php _e( ' ', THEMEDOMAIN ); ?></h5></div>
		
			<?php
				while ($wp_query->have_posts()) : $wp_query->the_post(); 
					$client_ID = get_the_ID();
					$client_title = get_the_title();
					$client_logo = '';
				
					if(has_post_thumbnail($client_ID, 'slide'))
    		    	{
    		    	    $image_id = get_post_thumbnail_id($client_ID);
    		    	    $image_full = wp_get_attachment_image_src($image_id, 'full', true);
    		    	    $client_logo = $image_full[0];
    		    	}
    		    	
    		    	$client_desc = get_post_meta($client_ID, 'client_desc', true);
    		    	$client_url = get_post_meta($client_ID, 'client_url', true);
    		    	
    		    	if(!empty($client_logo))
    		    	{
			?>
					<a title="<?php echo $client_desc; ?>" href="<?php echo $client_url; ?>" target="_blank" class="tipsy">
						<img src="<?php echo $client_logo; ?>" alt="<?php echo $client_title; ?>"/>
					</a>
			<?php
					}
				endwhile;
			?>
			</div>
		
		</div>
		<?php
			}
		?>
		
		<!-- Begin footer -->
		<div id="footer">
			
			<?php
				$pp_footer_display_sidebar = get_option('pp_footer_display_sidebar');
			
				if(!empty($pp_footer_display_sidebar))
				{
					$pp_footer_style = get_option('pp_footer_style');
					$footer_class = '';
					
					switch($pp_footer_style)
					{
						case 1:
							$footer_class = 'one';
						break;
						case 2:
							$footer_class = 'two';
						break;
						case 3:
							$footer_class = 'three';
						break;
						case 4:
							$footer_class = 'four';
						break;
						default:
							$footer_class = 'four';
						break;
					}
					
			?>
			<ul class="sidebar_widget <?php echo $footer_class; ?>">
				<?php dynamic_sidebar('Footer Sidebar'); ?>
			</ul>
			
			<br class="clear"/>
			<?php
				}
			?>
			
		</div>
		<!-- End footer -->
		<div>
		<div>
		<div id="copyright" <?php if(empty($pp_footer_display_sidebar)) { echo 'style="border-top:0"'; } ?>>
			<div class="copyright_wrapper">
				<div class="left_wrapper">
				<?php
					/**
					 * Get footer left text
					 */
	
					$pp_footer_text = get_option('pp_footer_text');
					
					echo nl2br(stripslashes(html_entity_decode($pp_footer_text)));
				?>
				</div>
				
				<?php
			        $pp_footer_social = get_option('pp_footer_social');
			        
			        if(!empty($pp_footer_social))
			        {
			    ?>
				<div class="right_wrapper">
					<ul class="social_wrapper">
				    	<?php
				    		$pp_twitter_username = get_option('pp_twitter_username');
				    		
				    		if(!empty($pp_twitter_username))
				    		{
				    	?>
				    	<li><a title="Twitter" href="http://twitter.com/<?php echo $pp_twitter_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/twitter.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_facebook_username = get_option('pp_facebook_username');
				    		
				    		if(!empty($pp_facebook_username))
				    		{
				    	?>
				    	<li><a title="Facebook" href="http://facebook.com/<?php echo $pp_facebook_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/facebook.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_flickr_username = get_option('pp_flickr_username');
				    		
				    		if(!empty($pp_flickr_username))
				    		{
				    	?>
				    	<li><a title="Flickr" href="http://flickr.com/people/<?php echo $pp_flickr_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/flickr.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_youtube_username = get_option('pp_youtube_username');
				    		
				    		if(!empty($pp_youtube_username))
				    		{
				    	?>
				    	<li><a title="Youtube" href="http://youtube.com/user/<?php echo $pp_youtube_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/youtube.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_vimeo_username = get_option('pp_vimeo_username');
				    		
				    		if(!empty($pp_vimeo_username))
				    		{
				    	?>
				    	<li><a title="Vimeo" href="http://vimeo.com/<?php echo $pp_vimeo_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/vimeo.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_tumblr_username = get_option('pp_tumblr_username');
				    		
				    		if(!empty($pp_tumblr_username))
				    		{
				    	?>
				    	<li><a title="Tumblr" href="http://<?php echo $pp_tumblr_username; ?>.tumblr.com"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/tumblr.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_google_username = get_option('pp_google_username');
				    		
				    		if(!empty($pp_google_username))
				    		{
				    	?>
				    	<li><a title="Google+" href="<?php echo $pp_google_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/google.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_dribbble_username = get_option('pp_dribbble_username');
				    		
				    		if(!empty($pp_dribbble_username))
				    		{
				    	?>
				    	<li><a title="Dribbble" href="http://dribbble.com/<?php echo $pp_dribbble_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/dribbble.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_digg_username = get_option('pp_digg_username');
				    		
				    		if(!empty($pp_digg_username))
				    		{
				    	?>
				    	<li><a title="Digg" href="http://digg.com/<?php echo $pp_digg_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/digg.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_linkedin_username = get_option('pp_linkedin_username');
				    		
				    		if(!empty($pp_linkedin_username))
				    		{
				    	?>
				    	<li><a title="Linkedin" href="<?php echo $pp_linkedin_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/linkedin.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
			        		$pp_pinterest_username = get_option('pp_pinterest_username');
			        		
			        		if(!empty($pp_pinterest_username))
			        		{
			        	?>
			        	<li><a title="Pinterest" href="http://pinterest.com/<?php echo $pp_pinterest_username; ?>" target="_blank"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/pinterest.png" alt=""/></a></li>
			        	<?php
			        		}
			        	?>
			        	<?php
			        		$pp_instagram_username = get_option('pp_instagram_username');
			        		
			        		if(!empty($pp_instagram_username))
			        		{
			        	?>
			        	<li><a title="Instagram" href="http://instagram.com/<?php echo $pp_instagram_username; ?>" target="_blank"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_white/instagram.png" alt=""/></a></li>
			        	<?php
			        		}
			        	?>
				    </ul>				
				</div>
				<?php
				}
				?>
				<br class="clear"/>
			</div>
			</div>
		
		</div>
	
	</div>
		
	<div id="toTop">
		<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/arrow_up_24x24.png" alt=""/>
	</div>

<?php
		/**
    	*	Setup Google Analyric Code
    	**/
    	get_template_part( "google-analytic");
?>

<?php
	/* Always have wp_footer() just before the closing </body>
	 * tag of your theme, or you will break many plugins, which
	 * generally use this hook to reference JavaScript files.
	 */

	wp_footer();
?>
</body>
</html>