$(document).ready(function(){
			//TOGGLE Function
				//Hide (Collapse) the toggle containers on load
				$(".toggle_container").hide(); 
 
				//Switch the "Open" and "Close" state per click
				$("h2.trigger").toggle(function(){
					$(this).addClass("active");
					}, function () {
					$(this).removeClass("active");
				});
 
				//Slide up and down on click
				$("h2.trigger").click(function(){
					$(this).next(".toggle_container").slideToggle("slow");
				});
				
				//Smooth Scroll Function 
				
				
				$.localScroll({
					hash: false
				});
				
				//ToolTips
				
				$('a[title]').qtip({
				position: {
					corner: {target: 'topMiddle', tooltip: 'bottomMiddle'}
					},
					style: { 
						name: 'cream', 
						tip: true,
						border: {
						width: 5,
						radius: 8
						}
					}
					
				});
				
//AddThis Toolbar Scroll
	
	var supports = (function() {  
	   var div = document.createElement('div'),  
	      vendors = 'Khtml Ms O Moz Webkit'.split(' '),  
	      len = vendors.length;  
	   return function(prop) {  
	      if ( prop in div.style ) return true;  
	  
	      prop = prop.replace(/^[a-z]/, function(val) {  
	         return val.toUpperCase();  
	      });  
	    while(len--) {  
	         if ( vendors[len] + prop in div.style ) {  
	            return true;  
	         }  
	      }  
	      return false;  
	   };  
	})();
	
	
	var scroll_thresh = $('#left-share-bar').offset();    
	var scrolltype ;
	if (supports('transition')) {
	    scrolltype='css3';
	} else {
	    scrolltype= 'normal';
	}
	var tomove;
	var last_pos;
	var orig_pos;
	var scrollDirection;
	if (scrolltype=='css3') {
	//attach css3 transition functions to the left share bar id to use css3 animations
	$('#left-share-bar').css('-webkit-transition','all 0.5s ease-out').css('-moz-transition','all 0.5s ease-out').css('-o-transition','all 0.5s ease-out').css('transition','all 0.5s ease-out');
	}
	//work out what direction you are scrolling
	function scrollFunc(e) {
		if ( typeof scrollFunc.x == 'undefined' ) {
			scrollFunc.x=window.pageXOffset;
			scrollFunc.y=window.pageYOffset;
		}
		var diffY=scrollFunc.y-window.pageYOffset;
		if ( diffY<0 ) {
			scrollDirection="down";
		} else if( diffY>0 ) {
			scrollDirection="up";
		} else {
		}
		scrollFunc.y=window.pageYOffset;
	}
	window.onscroll=scrollFunc
	$(window).scroll(function () { 
		if (scrollDirection=='down') {
		}
		else if (scrollDirection=='up') {
		}
		if (scrolltype=='normal') {
			//css2 scrolling
			if ($(document).scrollTop() >= scroll_thresh.top) {
				$('#left-share-bar').css('position','fixed').css('top',' 20px');
			}
			else {
	    			$('#left-share-bar').css('position','relative').css('top',' 0px');
			}
		}
		else if (scrolltype=='css3') {
	        	//css3 scrolling
		        tomove=($(document).scrollTop()-scroll_thresh.top);
			if ((tomove) > 0) {
				$('#left-share-bar').css('top',(22+tomove)+'px');
			} else if (tomove < 0) {
				$('#left-share-bar').css('top','0px');
	       		}
		}
	});

				
 
});
