jQuery(document).ready(function() {
	
	// Anything Slider
	jQuery('#slider ul').anythingSlider({
		width : 800,          // Override the default CSS width
		height: 260,
		delay: 5000,
		animationTime: 1000,
		stopAtEnd: false,
		Rtl: true,
		resumeOnVideoEnd: true,
		autoPlay: true,
		buildNavigation: false,
		hashTags: true, 
		easing: 'easeInQuad'
	});	
	
	/* Anything Slider Navigation
    --------------------------------------------------------------------- */
	var q = ["#prev-button", "#next-button", ".arrow", ".forward", ".back"];
	var buttons = q.join(", ");
	
	jQuery(".featured").hover( function() {
		jQuery(buttons).stop().show();
	}).mouseleave( function() {
		jQuery(buttons).stop().hide();
			});
	
	/* Twitter Plugin
    --------------------------------------------------------------------- */
    $('#twitter-feed').tweet({
        username: "mojo_themes",  //just enter your twitter username
        join_text: "auto",
        avatar_size: 40,
        count: 1, //number of tweets showing
        auto_join_text_default: "",
        loading_text: "Loading latest tweets..." //text displayed while loading tweets
    });
	
	<!-- Twitter Widget Demo Purpose -->
	$('#twitter-feed2').tweet({
		username: "mojo_themes",  //just enter your twitter username
		join_text: "auto",
		avatar_size: 42,
		count: 2, //number of tweets showing
		auto_join_text_default: "",
		loading_text: "Loading latest tweets..." //text displayed while loading tweets
	});
	
	/* Scroll Functions (Navigation)
    --------------------------------------------------------------------- */
	jQuery('#navigation').localScroll();
	jQuery('#navigation li a').click( function () {
		jQuery('#navigation li a').removeClass("active");
		jQuery(this).addClass("active");
	});
	
	jQuery('#logo').click(function(){ 		
		jQuery('#navigation li a').removeClass("active");
		jQuery('#navigation li:first a').addClass("active");
		jQuery('html, body').animate({scrollTop:0},2000);
		
	});
	
	jQuery('.upArrow').click(function(){
		jQuery('#navigation li a').removeClass("active");
		jQuery('#navigation li:first a').addClass("active");
		jQuery('html, body').animate({scrollTop: 0},2000);
	});
	
	/* Carousel
	------------------------------------------------------------------*/
		 $('#foo1').carouFredSel({
					auto: {
						pauseOnHover: 'resume',
						pauseDuration: 4000,
						onPauseStart: function( percentage, duration ) {
							$(this).trigger( 'configuration', ['width', function( value ) { 
								$('#timer1').stop().animate({
									width: value
								}, {
									duration: duration,
									easing: 'easeInQuad'
								});
							}]);
						},
						onPauseEnd: function( percentage, duration ) {
							$('#timer1').stop().width( 0 );
						},
						onPausePause: function( percentage, duration ) {
							$('#timer1').stop();
						}
					}, 
					scroll : {
						duration: 1000}
				});
				
	/* Accordions
        --------------------------------------------------------------------- */
        if($(".accordion-block").length) {
            $(".accordion-block").each(function() {
                // Hide all accordions content
                $(this).find(".accordion-content").css({display: "none"});

                // Click on accordion item trigger and show the content
                $(this).find(".accordion-trigger").click(function() {
                    // On click we close all slides and removes "on" class
                    $(".accordion-trigger").removeClass("active");
                    $(".accordion-content").slideUp();

                    // Open next to this trigger slider
                    if($(this).next().is(":hidden") == true) {
                        $(this).addClass("active");
                        $(this).next().slideDown();
                    }
                    // Disable link click
                    return false;
                });
            });
        }


	/* Elements wrapper
     --------------------------------------------------------------------- */
    // Add wrapper to buttons, form submits and pager elements
    	$(	".button,.button-s,.button-l,.button-xl, .boxes a, .post-more-link,input[type=submit],input[type=reset],input[type=button],").not("#submit2, #submit, .sloganBtn").wrap("<div class='button-wrapper' />");
	
	// Animate Social Container & Navigation
	jQuery(document).ready(function(){
		effects = {queue:true, duration:1500, easing: 'easeInOutExpo'};
		effects2 = {queue:true, duration:1500, easing: 'easeInOutExpo'};
		
		jQuery('#navigation li:first a').addClass("active");
		
		jQuery('#navigation').animate({
    	left: -3000}, 0);
		
		jQuery('#navigation').animate({
    	left: 0}, effects2);
		
		jQuery('.socialContainer').animate({
    	left: 30}, effects);
		
		});
		
	//Pretty Photo
	jQuery("a[rel^='prettyPhoto']").prettyPhoto({overlay_gallery: false});
		
	// Portfolio Hover
	jQuery(document).ready(function(){
		jQuery('.overlay').hide();
	});
 	jQuery('ul.portfolio-thumbs li').hover(function(){
		effects = {queue:true, duration:500, easing: 'easeInOutExpo'};  
        jQuery(".overlay", this).delay(500).fadeIn(effects);  
     	}, function() {  
        jQuery(".overlay", this).fadeOut(effects);
		  
   		});
		
	// Infield Text (Input)
	jQuery('input[type=text],input[type=search],input[type=email],textarea').click(
	function () {
		if (this.value == this.defaultValue) {
			this.value = '';
		}
	});
	jQuery('input[type=text],input[type=search],input[type=email],textarea').blur(

	function () {
		if (this.value == '') {
			this.value = this.defaultValue;
		}
	});
		 

});	//END of jQuery
