<?php
global $themeple_config;
    
    do_action( 'themeple_routing_template' , 'page' );
    $themeple_config['current_view'] = 'page';
    $meta = themeple_post_meta(themeple_get_post_id());


    if(!isset($themeple_config['current_sidebar']) ){
        $themeple_config['current_sidebar'] = 'fullsize';
    }

    if(isset($meta['layout']))
        $themeple_config['current_sidebar'] = $meta['layout'];
    $spancontent = 12;
    if(isset($themeple_config['current_sidebar']) && $themeple_config['current_sidebar'] == 'fullsize')
        $spancontent = 12;
    elseif(isset($themeple_config['current_sidebar']) && ($themeple_config['current_sidebar'] == 'sidebar_left' || $themeple_config['current_sidebar'] == 'sidebar_right'))
        $spancontent = 9;

    get_header();
    
    
    ?>

        <?php
            
            $title = get_the_title();
            $page_parents = page_parents();
            $subtitle = themeple_post_meta(themeple_get_post_id(), 'page_header_desc');
        ?>

    <?php if(themeple_post_meta(themeple_get_post_id(), 'page_header_bool') == 'yes'): 
            $extra_class = '';
            $extra_style = '';
            if(themeple_post_meta(themeple_get_post_id(), 'header_type') == 'image'){
                $extra_style .= 'background-image:url('.themeple_post_meta(themeple_get_post_id(), 'background_image').');background-repeat: no-repeat; ';
                $centered = themeple_post_meta(themeple_get_post_id(), 'centered');
                if(isset($centered) && $centered == 'centered'){

                    $extra_style .= 'background-position:center; background-color:#f7f7f7;';
                    $extra_class .= ' colored_bg';

                }else{
                    $extra_style .= '-webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;';
                    $extra_class .= ' background_image';
                }
                
            }else if(themeple_post_meta(themeple_get_post_id(), 'header_type') == 'color'){
                $extra_class .= ' colored_bg';
                $extra_style .= ' background:'.themeple_post_meta(themeple_get_post_id(), 'color_pick').';';
            }

            if(themeple_post_meta(themeple_get_post_id(), 'page_header_animated') == 'yes'){
                $extra_class .= ' animated_header';
            }
    ?>
    <!-- Page Head -->
    <?php  ?>
   <div class="header_page <?php echo $extra_class ?>" style="<?php echo $extra_style ?>">
            <div class="animated_part"></div>
             <div class="container">
                <div class="row-fluid">
                    <div class="span6">
                        <h2><?php echo $title ?></h2>
                    </div>
                    <div class="breadcrumbss">
                        
                        <ul class="page_parents pull-right">
                            <li><a href="<?php echo home_url() ?>">Home</a></li>
                            
                            <?php for($i = count($page_parents) - 1; $i >= 0; $i-- ){ ?>

                            <li><a href="<?php echo get_permalink($page_parents[$i]) ?>"><?php echo get_the_title($page_parents[$i]) ?> </a></li>

                            <?php }  ?>
                            <li class="active"><a href="<?php echo get_permalink() ?>"><?php echo $title ?></a></li>

                        </ul>
                    </div>
                </div>
            </div>
            
    </div> 
   
    
    <?php endif; ?>
        
    
   <section id="content"  <?php if(themeple_post_meta(themeple_get_post_id(), 'page_header_bool') == 'no'): echo 'style=""'; endif; ?> >
        <div class="container <?php  echo $themeple_config['current_sidebar'] ?>" id="blog">
            <div class="row">
    <?php if(isset($themeple_config['current_sidebar']) && $themeple_config['current_sidebar'] == 'sidebar_left') get_sidebar() ?>   
        <div class="span<?php echo $spancontent ?>">
    <?php
        
            get_template_part( 'template_inc/loop', 'page' );
    ?>
    
    <?
if (is_page(2)){
global $b_D;
global $b_webPath;
?>
    <link rel="stylesheet" type="text/css" href="http://www.itla.org.il/destGallery/css/thumbGrid.css"/>
    <script src="<?=$b_webPath?>destGallery/js/jquery.mb.browser.min.js"></script>
    <script src="<?=$b_webPath?>destGallery/js/jquery.mb.CSSAnimate.min.js"></script>
    <script src="<?=$b_webPath?>destGallery/js/jquery.mb.thumbGrid.js"></script>
    <style>
	.bash_cutter{ width:100%; height:30px; border-radius:6px; background:#fff;margin-top: 10px;}
	.bash_cutter h3{ line-height:30px; padding-right:10px; padding-bottom:3px}
	.bash_l_newDiv{ padding:7px; display:block; margin:5px; border:1px solid #81B3EF; border-radius:5px; }
	.bash_l_imgBlock{ padding:5px; display:inline-block;}
	.bash_l_txtBlock{ padding:5px; display:inline-block; width:71%; vertical-align:top}
	.bash_l_txtBlock h4{ font-size:16px;}
	.attachment-100x75{ width:100px; height:75px; border-radius:5px;}
	.bash_l_imgBlock img{ vertical-align:bottom;}
	#bs_l_inTxt{height:312px; margin-top:2px; border:1px solid #81B3EF ;border-radius:5px; display:block}

	.bash_l_hotNewsRow{display:block; margin:6px 1% 0px 0.5%; width:98% ; border-bottom:1px dotted #BECED8}	
	.bash_l_hotNewsRow:hover{ cursor:pointer; opacity:0.7; }
	.bash_l_hotNewsRow a h4{ font-size:14px; padding-bottom:4px}
	.bash_l_newMarq{height:300px; display:block; float:right; position:relative}
	.mr10{ margin-right:10px;}
	.FRmr20{ margin-right:20px; float:right}	
    </style>
    
	<div style="clear:both"></div>
    <div class="span12" id="homeRecentIMG">
    <h3 class="roundMe10">תמונות אחרונות באתר:</h3>
	<? //=$b_D->displayFileInDest($b_D->getTheFiles('h',is_user_logged_in(),'img','12'),'img',6)?>
    <?=$b_D->displayFileInDest('h',$b_D->getTheFiles('h',is_user_logged_in(),'img','12'),'img',6);?>
       	<div style="clear:both"></div>

   <div class="bash_cutter"> </div>

    </div>
   	<div style="clear:both"></div>
   <div class="span12" id="">

   <div class="span7 FRmr20" id="">
  <div class="bash_cutter"> <h3>מאמרים אחרונים באתר:</h3></div>


<?
$bs_lastArg2=array('category'=>13,'orderby'=>'post_date','order'=>'DESC','posts_per_page'   => 3);
$bs_lastArr2= get_posts( $bs_lastArg2);
foreach ( $bs_lastArr2 as $post) : setup_postdata( $post); 

?>
<div class="bash_l_newDiv">
<div class="bash_l_imgBlock"><?php echo get_the_post_thumbnail( $post->ID, array(100,75) ); ?></div>
<div class="bash_l_txtBlock"><a href="<?php the_permalink(); ?>"><h4><?php the_title(); ?></h4>
<?=get_the_excerpt();?>
</a></div>


</div>
<? endforeach; 
wp_reset_postdata();
?>


    </div>

   <div class="span6 FRmr20" id="">
  <div class="bash_cutter">  <h3 class="">עדכונים חמים מהשטח:</h3>
  <div id="bs_l_inTxt" >
  <?
$bs_recTxt='';
$bs_lastArg=array('category'=>15,'orderby'=>'post_date','order'=>'DESC','posts_per_page'   => 9);
$bs_lastArr= get_posts( $bs_lastArg);
foreach ( $bs_lastArr as $post) : setup_postdata( $post); 
$bs_recTxt.='<div class="bash_l_hotNewsRow"><a href="'.get_the_permalink().'"><h4>'.get_the_title().'</h4></a></div>';
?>
<? endforeach; 
wp_reset_postdata();
if($bs_recTxt!=''){
$bs_recTxt='<marquee  align="right" class="bash_l_newMarq" height="300px" onmouseout="this.start();" onmouseover="this.stop();" scrolldelay="1" scrollamount="1" direction="up">'.$bs_recTxt.'</marquee>';
}
else{$bs_recTxt='<h4>לא נמצאו עדכונים אחרונים</h4>';}
echo $bs_recTxt;
?>


</div>
</div>
</div>

    </div>
   	<div style="clear:both; margin-top:15px;"></div>
    
    
<?
}
else if (is_page(3989)){ 
require_once('template_inc/loop-bashro_search.php');
}
?>


</div>
<?php
    wp_reset_query();    
    
    if(isset($themeple_config['current_sidebar']) && $themeple_config['current_sidebar'] == 'sidebar_right') get_sidebar();
?>

            </div>
        </div>

</section>

    <?php
    get_footer();

?>