		/*Preload Images*/

preloadImages([
		'../images/facebook-hover.png', 
		'../images/google+-hover.png',
		'../images/search-bt-hover.gif', 
		'../images/slide-hover.png',
		'../images/twitter-hover.png', 
		'../images/vimeo-hover.png',
		'../images/zoom-bt.png',
		'../images/tag-bg-hover.gif',
		'../images/more-bt.png'
		]);
		
		/*Social icons hover*/

	jQuery(document).ready(function($){
		$('.icon-list li a').hover(
			 function() {
				 var src =  $(this).find('img').attr("src").replace('.png', '-hover.png');
				 $(this).find('img').attr("src", src);
			 },
			 function() {
				 var src =  $(this).find('img').attr("src").replace('-hover.', '.');
				 $(this).find('img').attr("src", src);
		 });
		 
		 /*Image hover*/
		 
		 $('.slider li a, .show-more a').css({opacity:0});
		 $('.slider li, .show-more').hover(
			 function() {
				 $(this).find('a').stop().animate({opacity:1});
			 },
			 function() {
				 $(this).find('a').stop().animate({opacity:0});
		 });
		 
		 /*Link hover*/
		 
		 $('.link').hover(
			 function() {
				 $(this).stop().animate({paddingRight:28});
			 },
			 function() {
				 $(this).stop().animate({paddingRight:18});
		 });
		 
		 /*Dropdown menu initialization*/
		 
		 $( "#tabs" ).tabs();
		 $('ul.sf-menu').superfish({
				autoArrows	: true,
				dropShadows : false,
				animation	: {opacity:'show'},
				speed		: 'slow',
				easing:      'easeInOutCirc'
			});
		
		/*Slider settings*/
		
		$("div.slider").carousel({ dispItems: 3, pagination: true, loop: true, slideEasing: "easeInOutQuint", animSpeed: 1000, direction: "horizontal" });
		$("div.slider-folio").carousel({ dispItems: 1, pagination: true, direction: "vertical", slideEasing: "easeInOutQuint", animSpeed: 1000 });
		
		/*$('.facebook').fbjlike({
			showfaces: false,
			send:true,
			comments:true
		});
		$('.google').gplusone({
			size:'medium'
		});*/
                         
                $('#coin-slider').coinslider({ 
                    width: 900, 
                    navigation: false, 
                    delay: 5000 
                });         
		
		/*Pretty Photo lightbox settings*/
		
		$("a[class^='cs-coin-slider']").prettyPhoto({theme:'light_rounded '});
		
		/*Twitter account setup*/
		
		$("#twitter").getTwitter({
			userName: 'boutikservices',
			numTweets: 1,
			loaderText: "Loading tweets...",
			slideIn: true,
			showHeading: false,
			headingText: 'Twitter',
			showProfileLink: true,
			id:'#twitter'
		});
		
		/*jQuery Lifestream settings*/
		
		(function(){
		  var count = 0,
		  list = [
			{
			  service: 'bitly',
			  user: 'denbuzze'
			},
			{
			  service: 'blogger',
			  user: 'googleblog'
			},
			{
			  service: 'dailymotion',
			  user: 'VideojugTechnologyandCars'
			},
			{
			  service: 'delicious',
			  user: 'denbuzze'
			},
			// If you want to fetch your main gallery use your DeviantART nickname.
			//
			// To fetch a gallery folder, add the id after a slash character.
			// Example:
			// Pick the gallery folder url: e.g.
			// http://giuliom.deviantart.com/gallery/30227724 .
			// Append the id, which is 30227724, to your nick obtaining
			// something like 'mgiulio/30227724'
			{
			  service: 'deviantart',
			  user: 'gabbyd70',
			  template: {
				deviationpost: '<a href="http://gabbyd70.deviantart.com/">gabbyd70</a> uploaded a deviation: <a href="${url}">${title}</a>'
			  }
			},
			{
			  service: 'digg',
			  user: 'kevinrose'
			},
			{
			  service: 'dribbble',
			  user: 'flarup'
			},
			// find your flickr id @
			// http://www.flickr.com/services/api/explore/?method=flickr.people.findByUsername
			{
			  service: 'flickr',
			  user: '60378309@N02'
			},
			{
			  service: 'foomark',
			  user: 'thatryan'
			},
			{
			  service: 'formspring',
			  user: 'formspring'
			},
			{
			  service: 'forrst',
			  user: 'thatryan'
			},
			// Run javascript:alert(_USER_ID); when you're logged in at google reader
			{
			  service: 'googlereader',
			  user: '16243859758547797209'
			},
			{
			  service: 'github',
			  user: 'christianv'
			},
			// Go to instapaper.com, click Liked and open rss feed, copy last two parts of the url
			// including the slash
			{
			  service: 'instapaper',
			  user: '339501/W2nHbK9Bo4Q1wgd2irogorycEV0'
			},
			{
			  service: 'iusethis',
			  user: 'marcus'
			},
			{
			  service: 'lastfm',
			  user: 'denbuzze'
			},
			{
			  service: 'librarything',
			  user: 'simongee'
			},
			{
			  service: 'mlkshk',
			  user: 'billturner'
			},
			{
			  service: 'picplz',
			  user: 'thatryan'
			},
			{
			  service: 'pinboard',
			  user: 'mattandrews'
			},
			{
			  service: 'posterous',
			  user: 'techcrunch'
			},
			{
			  service: 'reddit',
			  user: 'simongee'
			},
			{
			  service: 'slideshare',
			  user: 'denbuzze'
			},
			{
			  service: 'snipplr',
			  user: 'sdxxx'
			},
			// Run javascript:alert(userid); when you're logged in at stackoverflow
			{
			  service: 'stackoverflow',
			  user: '117193'
			},
			{
			  service: 'tumblr',
			  user: 'hiromitz'
			},
			{
			  service: 'twitter',
			  user: 'jq_lifestream'
			},
			{
			  service: 'vimeo',
			  user: 'denbuzze'
			},
			// [language] Optional setting, defaults to 'en'. 
			// Use wikipedia local site prefix (e.g. 'de' for German)
			{
			  service: 'wikipedia',
			  user: 'Koavf',
			  language: 'en'
			},
			{
			  service: 'wordpress',
			  user: 'pixartimes'
			},
			{
			  service: 'youtube',
			  user: 'denbuzze'
			},
			{
			  service: 'facebook_page',
			  user: '103257716379127'
			}
		  ];
	
		  Date.prototype.toISO8601 = function(date) {
			  var pad = function (amount, width) {
				  var padding = "";
				  while (padding.length < width - 1 && amount < Math.pow(10, width - padding.length - 1))
					  padding += "0";
				  return padding + amount.toString();
			  }
			  date = date ? date : new Date();
			  var offset = date.getTimezoneOffset();
			  return pad(date.getFullYear(), 4)
				  + "-" + pad(date.getMonth() + 1, 2)
				  + "-" + pad(date.getDate(), 2)
				  + "T" + pad(date.getHours(), 2)
				  + ":" + pad(date.getMinutes(), 2)
				  + ":" + pad(date.getUTCSeconds(), 2)
				  + (offset > 0 ? "-" : "+")
				  + pad(Math.floor(Math.abs(offset) / 60), 2)
				  + ":" + pad(Math.abs(offset) % 60, 2);
		  };
		  
		  /*jQuery Lifestream & Timeago initialization*/
	
		  $("#lifestream").lifestream({
			limit: 3,
			list: list,
			feedloaded: function(){
			  count++;
			  // Check if all the feeds have been loaded
			  if( count === list.length ){
				$("#lifestream li").each(function(){
				  var element = $(this),
					  date = new Date(element.data("time"));
				  element.append(' <abbr class="timeago" title="' + date.toISO8601(date) + '">' + date + "</abbr>");
				})
				$("#lifestream .timeago").timeago();
			  }
			}
		  });
		  
		})();
		
	});
