// Carousel
function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
    });
};

jQuery(document).ready(function() {
    jQuery("#free-readings").jcarousel({
        auto: 6,
        wrap: 'last',
        visible: 4,
        initCallback: mycarousel_initCallback
        // This tells jCarousel NOT to autobuild prev/next buttons
       // buttonNextHTML: null,
        //buttonPrevHTML: null
    });
    
    jQuery("#oracle-readings").jcarousel({
        auto: 6,
        wrap: 'last',
        visible: 3,
        initCallback: mycarousel_initCallback
        // This tells jCarousel NOT to autobuild prev/next buttons
        //buttonNextHTML: null,
        //buttonPrevHTML: null
    });
});

// End Carousel

// Anything slider (feature header)
    
function formatText(index, panel) {
  return index + "";
}

jQuery(function () {

    jQuery('.anythingSlider').anythingSlider({
        easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
        delay: 8000,                    // How long between slide transitions in AutoPlay mode
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        animationTime: 600,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "Go",             // Start text
        stopText: "Stop",               // Stop text
        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
    });

    jQuery('.testimonialSlider').anythingSlider({
        easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
        delay: 3000,                    // How long between slide transitions in AutoPlay mode
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        animationTime: 600,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "Go",             // Start text
        stopText: "Stop",               // Stop text
        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
    });
    
    jQuery("#fs1").click(function(){jQuery('.anythingSlider').anythingSlider(1);});
    jQuery("#fs2").click(function(){jQuery('.anythingSlider').anythingSlider(2);});
    jQuery("#fs3").click(function(){jQuery('.anythingSlider').anythingSlider(3);});
    jQuery("#fs4").click(function(){jQuery('.anythingSlider').anythingSlider(4);});
    jQuery("#fs5").click(function(){jQuery('.anythingSlider').anythingSlider(5);}); 
    
    jQuery("#ts1").click(function(){jQuery('.testimonialSlider').anythingSlider(1);});
    jQuery("#ts2").click(function(){jQuery('.testimonialSlider').anythingSlider(2);});
    jQuery("#ts3").click(function(){jQuery('.testimonialSlider').anythingSlider(3);});
    jQuery("#ts4").click(function(){jQuery('.testimonialSlider').anythingSlider(4);});
    jQuery("#ts5").click(function(){jQuery('.testimonialSlider').anythingSlider(5);});            
    
});

// Expand/Collapse

/*jQuery(function() {
    jQuery(".expandbutton").toggler({method: "slideFadeToggle", speed: 400});
});*/

// Shadowbox

Shadowbox.init({
    players: ["html", "img", "flv"]
});

//<![CDATA[
	jQuery(function(){
		var $featured_area = jQuery('#featured-area');
		var $featured_item = jQuery('#featured-area div#slider-control div.featitem');
		var $slider_control = jQuery('#featured-area div#slider-control');
		var $image_container = jQuery('div#s1 > div');
		var ordernum;
		var pause_scroll = false;
			
		$featured_item.find('img').fadeTo("fast", 1);
		$slider_control.find("div.featitem.active img").fadeTo("fast", 1);
		
		$image_container.hover(
			function () {
				jQuery(this).find("img").fadeTo("fast", 1);
			}, 
			function () {
				jQuery(this).find("img").fadeTo("fast", 1);
			}
		);
		
		function gonext(this_element){
			$slider_control.find("div.featitem.active img").fadeTo("fast", 1);
			$slider_control.find("div.featitem.active").removeClass('active');
			this_element.addClass('active');
			$slider_control.find("div.featitem.active img").fadeTo("fast", 1);
			ordernum = this_element.find("span.order").html();
			jQuery('#s1').cycle(ordernum - 1);
		} 
		
		$featured_item.click(function() {
			clearInterval(interval);
			gonext(jQuery(this)); 
			return false;
		});
		
		var auto_number;
		var interval;
		
		$featured_item.bind('autonext', function autonext(){
			if (!(pause_scroll)) gonext(jQuery(this)); 
			return false;
		});

		interval = setInterval(function () {
			auto_number = $slider_control.find("div.featitem.active span.order").html();
			if (auto_number == $featured_item.length) auto_number = 0;
			$featured_item.eq(auto_number).trigger('autonext');
		}, 5500);
	});
//]]>	

jQuery(function(){
	jQuery('#s1').cycle({
		timeout: 0, 
		speed: 10,
		fx: 'fade'
	});
});


jQuery(function() {
//Preserves the mouse-over on top-level menu elements when hovering over children
jQuery("#navigation ul").each(function(i){
  jQuery(this).hover(function(){
    jQuery(this).parent().find("a").slice(0,1).addClass("activemenu");
  },function(){
    jQuery(this).parent().find("a").slice(0,1).removeClass("activemenu");
  });
});
// IE6 Fix: Drop-down fix due to lack of support for :hover on list elements
if(jQuery.browser.msie && (jQuery.browser.version < 7)) {
  jQuery("#navigation").each(function(i){
    jQuery(this).find("li").hover(function(){
      jQuery(this).addClass("sfhover");
    },function(){
      jQuery(this).removeClass("sfhover");
    });
  });
}

});

Cufon.replace('h1', { fontFamily: 'Rockwell Light' });
Cufon.replace('.section-title h2', { fontFamily: 'Rockwell Light' });
Cufon.replace('.section-title-dark h2', { fontFamily: 'Rockwell Light' });
Cufon.replace('.section-title h2 span', { fontFamily: 'Rockwell Std' });
Cufon.replace('.section-title-dark h2 span', { fontFamily: 'Rockwell Std' });
Cufon.replace('#feature-left h2', { fontFamily: 'Rockwell Light' });
Cufon.replace('#feature-right h2', { fontFamily: 'Rockwell Light' });
Cufon.replace('#homesearch h2', { fontFamily: 'Rockwell Light' });
Cufon.replace('#pageheader .search h2', { fontFamily: 'Rockwell Light' });
Cufon.replace('#content #more h2', { fontFamily: 'Rockwell Light' });
Cufon.replace('h3.reader', { fontFamily: 'Rockwell Std' });
Cufon.replace('#content #left .postcontent h3', { fontFamily: 'Rockwell Light' });
Cufon.replace('#content #inside #left .content .quotes h3', { fontFamily: 'Rockwell Light' });
Cufon.replace('#content #left .cat-testimonials h3', { fontFamily: 'Rockwell Light' });



jQuery(document).ready(function() {
	jQuery('.psychic-testimonials>.quotes>.quotelinks>ul>li>a').click(function() {
		jQuery('.psychic-testimonials>.quotes>.slidequotes>ul>li').fadeOut(0).filter(this.hash).fadeIn(0);
		return false;
	});
	jQuery('.psychic-testimonials>.quotes>.slidequotes>ul>li').css('visibility','invisible').not(':first').hide();
});

jQuery(document).ready(function() {

	//When page loads...
	jQuery(".tab_content").hide(); //Hide all content
	jQuery("ul.tabs li:first").addClass("active").show(); //Activate first tab
	jQuery(".tab_content:first").show(); //Show first tab content

	//On Click Event
	jQuery("ul.tabs li").click(function() {

		jQuery("ul.tabs li").removeClass("active"); //Remove any "active" class
		jQuery(this).addClass("active"); //Add "active" class to selected tab
		jQuery(".tab_content").hide(); //Hide all tab content

		var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		jQuery(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

});

