$(document).ready(function() {
						   
//for fade in effect	 --THIS FUNCTIONALITY WAS REMOVED					   
//$("#load").hide();
//$("#load").fadeIn(2000);

setTimeout(function(){
				$(".photo_text").fadeIn(1000);
			}, 1000);


//for home slide show
$('#home').cycle();
						   
//Hid all divs but home 1 for slide show
  $('#home2').hide();
  $('#home3').hide();
  $('#home4').hide();
  
  
   // change class here for "on" state on bottom links
 $('a#sellers_learn_more_link').click(function() {
 $("li.bottom_nav_local").addClass("bottom_nav_local_on");
 $("li.bottom_nav_local").removeClass("bottom_nav_local");
 $("a#local_link").addClass("active");
 return false;
  });
  

  // change class here for "on" state on bottom links
 $('a#local_link').click(function() {
 $("li.bottom_nav_local").addClass("bottom_nav_local_on");
 $("li.bottom_nav_local").removeClass("bottom_nav_local");
 $("a#local_link").addClass("active");
 //take away on state of others
 $("li.bottom_nav_national_on").addClass("bottom_nav_national");
 $("li.bottom_nav_national_on").removeClass("bottom_nav_national_on");
 $("a#national_link").removeClass("active");
 $("li.bottom_nav_international_on").addClass("bottom_nav_international");
 $("li.bottom_nav_international_on").removeClass("bottom_nav_international_on");
 $("a#international_link").removeClass("active");
 return false;
  });
  
 $('a#national_link').click(function() {
 $("li.bottom_nav_national").addClass("bottom_nav_national_on");
 $("li.bottom_nav_national").removeClass("bottom_nav_national");
 $("a#national_link").addClass("active");
  //take away on state of others
 $("li.bottom_nav_local_on").addClass("bottom_nav_local");
 $("li.bottom_nav_local_on").removeClass("bottom_nav_local_on");
 $("a#local_link").removeClass("active");
 $("li.bottom_nav_international_on").addClass("bottom_nav_international");
 $("li.bottom_nav_international_on").removeClass("bottom_nav_international_on");
 $("a#international_link").removeClass("active");
 
 return false;
  });
  
 $('a#international_link').click(function() {
 $("li.bottom_nav_international").addClass("bottom_nav_international_on");
 $("li.bottom_nav_international").removeClass("bottom_nav_international");
 $("a#international_link").addClass("active");
 //take away on state of others
 $("li.bottom_nav_national_on").addClass("bottom_nav_national");
 $("li.bottom_nav_national_on").removeClass("bottom_nav_national_on");
 $("a#national_link").removeClass("active");
 $("li.bottom_nav_local_on").addClass("bottom_nav_local");
 $("li.bottom_nav_local_on").removeClass("bottom_nav_local_on");
 $("a#local_link").removeClass("active");
 return false;
  });
 
  $('a#home_link').click(function() {
 //take away on state of others
 $("li.bottom_nav_international_on").addClass("bottom_nav_international");
 $("li.bottom_nav_international_on").removeClass("bottom_nav_international_on");
 $("a#international_link").removeClass("active");
 $("li.bottom_nav_national_on").addClass("bottom_nav_national");
 $("li.bottom_nav_national_on").removeClass("bottom_nav_national_on");
 $("a#national_link").removeClass("active");
 $("li.bottom_nav_local_on").addClass("bottom_nav_local");
 $("li.bottom_nav_local_on").removeClass("bottom_nav_local_on");
 $("a#local_link").removeClass("active");

 return false;
  });
  
  $('a#f_home_link').click(function() {
 //take away on state of others
 $("li.bottom_nav_international_on").addClass("bottom_nav_international");
 $("li.bottom_nav_international_on").removeClass("bottom_nav_international_on");
 $("a#international_link").removeClass("active");
 $("li.bottom_nav_national_on").addClass("bottom_nav_national");
 $("li.bottom_nav_national_on").removeClass("bottom_nav_national_on");
 $("a#national_link").removeClass("active");
 $("li.bottom_nav_local_on").addClass("bottom_nav_local");
 $("li.bottom_nav_local_on").removeClass("bottom_nav_local_on");
 $("a#local_link").removeClass("active");
 return false;
  });
  


}); //end this function

  
 //for scolling functionality on home

jQuery(function( $ ){

	$.localScroll.defaults.axis = 'x';

	$.localScroll({
		target: '#mask', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
  			$(".sm_copy_holder").hide("scale", {  }, 500);
     },
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#mask)
		}
	});
	
});
// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};


//for scrolling on sub pages

jQuery(function( $ ){
	  var $prev = $('.prev'),//prev button
		$next = $('.next');//next button
		$prev.hide();
	$('#mask').serialScroll({
		target:'#sections',
		items:'td', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'img.prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'img.next',// Selector to the 'next' button (absolute too)
		axis:'x',// The default is 'y' scroll on both ways
		cycle:false, //don't pull back once you reach the end
		duration:1000,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		
		//queue:false,// We scroll on both axes, scroll both at the same time.
		//event:'click',// On which event to react (click is the default, you probably won't need to specify it)
		//stop:false,// Each click will stop any previous animations of the target. (false by default)
		//lock:true, // Ignore events if already animating (true by default)		
		//start: 0, // On which element (index) to begin ( 0 is the default, redundant in this case )		
		//cycle:true,// Cycle endlessly ( constant velocity, true is the default )
		//step:1, // How many items to scroll each time ( 1 is the default, no need to specify )
		//jump:false, // If true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
		//lazy:false,// (default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
		//interval:1000, // It's the number of milliseconds to automatically go to the next
		//constant:true, // constant speed
		
		onBefore:function( e, elem, $pane, $items, pos ){
			/**
			 * 'this' is the triggered element 
			 * e is the event object
			 * elem is the element we'll be scrolling to
			 * $pane is the element being scrolled
			 * $items is the items collection at this moment
			 * pos is the position of elem in the collection
			 * if it returns false, the event will be ignored
			 */
			 //those arguments with a $ are jqueryfied, elem isn't.
			 
			 $prev.add($next).show();
			if( pos == 0 )
				$prev.hide();
			else if( pos == $items.length-1 )
				$next.hide();
			e.preventDefault();
			
			if( this.blur )
				this.blur();
		},
		onAfter:function( elem ){
			//'this' is the element being scrolled ($pane) not jqueryfied
		}
	});
	
});

//for scroll on team page
jQuery(function( $ ){
	
	$('#team').serialScroll({
		target:'#sections_team',
		items:'td', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'img.team_prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'img.team_next',// Selector to the 'next' button (absolute too)
		axis:'x',// The default is 'y' scroll on both ways
		cycle:false, //don't pull back once you reach the end
		duration:1000,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		
		//queue:false,// We scroll on both axes, scroll both at the same time.
		//event:'click',// On which event to react (click is the default, you probably won't need to specify it)
		//stop:false,// Each click will stop any previous animations of the target. (false by default)
		//lock:true, // Ignore events if already animating (true by default)		
		//start: 0, // On which element (index) to begin ( 0 is the default, redundant in this case )		
		//cycle:true,// Cycle endlessly ( constant velocity, true is the default )
		//step:1, // How many items to scroll each time ( 1 is the default, no need to specify )
		//jump:false, // If true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
		//lazy:false,// (default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
		//interval:1000, // It's the number of milliseconds to automatically go to the next
		//constant:true, // constant speed
		
		onBefore:function( e, elem, $pane, $items, pos ){
			/**
			 * 'this' is the triggered element 
			 * e is the event object
			 * elem is the element we'll be scrolling to
			 * $pane is the element being scrolled
			 * $items is the items collection at this moment
			 * pos is the position of elem in the collection
			 * if it returns false, the event will be ignored
			 */
			 //those arguments with a $ are jqueryfied, elem isn't.
			 
			e.preventDefault();
			if( this.blur )
				this.blur();
		},
		onAfter:function( elem ){
			//'this' is the element being scrolled ($pane) not jqueryfied
			
		}
	});
	
});


//for scroll on team page
jQuery(function( $ ){
	
	$('#advisors').serialScroll({
		target:'#sections_advisors',
		items:'td', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'img.advisors_prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'img.advisors_next',// Selector to the 'next' button (absolute too)
		axis:'x',// The default is 'y' scroll on both ways
		cycle:false, //don't pull back once you reach the end
		duration:1000,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		
		//queue:false,// We scroll on both axes, scroll both at the same time.
		//event:'click',// On which event to react (click is the default, you probably won't need to specify it)
		//stop:false,// Each click will stop any previous animations of the target. (false by default)
		//lock:true, // Ignore events if already animating (true by default)		
		//start: 0, // On which element (index) to begin ( 0 is the default, redundant in this case )		
		//cycle:true,// Cycle endlessly ( constant velocity, true is the default )
		//step:1, // How many items to scroll each time ( 1 is the default, no need to specify )
		//jump:false, // If true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
		//lazy:false,// (default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
		//interval:1000, // It's the number of milliseconds to automatically go to the next
		//constant:true, // constant speed
		
		onBefore:function( e, elem, $pane, $items, pos ){
			/**
			 * 'this' is the triggered element 
			 * e is the event object
			 * elem is the element we'll be scrolling to
			 * $pane is the element being scrolled
			 * $items is the items collection at this moment
			 * pos is the position of elem in the collection
			 * if it returns false, the event will be ignored
			 */
			 //those arguments with a $ are jqueryfied, elem isn't.
			 
			e.preventDefault();
			if( this.blur )
				this.blur();
		},
		onAfter:function( elem ){
			//'this' is the element being scrolled ($pane) not jqueryfied
			
		}
	});
	
});

function Morgcal() {
form = document.mortgage_calc;
LoanAmount= form.LoanAmount.value;
DownPayment= "0";
AnnualInterestRate = form.InterestRate.value/100;
Years= form.NumberOfYears.value;
MonthRate=AnnualInterestRate/12;
NumPayments=Years*12;
Prin=LoanAmount-DownPayment;
MonthPayment=Math.floor((Prin*MonthRate)/(1-Math.pow((1+MonthRate),(-1*NumPayments)))*100)/100;
form.NumberOfPayments.value=NumPayments;
form.MonthlyPayment.value=MonthPayment;
}
