<?php global $qaleb;?>
<?php if($qaleb['news-ac']=='1'){?>
<div class="container">
<div class="wrapper">
<?php if($qaleb['news-hadis']=='1'){?>
<div class="marquee">
<div class="t">
<h3><?php echo $qaleb['news-title']; ?></h3>
</div>
<?php if($qaleb['mframe-breaking']=='1'){?>
<div class="mframe">
<div class="marquee-frame" data-direction='right' dir="ltr">
<p>
  <?php
			  
			  if($qaleb['news-content']=='1'){
				$arggs = array(
					'post_type' => 'post',
					'posts_per_page' => $qaleb['news-count'],
				);
			  }else if($qaleb['news-content']=='2'){
				$arggs = array(
					'post_type' => 'post',
					'posts_per_page' => $qaleb['news-count'],
					'orderby'	=> 	'rand'
				);
			  }else if($qaleb['news-content']=='3'){
				$arggs = array(
					'post_type' => 'post',
					'posts_per_page' => $qaleb['news-count'],
					'tax_query' => array(
                        array(
                            'taxonomy' => 'category',
                            'field'    => 'term_id',
                            'terms'    => $qaleb['news-type-select'],
                        ),
				    ),
				);
			  }
			  
            query_posts($arggs);
            if(have_posts()) : while(have_posts()) : the_post(); ?>
<span>
<a href="<?php the_permalink()?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<?php if($qaleb['news-dat']=='1'){?><b class="time"><?php the_date('');  ?></b><?php } ?>
</span>
<?php endwhile; endif;  wp_reset_query(); ?>
</p>
</div>
</div>
<script>
  $(".marquee-frame").marquee({
    duration: <?php echo $qaleb['speed-frame']; ?>000,
    pauseOnHover: true,
  });
</script>
<?php }else{ ?>
<div class="breaking">
<ul>
  <?php
			  
			  if($qaleb['news-content']=='1'){
				$arggs = array(
					'post_type' => 'post',
					'posts_per_page' => $qaleb['news-count'],
				);
			  }else if($qaleb['news-content']=='2'){
				$arggs = array(
					'post_type' => 'post',
					'posts_per_page' => $qaleb['news-count'],
					'orderby'	=> 	'rand'
				);
			  }else if($qaleb['news-content']=='3'){
				$arggs = array(
					'post_type' => 'post',
					'posts_per_page' => $qaleb['news-count'],
					'tax_query' => array(
                        array(
                            'taxonomy' => 'category',
                            'field'    => 'term_id',
                            'terms'    => $qaleb['news-type-select'],
                        ),
				    ),
				);
			  }
			  
            query_posts($arggs);
            if(have_posts()) : while(have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink()?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
 <?php endwhile; endif;  wp_reset_query(); ?>
</ul>
</div>
<script>
//////////breaking-news
jQuery(document).ready(function(){
createTicker();
});

function createTicker(){    	
	var tickerLIs = jQuery(".breaking ul").children();          
	tickerItems = new Array();                                
	tickerLIs.each(function(el) {                             
		tickerItems.push( jQuery(this).html() );                
	});                                                       
	i = 0  ;                                                 
	rotateTicker();                                           
}                                                           
function rotateTicker(){                                    
	if( i == tickerItems.length ){                            
	  i = 0;                                                  
	}                                                         
  tickerText = tickerItems[i];                              
	c = 0;                                                    
	typetext();                                               
	setTimeout( "rotateTicker()", 5000 );                     
	i++;                                                      
}                                                           
var isInTag = false;                                        
function typetext() {
	if(jQuery('.breaking ul').length>0){
		var thisChar = tickerText.substr(c, 1);                   
		if( thisChar == '<' ){ isInTag = true; }                  
		if( thisChar == '>' ){ isInTag = false; }                 
		jQuery('.breaking ul').html(tickerText.substr(0, c++));   
		if(c < tickerText.length+1)                                     
			if( isInTag ){                                                
				typetext();                                                 
			}else{                                                        
				setTimeout("typetext()", <?php echo $qaleb['speed-frame']; ?>);                               
			}                                                             
		else {                                                          
			c = 1;                                                        
			tickerText = "";                                              
		}
	}
}   
 </script> 
<?php } ?>
</div>
<?php }else{ ?>
<div class="marquee">
<div class="t">
<h3><?php echo $qaleb['hadis-title'];?></h3>
</div>
<div class="mframe">
<div class="marquee-hadis">
<a href="<?php echo $qaleb['hadis-link'];?>"><?php echo $qaleb['hadis-html'];?></a>
</div>
</div>
</div>
<?php } ?>
</div></div>
<?php } ?>