
/*
========================================================
============ ScrollingTo & ScrollingTop JS ============= 
========================================================

Author: Thomas Coppers
Usage by permission only.

-------------------------------------------------- */


(function( $ ){

  
  
  // Scrolling To an ID'ed Anchor Point
  $.fn.ScrollingTo = function() {
		
		
		// Defines what to preform the script on.  
		ScT = this;
		
		//When Clicked Preform these actions        
		ScT.click(function(){
				
				//Check if link is to an Anchor
				if($(this).filter('[href^="#"]')){
					
					//Determine Link's Destination (href tag)
					var dest = $(this).attr('href');
					//Determine Destination's position on page
					var topof = $(dest).offset().top;
					//Scroll body to position at the designated speed (in milliseconds)
					$('html,body').animate({scrollTop:topof},2500);				
				}//if
				
				return false;
				
			});//Click
  };//ScrollingTo end
  
  
  // Scrolling To Top of Page
  $.fn.ScrollingTop = function() {
		
		// Defines what to preform the script on.  
		ScTop = this;
		
		//When Clicked Preform these actions        
		ScTop.click(function(){
						   
				//Scroll body to Top at the designated speed (in milliseconds)
				$('html,body').animate({scrollTop:0},1500);				
				return false;
				
			});//Click
		
  };//ScrollingTop   
  
  
})( jQuery );//End Plugin
