// When the document loads do everything inside here ...

jQuery(document).ready(function ($){

var updateCaption = function(slider){
    var cap = slider.$currentPage.find('.caption').html();
    jQuery('#current-caption')
        .html(cap)
        .fadeIn(700);
       
};

var flirts = jQuery(".flirtations").html();
jQuery("#leftbar").html(flirts);

jQuery('#slider2')
	.anythingSlider({
	
	// *********** Callbacks ***********
	   // Callback when the plugin finished initializing

		width               : 400,
		height              : 350,
		startStopped        : true,
		resizeContents      : false,
		hashTags            : false, 
		
		delay:5000,
		animationTime : 300,
		appendControlsTo: $('#nav'),
		 
		     // Details at the top of the file on this use (advanced use)
		navigationFormatter: function(index, panel) {
		         // This is the default format (show just the panel index number)
		       
		          // return panel.find('h1').text();
		         
		     },
		onInitialized: function(e, slider) { updateCaption(slider); },
		
		// Callback before slide animates
		onSlideBegin: function(e, slider) {
		    jQuery('#current-caption').fadeOut(200);
		    
		},
		
		// Callback when slide completes - no event variable!
		onSlideComplete: function(slider) { updateCaption(slider); }
	})
	.anythingSliderFx({
		// base FX definitions
		// '.selector' : [ 'effect(s)', 'distance/size', 'time', 'easing' ] - 'time' and 'easing' are optional parameters
		inFx : {
		   '.web' : { top : 0, duration: 200, easing : 'easeOutCirc' },
		   '.web .expand' :  {  opacity: 1, duration: 450 }	
		    },
		   
		   
		
		   
		   // out = the animation that occurs when you slide "out" of a panel
		   // (it also occurs before the "in" animation)
		  outFx : {
		   '.web' : { top  : '-100px', duration: 250 },
		   '.web .expand' : { opacity: 0, duration: 50 }
		  
		  	  }	
		  	  
		/*
		// for more precise control, use the "in" and "out" definitions
		// in = the animation that occurs when you slide "in" to a panel
		,inFx  : {
			'.textSlide h3'  : { opacity: 1, top  : 0, duration: 400, easing : 'easeOutBounce' },
			'.textSlide li'  : { opacity: 1, left : 0, duration: 400 },
			'.textSlide img' : { opacity: 1, duration: 400 },
			'.quoteSlide'    : { top : 0, duration: 400, easing : 'easeOutElastic' },
			'.expand'        : { width: '100%', top: '0%', left: '0%', duration: 400, easing : 'easeOutBounce' }
		},
		// out = the animation that occurs when you slide "out" of a panel
		// (it also occurs before the "in" animation) - outFx animation time is 1/2 of inFx time
		outFx : {
			'.textSlide h3'      : { opacity: 0, top  : '-100px', duration: 200 },
			'.textSlide li:odd'  : { opacity: 0, left : '-200px', duration: 200 },
			'.textSlide li:even' : { opacity: 0, left : '200px',  duration: 200 },
			'.textSlide img'     : { opacity: 0, duration: 200 },
			'.quoteSlide:first'  : { top : '-500px', duration: 200 },
			'.quoteSlide:last'   : { top : '500px', duration: 200 },
			'.expand'            : { width: '10%', top: '50%', left: '50%', duration: 200 },
		}
		
		
		.anythingSliderFx({
			  inFx : {
			   '.web' : { top : 0, duration: 400, easing : 'easeOutCirc' },
			   '.web img' :  {  opacity: 1, duration: 250 }	
			    },
			   
			   
			
			   
			   // out = the animation that occurs when you slide "out" of a panel
			   // (it also occurs before the "in" animation)
			  outFx : {
			   '.web' : { top  : '-100px', duration: 350 },
			   '.web img' : { opacity: 0, duration: 50 }
			  
			  	  }	
			  	  
			  	  
		*/
	})
	.find('.panel:not(.cloned) .columns a') // ignore the cloned panels
		          // add all slider images to a colorbox group
		.colorbox({
			href   : function(){ return $(this).attr('href'); },
			title  : function(){ return $(this).attr('title') }
			
		});

$('#intro a').click(function(){
    var slide = $(this).attr('href').substring(1);
    $('#slider2').anythingSlider(slide);
    return false;
});
 function initRollover(selector, pixeffect) {
            $(selector).each(function() {

                var elem = $(this);
                var newimg = new Image();

                newimg.onload = function() {
                    $(newimg).pixastic(pixeffect, {amount:0.5});
                }

                var span = $(document.createElement("span")).append(newimg).css('opacity',.8);
                newimg.src = elem.find('img').attr('src');
                elem.append(span);

                elem.hover(function () {

                    span.stop().animate({
                        opacity: 0 //desaturate
                    }, 600);

                }, function () {

                    span.stop().animate({ //saturate
                        opacity: .8
                    }, 600);

                });

            });
        }

       
 initRollover('.columns li a', 'desaturate');
       

//jQuery("#leftbar").hoverIntent({over: fadeLeftBar,timeout: 1000,out: revealLeftBar});
		 // close document.ready

		//function fadeLeftBar(){  jQuery(this).css("opacity","1");}
		//function revealLeftBar(){ jQuery(this).css("opacity",".1");}
	
  
jQuery(" .first-post, .archive-post").hover(function() {
jQuery(this).animate({ backgroundColor: '#eee'},600);
},function() {
jQuery(this).animate({ backgroundColor: '#fff'},600);
});

// Hover for images
jQuery("img").hover(function() {
jQuery(this).animate({borderColor: '#fff'},150);
},function() {
jQuery(this).animate({borderColor: '#fff'},150);
});

// Menu -> Dont' touch Start
jQuery("#wrap .main-menu li, #wrap li").hover(function(){ 
jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown('fast').show();
},function(){ 
jQuery(this).find('ul:first').css({}).slideUp('fast').show();
});

jQuery("#wrap ul.sub-menu").parent().prepend("<span></span>"); 
// Menu -> Dont' touch End

// Mobile Menu -> Dont' touch Start
jQuery(".open").click(function(){
jQuery("#wrap_mobile").css({visibility:"visible", display: "block"});
});

jQuery("#wrap2 li").click(function(){
jQuery("#wrap_mobile").css({visibility:"hidden", display: "none"});
});

jQuery(".close").click(function(){
jQuery("#wrap_mobile").css({visibility:"hidden", display: "none"});
});

jQuery("#wrap_mobile").click(function(){
jQuery("#wrap_mobile").css({visibility:"hidden", display: "none"});
});
// Mobile Menu -> Dont' touch End




});


