<?php

// Path constants
define('THEMELIB', TEMPLATEPATH . '/lib');

// Get Theme Options Page
// if(is_admin()) :
// require_once (THEMELIB . '/theme-options.php');
// endif;

// Get Post Images
include(THEMELIB . '/post-images.php');

// Get Post Images
include(THEMELIB . '/meta-photo.php');

// Get Video
include(THEMELIB . '/video-embed/video-post.php');

// Filter Comments
include(THEMELIB . '/comments-filter.php');

// Load widgets
include(THEMELIB . '/widgets.php');

// Produces an avatar image with the hCard-compliant photo class for author info
include(THEMELIB . '/author-info-avatar.php');

// Remove the WordPress Generator 
function gpp_remove_generators() { return ''; }  
add_filter('the_generator','gpp_remove_generators');

function theme_wp_head() { ?><link href="<?php bloginfo('template_directory'); ?>/lib/style.php" rel="stylesheet" type="text/css" /><?php } 
if(get_option('T_css')=="On")
add_action('wp_head', 'theme_wp_head'); 

define('THEME', get_bloginfo('template_url'), true);
define('THEME_JS', THEME . '/js/', true);

// Load javascripts
function theme_load_js() {
    if (is_admin()) return;
    wp_enqueue_script('jquery');    
    wp_enqueue_script('jqueryui', THEME_JS .'jquery-ui-1.7.2.custom.min.js', array('jquery'));
    wp_enqueue_script('superfish', THEME_JS .'/nav/superfish.js', array('jquery'));
    wp_enqueue_script('nav', THEME_JS .'/nav/jquery.bgiframe.min.js', array('jquery'));
    wp_enqueue_script('nav', THEME_JS .'/nav/hoverintent.js', array('jquery'));
      
}

function load_feature_js() {
	if(is_home()) {
		wp_enqueue_script('mousewheel', THEME_JS . 'jquery.mousewheel.js', array('jquery'));
    	wp_enqueue_script('fullscreen', THEME_JS .'fullscreen.js', array('jquery'));  
	}
}

function doc_ready_js() {
	$doc_ready_script = '<script type="text/javascript">
	jQuery(document).ready(function(){
		
		jQuery("ul.sf-menu").superfish({ 
            delay:       500,                            // one second delay on mouseout 
            animation:   {opacity:"show",height:"show"},  // fade-in and slide-down animation 
            speed:       "fast",                          // faster animation speed 
            autoArrows:  true,                           // disable generation of arrow mark-up 
            dropShadows: true                            // disable drop shadows 
        });
	});
	</script>';
	echo $doc_ready_script;
}

add_action('init', theme_load_js);
add_action('template_redirect', load_feature_js); //hook
add_action('wp_head', doc_ready_js);

?>