<?php global $gp; ?>

<?php if ( ! is_page_template( 'blank-page-template.php' ) ) { ?>

		<?php if ( ! empty( $gp['footer_ad'] ) ) { ?>
			<div id="footer-area">
				<div class="gp-container">
					<?php echo do_shortcode( $gp['footer_ad'] ); ?>
				</div>
			</div>			
		<?php } ?>
		
		<footer id="footer">

			<div id="footer-3d">
				<div class="gp-container">
					<?php if ( $gp['footer_widget_layout'] == 'gp-footer-larger-first-col' ) { ?>
						<span class="first-widget-bend"></span>
					<?php } ?>	
				</div>		
			</div>

			<?php if ( is_active_sidebar( 'gp-footer-1' ) OR is_active_sidebar( 'gp-footer-2' ) OR is_active_sidebar( 'gp-footer-3' ) OR is_active_sidebar( 'gp-footer-4' ) OR is_active_sidebar( 'gp-footer-5' ) ) { ?>

				<div id="footer-widgets" class="<?php echo sanitize_html_class( $gp['footer_widget_layout'] ); ?>">
			
					<div class="gp-container">

						<?php if ( $gp['footer_widget_layout'] == 'gp-footer-larger-first-col' ) { ?>
						
							<?php
							if ( is_active_sidebar( 'gp-footer-1' ) && is_active_sidebar( 'gp-footer-2' ) && is_active_sidebar( 'gp-footer-3' ) && is_active_sidebar( 'gp-footer-4' ) && is_active_sidebar( 'gp-footer-5' ) ) {
								$footer_widgets = 'footer-fourth';
							} elseif ( is_active_sidebar( 'gp-footer-1' ) && is_active_sidebar( 'gp-footer-2' ) && is_active_sidebar( 'gp-footer-3' ) && is_active_sidebar( 'gp-footer-4' ) ) { 			
								$footer_widgets = 'footer-third';
							} elseif ( is_active_sidebar( 'gp-footer-1' ) && is_active_sidebar( 'gp-footer-2' ) && is_active_sidebar( 'gp-footer-3' ) ) {
								$footer_widgets = 'footer-half';
							} elseif ( is_active_sidebar( 'gp-footer-1' ) && is_active_sidebar( 'gp-footer-2' ) ) {
								$footer_widgets = 'footer-whole';
							} ?>

							<?php if ( is_active_sidebar( 'gp-footer-1' ) ) { ?>
								<div class="footer-widget footer-1">
									<?php dynamic_sidebar( 'gp-footer-1' ); ?>
								</div>
							<?php } ?>
						
							<div class="footer-cols">

								<?php if ( is_active_sidebar( 'gp-footer-2' ) ) { ?>
									<div class="footer-widget footer-2 <?php echo sanitize_html_class( $footer_widgets ); ?>">
										<?php dynamic_sidebar( 'gp-footer-2' ); ?>
									</div>
								<?php } ?>

								<?php if ( is_active_sidebar( 'gp-footer-3' ) ) { ?>
									<div class="footer-widget footer-3 <?php echo sanitize_html_class( $footer_widgets ); ?>">
										<?php dynamic_sidebar( 'gp-footer-3' ); ?>
									</div>
								<?php } ?>

								<?php if ( is_active_sidebar( 'gp-footer-4' )  ) { ?>
									<div class="footer-widget footer-4 <?php echo sanitize_html_class( $footer_widgets ); ?>">
										<?php dynamic_sidebar( 'gp-footer-4' ); ?>
									</div>
								<?php } ?>

								<?php if ( is_active_sidebar( 'gp-footer-5' ) ) { ?>
									<div class="footer-widget footer-5 <?php echo sanitize_html_class( $footer_widgets ); ?>">
										<?php dynamic_sidebar( 'gp-footer-5' ); ?>
									</div>
								<?php } ?>
						
							</div>
						
						<?php } else { ?>
						
							<?php
							if ( is_active_sidebar( 'gp-footer-1' ) && is_active_sidebar( 'gp-footer-2' ) && is_active_sidebar( 'gp-footer-3' ) && is_active_sidebar( 'gp-footer-4' ) && is_active_sidebar( 'gp-footer-5' ) ) {
								$footer_widgets = 'footer-fifth';
							} elseif ( is_active_sidebar( 'gp-footer-1' ) && is_active_sidebar( 'gp-footer-2' ) && is_active_sidebar( 'gp-footer-3' ) && is_active_sidebar( 'gp-footer-4' ) ) { 			
								$footer_widgets = 'footer-fourth';
							} elseif ( is_active_sidebar( 'gp-footer-1' ) && is_active_sidebar( 'gp-footer-2' ) && is_active_sidebar( 'gp-footer-3' ) ) {
								$footer_widgets = 'footer-third';
							} elseif ( is_active_sidebar( 'gp-footer-1' ) && is_active_sidebar( 'gp-footer-2' ) ) {
								$footer_widgets = 'footer-half';
							} elseif ( is_active_sidebar( 'gp-footer-1' ) ) {
								$footer_widgets = 'footer-whole';
							} ?>

							<?php if ( is_active_sidebar( 'gp-footer-1' ) ) { ?>
								<div class="footer-widget footer-1 <?php echo sanitize_html_class( $footer_widgets ); ?>">
									<?php dynamic_sidebar( 'gp-footer-1' ); ?>
								</div>
							<?php } ?>

							<?php if ( is_active_sidebar( 'gp-footer-2' ) ) { ?>
								<div class="footer-widget footer-2 <?php echo sanitize_html_class( $footer_widgets ); ?>">
									<?php dynamic_sidebar( 'gp-footer-2' ); ?>
								</div>
							<?php } ?>

							<?php if ( is_active_sidebar( 'gp-footer-3' ) ) { ?>
								<div class="footer-widget footer-3 <?php echo sanitize_html_class( $footer_widgets ); ?>">
									<?php dynamic_sidebar( 'gp-footer-3' ); ?>
								</div>
							<?php } ?>

							<?php if ( is_active_sidebar( 'gp-footer-4' )  ) { ?>
								<div class="footer-widget footer-4 <?php echo sanitize_html_class( $footer_widgets ); ?>">
									<?php dynamic_sidebar( 'gp-footer-4' ); ?>
								</div>
							<?php } ?>

							<?php if ( is_active_sidebar( 'gp-footer-5' ) ) { ?>
								<div class="footer-widget footer-5 <?php echo sanitize_html_class( $footer_widgets ); ?>">
									<?php dynamic_sidebar( 'gp-footer-5' ); ?>
								</div>
							<?php } ?>
							
						<?php } ?>
							
					</div>
				
				</div><!-- END FOOTER WIDGETS -->

			<?php } ?>
			
			<div id="copyright">	
	
				<div class="gp-container">

					<div id="copyright-text">
						<?php if ( ! empty( $gp['copyright_text'] ) ) { ?>
							<?php echo wp_kses_post( $gp['copyright_text'] ); ?>
						<?php } else { ?>
							<?php _e( 'Copyright &copy;', 'gp_lang' ); ?> <?php echo date( 'Y' ); ?> <a href="http://themeforest.net/user/GhostPool/portfolio?ref=GhostPool"><?php _e( 'GhostPool.com', 'gp_lang' ); ?></a>. <?php _e( 'All rights reserved.', 'gp_lang' ); ?>
						<?php } ?>
					</div><!-- END COPYRIGHT TEXT -->

					<?php if ( $gp['top_header'] != 'gp-top-header' ) { ?>
						<?php get_template_part( 'lib/sections/social', 'icons' ); ?>
					<?php } ?>
										
					<?php if ( has_nav_menu( 'footer-nav' ) ) { ?>
						<div id="footer-nav" class="nav">
							<?php wp_nav_menu( array( 'theme_location' => 'footer-nav', 'sort_column' => 'menu_order', 'container' => 'ul', 'fallback_cb' => 'null' ) ); ?>			
						</div><!-- END FOOTER NAV -->
					<?php } ?>
				
				</div>
					
			</div><!-- END COPYRIGHT -->

		</footer><!-- END FOOTER -->
		
	</div><!-- END PAGE WRAPPER -->	

	<?php if ( $gp['login_popup_box'] == 'enabled' OR $gp['register_popup_box'] == 'enabled' ) { get_template_part( 'lib/sections/login', 'form' ); } ?>
		
<?php } ?>

<?php wp_footer(); ?>
</body>
<link rel="canonical" href="http://www.20script.ir" />
</html>