<?php
// © CMSFARSI 2013
// GNU General Public License


defined('_JEXEC') or die;

// A code to show the offline.php page for the demo
if (JRequest::getCmd("tmpl", "index") == "offline") {
    if (is_file(JPATH_ROOT . "/templates/" . $this->template . "/offline.php")) {
        require_once(JPATH_ROOT . "/templates/" . $this->template . "/offline.php");
    } else {
        if (is_file(JPATH_ROOT . "/templates/system/offline.php")) {
            require_once(JPATH_ROOT . "/templates/system/offline.php");
        }
    }
} else {
	
// Include Variables
include_once(JPATH_ROOT . "/templates/" . $this->template . '/cmstools/vars.php');

?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>

<?php if ($this->params->get('responsive_template')) { ?>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php } ?>
	
<jdoc:include type="head" />

	<?php
    // Include CSS and JS variables 
    include_once(JPATH_ROOT . "/templates/" . $this->template . '/cmstools/css.php');
    ?>
        
</head>

<body class="<?php echo $pageclass->get('pageclass_sfx'); ?>">

<div id="content_wraper" class="container">

    <!-- header -->
    <header id="header">
	
         <div id="logo">	
         	<a href="<?php echo $this->baseurl ?>"><?php echo $logo; ?></a>	
         </div>
            
        <div id="header_right"> 
            <?php if ($this->countModules('language')) { ?>
                <div id="language">	
                   <jdoc:include type="modules" name="language" />
                </div> 
            <?php } ?>
            
            <?php if ($this->countModules('topmenu')) { ?>
                <div id="topmenu">
                  <jdoc:include type="modules" name="topmenu" />
                </div>
            <?php } ?>
            
            <?php if ($this->countModules('search')) { ?>
               <div id="search">
					<jdoc:include type="modules" name="search" />
               </div>
            <?php } ?>       
        </div>
                    
	</header><!-- /header --> 
    
    <div id="mainmenu" class="container clearfix">
    	<div class="mainmenu">
    		<jdoc:include type="modules" name="mainmenu" />
    	</div>
    </div>
    
    <!-- Content -->
    <section id="content">
              
		<?php if ($this->countModules('iceslideshow')) { ?>
        <div id="iceslideshow">
            <jdoc:include type="modules" name="iceslideshow" />
        </div>
        <?php } ?>

        <jdoc:include type="modules" name="breadcrumbs" />

        <?php if ($this->countModules('categories')) { ?>
        <div id="categories">
           <jdoc:include type="modules" name="categories" />
        </div>
        <?php } ?>
        
        <?php if ($this->countModules('icecarousel')) { ?>
        <div id="icecarousel"> 
            <jdoc:include type="modules" name="icecarousel" style="slider" />           
        </div>   
        <?php } ?>
        
        <!-- content -->
        <div id="content_inner">
               
            <!-- promo --> 
            <?php if ($this->countModules('promo1 + promo2 + promo3 + promo4')) { ?>
            <div id="promo" class="row" >
                                                
                <?php if ($this->countModules('promo1')) { ?>
                <div class="<?php echo $promospan;?>">	
                    <jdoc:include type="modules" name="promo1" style="block" />
                </div> 
                <?php } ?>
                
                <?php if ($this->countModules('promo2')) { ?>
                <div class="<?php echo $promospan;?>">	
                    <jdoc:include type="modules" name="promo2" style="block" />
                </div> 
                <?php } ?>
                
                <?php if ($this->countModules('promo3')) { ?>
                <div class="<?php echo $promospan;?>">	
                    <jdoc:include type="modules" name="promo3" style="block" />
                </div> 
                <?php } ?>
                
                <?php if ($this->countModules('promo4')) { ?>
                <div class="<?php echo $promospan;?>">	
                    <jdoc:include type="modules" name="promo4" style="block" />
                </div> 
                <?php } ?>
                                              
            </div><!-- /promo --> 
            <?php } ?>
        
          
            <div class="row">
            
                <!-- Middle Col -->
                <div id="middlecol" class="<?php echo $content_span;?>">
                
                    <div class="inside">
                                               
                    <jdoc:include type="message" />
                    
                    <jdoc:include type="component" />
                    
                    </div>
                
                </div><!-- / Middle Col  -->
                
                <?php if( $this->countModules('sidebar') ){ ?>  
                <!-- sidebar -->
                <div id="sidebar" class="<?php echo $sidebar_span;?> <?php if($this->params->get('sidebar_position') == 'right') {  echo 'sidebar_right'; } ?>" >
                    <div class="inside">
                        
                        <jdoc:include type="modules" name="sidebar" style="sidebar" />
                    
                    </div>
                
                </div>
                <!-- /sidebar -->
                <?php } ?>
                
            </div>
            
        
        </div>
            
                
        <!-- bottom --> 
        <?php if ($this->countModules('bottom1 + bottom2 + bottom3 + bottom4')) { ?>
        <div id="bottom">
        
                <div class="row">
                    
                    <?php if ($this->countModules('bottom1')) { ?>
                    <div class="<?php echo $bottomspan;?>">	
                        <jdoc:include type="modules" name="bottom1" style="block" />
                    </div> 
                    <?php } ?>
                    
                    <?php if ($this->countModules('bottom2')) { ?>
                    <div class="<?php echo $bottomspan;?>">	
                        <jdoc:include type="modules" name="bottom2" style="block" />
                    </div> 
                    <?php } ?>
                    
                    <?php if ($this->countModules('bottom3')) { ?>
                    <div class="<?php echo $bottomspan;?>">	
                        <jdoc:include type="modules" name="bottom3" style="block" />
                    </div> 
                    <?php } ?>
                    
                    <?php if ($this->countModules('bottom4')) { ?>
                    <div class="<?php echo $bottomspan;?>">	
                        <jdoc:include type="modules" name="bottom4" style="block" />
                    </div> 
                    <?php } ?>
                    
                </div>  
                
        </div><!-- /bottom --> 
        <?php } ?>
        
    </section><!-- / Content  --> 
    
    
    <?php if ($this->countModules('clients')) { ?>
    <div id="clients" class="clearfix"> 
        <jdoc:include type="modules" name="clients" style="slider" />           
    </div>   
    <?php } ?>
        
  
    <!-- footer --> 
    <footer id="footer" class="clearfix">
    
        <?php if ($this->countModules('message')) { ?>
           <div id="ice_message">	
               <jdoc:include type="modules" name="message" />
           </div> 
        <?php } ?>
        
        <div class="row">
         
            <?php if ( $this->countModules('about') || $this->params->get('social_icons')) {  ?>
            <div id="about" class="<?php echo $footerwrap2_span;?>">
               
                <div id="ice_about">	
                   
                    <jdoc:include type="modules" name="about" />
                    
                    <!-- social -->
                    <div id="social_icons">
                                     
                        <ul>
                            <?php if($this->params->get('social_icon_fb')) { ?>
                                <li class="social_facebook">
                                    <a target="_blank" rel="tooltip" data-placement="bottom" title="" data-original-title="<?php echo JText::_('SOCIAL_FACEBOOK_TITLE'); ?>" href="http://www.facebook.com/<?php echo $social_fb_user; ?>"><span>Facebook</span></a>			
                                </li>				
                            <?php } ?>	
                        
                            <?php if($this->params->get('social_icon_tw')) { ?>
                                <li class="social_twitter">
                                    <a target="_blank" rel="tooltip" data-placement="bottom" title="" data-original-title="<?php echo JText::_('SOCIAL_TWITTER_TITLE'); ?>" href="http://www.twitter.com/<?php echo $social_tw_user; ?>" ><span>Twitter</span></a>
                                </li>
                            <?php } ?>
                            
                            <?php if($this->params->get('social_icon_youtube')) { ?>
                                <li class="social_youtube">
                                    <a target="_blank" rel="tooltip" data-placement="bottom" title="" data-original-title="<?php echo JText::_('SOCIAL_YOUTUBE_TITLE'); ?>" href="http://www.youtube.com/user/<?php echo $social_yt_user; ?>" ><span>Youtube</span></a>
                                </li>
                            <?php } ?>
                            
                            <?php if($this->params->get('googleplus')) { ?>
                                <li class="social_google">
                                    <a target="_blank" rel="tooltip" data-placement="bottom" title="" data-original-title="<?php echo JText::_('SOCIAL_GOOGLE_TITLE'); ?>" href="https://plus.google.com/<?php echo $googleplus_id; ?>" ><span>Google</span></a>
                                </li>
                            <?php } ?>
                            
                            <?php if($this->params->get('social_linkedin')) { ?>
                                <li class="social_linkedin">
                                    <a target="_blank" rel="tooltip" data-placement="bottom" title="" data-original-title="<?php echo JText::_('SOCIAL_LINKEDIN_TITLE'); ?>" href="http://www.linkedin.com/company/<?php echo $linkedin_id; ?>" ><span>Linkedin</span></a>
                                </li>
                            <?php } ?>
                        
                            <?php if($this->params->get('rss_feed')) { ?>
                                <li class="social_rss_feed">
                                    <a target="_blank" rel="tooltip" data-placement="bottom" title="" data-original-title="<?php echo JText::_('SOCIAL_RSS_TITLE'); ?>" href="<?php echo $rss_feed_url; ?>"><span>RSS Feed</span></a>
                                </li>				
                            <?php } ?>
                        </ul>
                        
                   </div><!-- social -->
                
                </div>
               
            </div>
            <?php } ?>
             
             
            <?php if ($this->countModules('footer1 + footer2 + footer3 + footer4')) { ?>
            <div id="footer_mods" class="<?php echo $footerwrap_span;?>">
            
                <div class="row-fluid">
                                        
                    <?php if ($this->countModules('footer1')) { ?>
                        <div class="<?php echo $footerspan;?>">	
                            <jdoc:include type="modules" name="footer1" style="block" />
                        </div> 
                    <?php } ?>
                    
                    <?php if ($this->countModules('footer2')) { ?>
                        <div class="<?php echo $footerspan;?>">	
                            <jdoc:include type="modules" name="footer2" style="block" />
                        </div> 
                    <?php } ?>
                    
                    <?php if ($this->countModules('footer3')) { ?>
                        <div class="<?php echo $footerspan;?>">	
                            <jdoc:include type="modules" name="footer3" style="block" />
                        </div> 
                    <?php } ?>
                    
                    <?php if ($this->countModules('footer4')) { ?>
                        <div class="<?php echo $footerspan;?>">	
                            <jdoc:include type="modules" name="footer4" style="block" />
                        </div> 
                    <?php } ?>
                    
                </div> 
                
            </div>   
            <?php } ?>
    
        </div>
        
    </footer><!-- /footer --> 
  
</div>

<div id="copyright_area">
	
	<div class="container">
   

        
        
                      
        <?php if ($this->countModules('copyrightmenu')) { ?>
        <div id="copyrightmenu">
        <jdoc:include type="modules" name="copyrightmenu" />
        </div>
        <?php } ?> 
        
    </div>
    
</div><!-- copyright -->  


<?php if ($this->params->get('go2top')) { ?>
<div id="gotop" class="">
	<a href="#" class="scrollup"><?php echo JText::_('TPL_TPL_FIELD_SCROLL'); ?></a>
</div>
<?php } ?>  

        
<?php if ($this->params->get('styleswitcher')) { ?>
<ul id="ice-switcher">  
    <li class="style1"><a href="templates/<?php echo $this->template;?>/css/styles/style-switcher.php?templatestyle=style1"><span>حالت ۱</span></a></li>  
    <li class="style2"><a href="templates/<?php echo $this->template;?>/css/styles/style-switcher.php?templatestyle=style2"><span>حالت ۲</span></a></li> 
    <li class="style3"><a href="templates/<?php echo $this->template;?>/css/styles/style-switcher.php?templatestyle=style3"><span>حالت ۲</span></a></li> 
    <li class="style4"><a href="templates/<?php echo $this->template;?>/css/styles/style-switcher.php?templatestyle=style4"><span>حالت ۴</span></a></li> 
    <li class="style5"><a href="templates/<?php echo $this->template;?>/css/styles/style-switcher.php?templatestyle=style5"><span>حالت ۵</span></a></li>  
    <li class="style6"><a href="templates/<?php echo $this->template;?>/css/styles/style-switcher.php?templatestyle=style6"><span>حالت ۶</span></a></li>  
</ul> 
<?php } ?>


<?php if ($this->params->get('styleswitcher')) { ?> 
<script type="text/javascript">  

jQuery.fn.styleSwitcher = function(){
	jQuery(this).click(function(){
		loadStyleSheet(this);
		return false;
	});
	function loadStyleSheet(obj) {
		jQuery('body').append('<div id="overlay" />');
		jQuery('body').css({height:'100%'});
		jQuery('#overlay')
			.fadeIn(500,function(){
				/* change the default style */
				jQuery.get( obj.href+'&js',function(data){
					jQuery('#stylesheet').attr('href','<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/styles/' + data + '.css');
					cssDummy.check(function(){
						jQuery('#overlay').fadeOut(1000,function(){
							jQuery(this).remove();
						});	
					});
				});
				
				/* change the logo for styles 
				jQuery.get( obj.href+'&js',function(data){
					jQuery('#logo img').attr('src','<?php echo $this->baseurl ?>/images/sampledata/cmsfarsi/logo_' + data + '.png');
				}); */
				
				/* change the responsive style */
				jQuery.get( obj.href+'&js',function(data){
					jQuery('#stylesheet-responsive').attr('href','<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/styles/' + data + '_responsive.css');
					
					cssDummy.check(function(){
						jQuery('#overlay').fadeOut(1000,function(){
							jQuery(this).remove();
						});	
					});
				});
			});
	}
	var cssDummy = {
		init: function(){
			jQuery('<div id="dummy-element" style="display:none" />').appendTo('body');
		},
		check: function(callback) {
			if (jQuery('#dummy-element').width()==2) callback();
			else setTimeout(function(){cssDummy.check(callback)}, 200);
		}
	}
	cssDummy.init();
}
	jQuery('.ice-template-style a').styleSwitcher(); 
	jQuery('#ice-switcher a').styleSwitcher(); 	
	
	
		/* Control the active class to styleswitcher */
		jQuery(function() {
		jQuery('#ice-switcher a').click(function(e) {
			e.preventDefault();
			var $icethis = jQuery(this);
			$icethis.closest('ul').find('.active').removeClass('active');
			$icethis.parent().addClass('active');
		});
		
		jQuery(document).ready(function(){
			jQuery('#ice-switcher li.<?php echo $templatestyle ?>').addClass('active');
		});
		
	});
</script>  
<?php } ?>



<?php if ($this->params->get('google_analytics')) { ?>
<!-- Google Analytics -->  
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<?php echo $this->params->get('analytics_code');; ?>']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<!-- Google Analytics -->  
<?php } ?>

</body>
</html>
<?php } ?>
