//http://www.jennyandlih.com/resolved-logging-firebug-console-breaks-ie
//a handy log function which checks first that firebug is in use before trying to log to the console.
log_debug = function() {
  if(window.console && window.console.firebug) console.log.apply(this, arguments)
};

jQuery(document).ready(function(){


jQuery('#twitter, #facebook, #clipmyhorse, #youtube, #rss').fadeIn().fadeTo('slow', 0.7);
jQuery('#twitter, #facebook, #clipmyhorse, #youtube, #rss').width(36);


//scroll the "social" box to the top offset of browser's scrool bar
	jQuery(window).scroll(function(){
			offset = 125;
			position = jQuery(window).scrollTop();
			abstand = offset + position + "px";
  			jQuery('#twitter, #facebook, #clipmyhorse, #youtube, #rss').animate({top:abstand },{queue: false, duration: 800});
  			//jQuery('#twitter, #facebook, #clipmyhorse, #youtube, #rss').animate({top:125 },{queue: false, duration: 800});
	});
//when the social button is hovered:
	jQuery("#facebook").hover(
  		function () {
  			jQuery(this).animate({
    			opacity: 1,
    			width: 159
  			}, 500, function() {
    			// Animation complete.
  			});
  		}, 
  		function () {
  		  	jQuery(this).delay(800).animate({
    			opacity: 0.7,
    			width: 36
  				}, 500, function() {
    			// Animation complete.
  			}); 		
    	}
	);
	
	jQuery("#youtube").hover(
  		function () {
  			jQuery(this).animate({
    			opacity: 1,
    			width: 159
  			}, 500, function() {
    			// Animation complete.
  			});
  		}, 
  		function () {
  		  	jQuery(this).delay(800).animate({
    			opacity: 0.7,
    			width: 36
  				}, 500, function() {
    			// Animation complete.
  			}); 		
    	}
	);
	
	jQuery("#clipmyhorse").hover(
  		function () {
  			jQuery(this).animate({
    			opacity: 1,
    			width: 159
  			}, 500, function() {
    			// Animation complete.
  			});
  		}, 
  		function () {
  		  	jQuery(this).delay(800).animate({
    			opacity: 0.7,
    			width: 36
  				}, 500, function() {
    			// Animation complete.
  			}); 		
    	}
	);
	
	jQuery("#twitter").hover(
  		function () {
  			jQuery(this).animate({
    			opacity: 1,
    			width: 159
  			}, 500, function() {
    			// Animation complete.
  			});
  		}, 
  		function () {
  		  	jQuery(this).delay(800).animate({
    			opacity: 0.7,
    			width: 36
  				}, 500, function() {
    			// Animation complete.
  			}); 		
    	}
	);
	
	jQuery("#rss").hover(
  		function () {
  			jQuery(this).animate({
    			opacity: 1,
    			width: 159
  			}, 500, function() {
    			// Animation complete.
  			});
  		}, 
  		function () {
  		  	jQuery(this).delay(800).animate({
    			opacity: 0.7,
    			width: 36
  				}, 500, function() {
    			// Animation complete.
  			}); 		
    	}
	);

});