/***************************************************
			SLIDES
***************************************************/

jQuery.noConflict()(function($) {
	$('#slides').slides({
		preload: true,
		generateNextPrev: false
	});
});

/***************************************************
			TWEET!
***************************************************/

jQuery.noConflict()(function($) {
	$(document).ready(function() { 
        $(".tweet").tweet({
            join_text: "auto",
            username: "thedesigncore",
            avatar_size: 32,
            count: 4,
            /* auto_join_text_default: "we said,", */
            auto_join_text_ed: "we",
            auto_join_text_ing: "we were",
            auto_join_text_reply: "we replied to:",
            /* auto_join_text_url: "we were checking out", */
            loading_text: "loading tweets..."
        });
    });
});

/***************************************************
			ROLLOVER FADE
***************************************************/

jQuery.noConflict()(function($) {
	$(document).ready(function() {
		$('.faded').each(function() {
			$(this).hover(function() {
				$(this).stop().animate({ opacity: 0.5 }, 400);
			},
			function() {
				$(this).stop().animate({ opacity: 1.0 }, 400);
			})
		});
	});
});

/***************************************************
			FAQ TOGGLE
***************************************************/

jQuery.noConflict()(function($) {
	$(document).ready(function(){
		//Hide (Collapse) the toggle containers on load
		$(".toggle_container").hide(); 
		//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
		$("h5.trigger").click(function(){
			$(this).toggleClass("active").next().slideToggle("slow");
			return false; //Prevent the browser jump to the link anchor
		});
	});
});

/***************************************************
			NIVO SLIDER
***************************************************/

jQuery.noConflict()(function($) {
	$(window).load(function() {
        $('#slider').nivoSlider({
                effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
                animSpeed: 500, // Slide transition speed
                pauseTime: 8000, // How long each slide will show
                startSlide: 0, // Set starting Slide (0 index)
                directionNav: true, // Next & Prev navigation
                directionNavHide: false, // Only show on hover
                controlNav: true, // 1,2,3... navigation
                pauseOnHover: false, // Stop animation while hovering
                prevText: 'Prev', // Prev directionNav text
                nextText: 'Next', // Next directionNav text
                randomStart: true // Start on a random slide
        });
    });
});

/***************************************************
			SCROLL
***************************************************/

jQuery.noConflict()(function($) {
	$(document).ready(function(){
		$(".scroll").click(function(event){
			//prevent the default action for the click event
			event.preventDefault();
	
			//get the full url - like mysitecom/index.htm#home
			var full_url = this.href;
	
			//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
			var parts = full_url.split("#");
			var trgt = parts[1];
	
			//get the top offset of the target anchor
			var target_offset = $("#"+trgt).offset();
			var target_top = target_offset.top;
	
			//goto that anchor by setting the body scroll top to anchor top
			$('html, body').animate({scrollTop:target_top}, 500);
		});
	});
});
