///*** ADDITIONAL JS ***///

// STYLE SWITCHER

jQuery(document).ready(function() {jQuery('#switcher').switcher();});

// CUFON

Cufon.replace('.entry-title', {
	fontFamily: 'Museo Sans',
	textShadow: '0px 1px white'
});
Cufon.replace('h2', {
	fontFamily: 'Museo Sans',
	textShadow: '0px 1px white'
});
Cufon.replace('h3', {
	fontFamily: 'Bergamo Std',
	textShadow: '0px 1px white'
});
Cufon.replace('h4', {
	fontFamily: 'Museo Sans',
	textShadow: '0px 1px white'
});
			
// LAVA LAMP MENU

jQuery(function() {
	jQuery("#menu-main-nav").lavaLamp({
		fx: "easeInQuad",
		speed: 250,
		click: function() {return true;},
		setOnClick: false
	});
}); 

// IMAGE PRELOADS
function preload(arrayOfImages) {
    jQuery(arrayOfImages).each(function(){
        jQuery('<img/>')[0].src = this;
        // Alternatively you could use:
        // (new Image()).src = this;
    });
}

// Usage:

preload([
    '/wp-content/themes/kn/images/bg-green.jpg',
    '/wp-content/themes/kn/images/bg-purple.jpg'
]);

// QTIP - TOOLTIPS

jQuery(document).ready(function(){
	jQuery('.recent-post a[title]').qtip({ 
	   position: {
		  my: 'bottom right', 
		  at: 'bottom right',
		  target: 'event',
		  adjust: {
			offset: true,
         	y: -20,
			x: -6
		  }
	   },
	   style: {
		  tip: false,
		  classes: 'ui-tooltip-light'
	   }

	})
})

// LAST EVERY 3RD IMG

//Save the context in a var
jQuery(document).ready(function(){
	var jQuerymain = jQuery("#content");
	//If the container exists
	if(jQuery(".recent-posts").length){
		//Loop through each image, including the index of the object(i)
		jQuery(".recent-post", jQuerymain).each(function(i){
			//Since 0 based add one, for every 3rd object remainder will equal 0
			var remainder = (i + 1) % 3;
			//Add a class of last when the remainder is 0
			if(remainder === 0){
				jQuery(this).addClass("last");
			}
		});
	}
})
