<?php
/**
 * The Header for the template.
 *
 * Www.20script.ir
 */

session_start();
$pp_theme_version = THEMEVERSION;

if ( ! isset( $content_width ) ) $content_width = 960;

?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">

<title><?php wp_title('&lsaquo;', true, 'right'); ?><?php bloginfo('name'); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<link rel="canonical" href="http://www.bistscript.ir" />
<?php
	/**
	*	Get favicon URL
	**/
	$pp_favicon = get_option('pp_favicon');
	
	if(!empty($pp_favicon))
	{
?>
		<link rel="shortcut icon" href="<?php echo $pp_favicon; ?>" />
<?php
	}
?>

<!-- Template stylesheet -->
<?php
	wp_enqueue_style("jqueryui_css", get_stylesheet_directory_uri()."/css/jqueryui/custom.css", false, $pp_theme_version, "all");
	wp_enqueue_style("screen_css", get_stylesheet_directory_uri()."/css/screen.css", false, $pp_theme_version, "all");
	wp_enqueue_style("tipsy_css", get_stylesheet_directory_uri()."/css/tipsy.css", false, $pp_theme_version, "all");
	wp_enqueue_style("fancybox_css", get_stylesheet_directory_uri()."/js/fancybox/jquery.fancybox.css", false, $pp_theme_version, "all");
	wp_enqueue_style("flexslider_css", get_stylesheet_directory_uri()."/js/flexslider/flexslider.css", false, $pp_theme_version, "all");
	
	$pp_advance_enable_responsive = get_option('pp_advance_enable_responsive');
	
	if(!empty($pp_advance_enable_responsive))
	{
		wp_enqueue_style("grid_css", get_stylesheet_directory_uri()."/css/grid.css", false, $pp_theme_version, "all");
	}
	
	if(isset($_SESSION['pp_slider_style']))
	{
		$pp_slider_style = $_SESSION['pp_slider_style'];
	}
	else
	{
		$pp_slider_style = get_option('pp_slider_style');
	}
	
	if($pp_slider_style=='full')
	{
		wp_enqueue_style("pp_slider_style", get_stylesheet_directory_uri()."/css/fullslide.css", false, $pp_theme_version, "all");
	}
	wp_enqueue_style("colorpicker.css", get_stylesheet_directory_uri()."/js/colorpicker/css/colorpicker.css", false, $pp_theme_version, "all");
?>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

<?php	
	wp_enqueue_script("jquery", get_stylesheet_directory_uri()."/js/jquery.js", false, $pp_theme_version);
	wp_enqueue_script("jQuery_UI_js", get_stylesheet_directory_uri()."/js/jquery-ui.js", false, $pp_theme_version);
	wp_enqueue_script("swfobject.js", get_stylesheet_directory_uri()."/swfobject/swfobject.js", false, $pp_theme_version);
	wp_enqueue_script("colorpicker.js", get_stylesheet_directory_uri()."/js/colorpicker.js", false, $pp_theme_version);
	wp_enqueue_script("eye.js", get_stylesheet_directory_uri()."/js/eye.js", false, $pp_theme_version);
	wp_enqueue_script("utils.js", get_stylesheet_directory_uri()."/js/utils.js", false, $pp_theme_version);
	wp_enqueue_script("fancybox_js", get_stylesheet_directory_uri()."/js/fancybox/jquery.fancybox.pack.js", false, $pp_theme_version);
	wp_enqueue_script("jQuery_easing", get_stylesheet_directory_uri()."/js/jquery.easing.js", false, $pp_theme_version);
	wp_enqueue_script("jQuery_hint", get_stylesheet_directory_uri()."/js/hint.js", false, $pp_theme_version);
	wp_enqueue_script("jQuery_validate", get_stylesheet_directory_uri()."/js/jquery.validate.js", false, $pp_theme_version);
	wp_enqueue_script("jQuery_tipsy", get_stylesheet_directory_uri()."/js/jquery.tipsy.js", false, $pp_theme_version);
	wp_enqueue_script("reflection_js", get_stylesheet_directory_uri()."/js/reflection.js", false, $pp_theme_version);
	wp_enqueue_script("browser_js", get_stylesheet_directory_uri()."/js/browser.js", false, $pp_theme_version);
	wp_enqueue_script("flexslider_js", get_stylesheet_directory_uri()."/js/flexslider/jquery.flexslider-min.js", false, $pp_theme_version);
	wp_enqueue_script("marquee_js", get_stylesheet_directory_uri()."/js/jquery.marquee.js", false, $pp_theme_version);
	wp_enqueue_script("jwplayer_js", get_stylesheet_directory_uri()."/js/jwplayer.js", false, $pp_theme_version);
	wp_enqueue_script("gmap_js", get_stylesheet_directory_uri()."/js/gmap.js", false, $pp_theme_version);
	wp_enqueue_script("custom_js", get_stylesheet_directory_uri()."/js/custom.js", false, $pp_theme_version);

	/* Always have wp_head() just before the closing </head>
	 * tag of your theme, or you will break many plugins, which
	 * generally use this hook to add elements to <head> such
	 * as styles, scripts, and meta tags.
	 */
	wp_head();
?> 

<!--[if IE]>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/ie.css" type="text/css" media="all"/>
<![endif]-->

<style type="text/css">
<?php
	if(isset($_SESSION['pp_skin']))
	{
		$pp_skin = $_SESSION['pp_skin'];
	}
	else
	{
		$pp_skin = get_option('pp_skin');
	}
	
	if(!empty($pp_skin))
	{
?>
.logo_tagline, h2.breaking, .flex-control-nav li a:hover, .flex-control-nav li a.active, .post_comment_number, .post_comment_number:hover, .post_comment_number:active, .pagination span.current, .pagination a:hover, input[type=submit], input[type=button], a.button, a.button:hover, a.button:active, .readmore:hover, .readmore:active, .widget_tag_cloud div a:hover, .meta-tags a:hover, #footer .widget_tag_cloud div a:hover, #footer .meta-tags a:hover
{ 
	background: <?php echo $pp_skin; ?>; 
}
.main_nav ul li a:hover,  .main_nav li a:hover, .main_nav ul li a.hover,  .main_nav li a.hover, .main_nav ul li a:active,  .main_nav li a:active, #footer a:hover, #footer a:active, a:hover, a:active
{
	color: <?php echo $pp_skin; ?>;
}
<?php
	}
	
?>
</style>

<?php
	/**
	*	Get custom CSS
	**/
	$pp_custom_css = get_option('pp_custom_css');
	
	
	if(!empty($pp_custom_css))
	{
		echo '<style>';
		echo stripslashes($pp_custom_css);
		echo '</style>';
	}
?>

</head>

<?php

/**
*	Get Current page object
**/
$page = get_page($post->ID);


/**
*	Get current page id
**/
$current_page_id = '';

if(isset($page->ID))
{
    $current_page_id = $page->ID;
}

$pp_homepage_slider_trans = get_option('pp_homepage_slider_trans');
if(empty($pp_homepage_slider_trans))
{
	$pp_homepage_slider_trans = 'fade';
}

?>

<body <?php body_class(); ?>>
	
	<input type="hidden" id="pp_homepage_slider_trans" name="pp_homepage_slider_trans" value="<?php echo $pp_homepage_slider_trans; ?>"/>
	
	<!-- Begin template wrapper -->
	<div id="wrapper">
			
		<!-- Begin header -->
		<div id="header_wrapper">
			<div class="standard_wrapper">
				<?php 	
					if ( has_nav_menu( 'top-menu' ) ) 
			    	{
				    	//Get page nav
				    	wp_nav_menu( 
				    	    	array( 
				    	    		'menu_id'			=> 'top_menu',
				    	    		'menu_class'		=> 'nav',
				    	    		'theme_location' 	=> 'top-menu',
				    	    	) 
				    	); 
				   }
				   else
				   {
				    		echo '<div class="topmenu notice">لطفا تنظیمات منو بالایی را از مسیر نمایش > فهرست ها ، انجام دهید.</div>';
				   }
			    ?>
				<div class="social_wrapper">
				    <ul>
				    	<?php
				    		$pp_facebook_username = get_option('pp_facebook_username');
				    		
				    		if(!empty($pp_facebook_username))
				    		{
				    	?>
				    	<li><a target="_blank" href="http://facebook.com/<?php echo $pp_facebook_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/facebook.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_twitter_username = get_option('pp_twitter_username');
				    		
				    		if(!empty($pp_twitter_username))
				    		{
				    	?>
				    	<li><a target="_blank" href="http://twitter.com/<?php echo $pp_twitter_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/twitter.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_flickr_username = get_option('pp_flickr_username');
				    		
				    		if(!empty($pp_flickr_username))
				    		{
				    	?>
				    	<li><a target="_blank" title="Flickr" href="http://flickr.com/people/<?php echo $pp_flickr_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/flickr.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_youtube_username = get_option('pp_youtube_username');
				    		
				    		if(!empty($pp_youtube_username))
				    		{
				    	?>
				    	<li><a target="_blank" title="Youtube" href="http://youtube.com/user/<?php echo $pp_youtube_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/youtube.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_vimeo_username = get_option('pp_vimeo_username');
				    		
				    		if(!empty($pp_vimeo_username))
				    		{
				    	?>
				    	<li><a target="_blank" title="Vimeo" href="http://vimeo.com/<?php echo $pp_vimeo_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/vimeo.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_tumblr_username = get_option('pp_tumblr_username');
				    		
				    		if(!empty($pp_tumblr_username))
				    		{
				    	?>
				    	<li><a target="_blank" title="Tumblr" href="http://<?php echo $pp_tumblr_username; ?>.tumblr.com"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/tumblr.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_google_username = get_option('pp_google_username');
				    		
				    		if(!empty($pp_google_username))
				    		{
				    	?>
				    	<li><a target="_blank" title="Google+" href="<?php echo $pp_google_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/google.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_dribbble_username = get_option('pp_dribbble_username');
				    		
				    		if(!empty($pp_dribbble_username))
				    		{
				    	?>
				    	<li><a target="_blank" title="Dribbble" href="http://dribbble.com/<?php echo $pp_dribbble_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/dribbble.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_digg_username = get_option('pp_digg_username');
				    		
				    		if(!empty($pp_digg_username))
				    		{
				    	?>
				    	<li><a target="_blank" title="Digg" href="http://digg.com/<?php echo $pp_digg_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/digg.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				    		$pp_linkedin_username = get_option('pp_linkedin_username');
				    		
				    		if(!empty($pp_linkedin_username))
				    		{
				    	?>
				    	<li><a target="_blank" title="Linkedin" href="<?php echo $pp_linkedin_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/linkedin.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    	<?php
				            $pp_pinterest_username = get_option('pp_pinterest_username');
				            
				            if(!empty($pp_pinterest_username))
				            {
				        ?>
				        <li><a target="_blank" title="Pinterest" href="http://pinterest.com/<?php echo $pp_pinterest_username; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/pinterest.png" alt=""/></a></li>
				        <?php
				            }
				        ?>
				    	<?php
				    		$pp_feedburner_id = get_option('pp_feedburner_id');
				    		
				    		if(!empty($pp_feedburner_id))
				    		{
				    	?>
				    	<li><a target="_blank" href="<?php echo $pp_feedburner_id; ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/social_black/rss.png" alt=""/></a></li>
				    	<?php
				    		}
				    	?>
				    </ul>
				</div>
			</div>
		</div>
		<!-- End header -->
					
		<br class="clear"/>

		<?php
			$pp_advance_enable_switcher = get_option('pp_advance_enable_switcher');
		
		    if(!empty($pp_advance_enable_switcher))
		    {
		?>
		<form action="<?php echo get_stylesheet_directory_uri(); ?>/option.php" method="get" id="form_option" name="form_option">
		    <div id="option_wrapper">
		    <div class="inner">
		    	<h4 style="color:#000">پنل تنظیمات</h4><hr/><br/>
		    	
		    	کدام نوعه اسلایدر را میخواهید استفاده نمایید؟<br/><br/>
		    	<div class="option_menu_style">
					<div class="option_menu">
						<div style="float:left;width:90px">
						<a href="<?php echo get_stylesheet_directory_uri(); ?>/switcher.php?pp_slider_style=small" class="preview" data-name="<?php echo get_stylesheet_directory_uri(); ?>/functions/slide_style1.png">
							<img src="<?php echo get_stylesheet_directory_uri(); ?>/functions/slide_style1.png" alt=""/>	
						</a>
						</div>
					</div>
					<div class="option_menu">
						<div style="float:left;width:90px">
						<a href="<?php echo get_stylesheet_directory_uri(); ?>/switcher.php?pp_slider_style=full" class="preview" data-name="<?php echo get_stylesheet_directory_uri(); ?>/functions/slide_style2.png">
							<img src="<?php echo get_stylesheet_directory_uri(); ?>/functions/slide_style2.png" alt=""/>	
						</a>
						</div>
					</div>
				</div>
				
				<br class="clear"/><br/>
		    
		    	چه رنگی میخواهید استفاده شود؟<br/>
		    	<div id="pp_skin_preview" class="colorpicker_preview" style="background:<?php echo $pp_skin; ?>;margin-top:5px">&nbsp;</div>
		    	<input type="hidden" id="pp_skin" name="pp_skin" value="<?php echo $pp_skin; ?>" />
		    	
		    	<br/><br/>
		    	<a class="button" href="<?php echo get_stylesheet_directory_uri(); ?>/switcher.php?reset=1" style="width:54px">Reset</a>
		    </div>
		    </div>
		    <div id="option_btn">
		    	<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/color.png"/>
		    </div>
		</form>
		<?php
		    }
		?>
					
		<div id="boxed_wrapper">
			<div class="logo">
				<!-- Begin logo -->
						
				<?php
				    //get custom logo
				    $pp_logo = get_option('pp_logo');
				    
				    if(empty($pp_logo))
				    {
				    	$pp_logo = get_stylesheet_directory_uri().'/images/logo.png';
				    }
				
				?>
				
				<a id="custom_logo" href="<?php echo home_url(); ?>"><img src="<?php echo $pp_logo?>" alt=""/></a>
				<?php
			        $site_tagline = get_bloginfo('description');
			        if(!empty($site_tagline))
			        {
			    ?>
			        <div class="logo_tagline"><?php echo $site_tagline; ?></div>
			    <?php
			        }
			    ?>
				
				<!-- End logo -->
			</div>
			<div class="header_ads">
				<?php
				    $pp_top_banner = get_option('pp_top_banner');
	
				    if(!empty($pp_top_banner))
				    {
				    	echo stripslashes($pp_top_banner);
				    }
				?>
			</div>
			
			<br class="clear"/>
			<?php 	
			if ( has_nav_menu( 'main-menu' ) ) 
			{
				//Get page nav
				wp_nav_menu( 
				    	array( 
				    		'menu_id'			=> 'main_menu',
				    		'menu_class'		=> 'main_nav',
				    		'theme_location' 	=> 'main-menu',
				    	) 
				); 
			}
			else
			   {
			    		echo '<div class="mainmenu notice">لطفا تنظیمات منو اصلی را از مسیر نمایش > فهرست ها ، انجام دهید.</div>';
			   }
			?>
		
			<div id="menu_border_wrapper"></div>
			
			<?php
			$pp_enable_breaking = get_option('pp_enable_breaking');
			
			if(!empty($pp_enable_breaking))
			{
				// Get featured posts
				$pp_breaking_cat = get_option('pp_breaking_cat');
				$pp_breaking_items = get_option('pp_breaking_items');
				if(empty($pp_breaking_items))
				{
					$pp_breaking_items = 5;
				}
				$breaking_posts_arr = get_posts('numberposts='.$pp_breaking_items.'&order=DESC&orderby=date&category='.$pp_breaking_cat);
				
				if(!empty($breaking_posts_arr) && !empty($breaking_posts_arr))
				{
			?>
			<div id="breaking_wrapper">
				<h2 class="breaking"><?php _e( 'Breaking', THEMEDOMAIN ); ?></h2>
				<div class="breaking_new">
					<div class="marquee">
					<?php
				    	foreach($breaking_posts_arr as $key => $breaking_post)
				        {
				        	$hyperlink_url = get_permalink($breaking_post->ID);
				    ?>
						<p><a href="<?php echo $hyperlink_url;?>"><?php echo $breaking_post->post_title; ?></a></p>
					<?php
						}
					?>
					</div>
				</div>
			</div>
			<?php
				}
			}
			?>
