jQuery(function( $ )

{

		$('#posts').scrollTo({ top:0,left:0 }, 010 );

		$('#recent-links li a.show:first').addClass('active');

				$("#nav").superfish({
						delay: 0,
						//animation: { 'opacity':'show' },
						autoArrows: false,
						dropShadows: false,
						speed: 250
				});

});



function loadScroll(type,direction,interval,speed,easingType)

{

		var postHeight = $('#posts').height();

		var postWidth = $('#posts:first').width();

		var intIndex = 0;



		// Vertical Scrolling

		if ( direction == 1 )

		{

				// Timed Scrolling

				if ( type == 1 )

				{

						var scrollPos = postHeight;

						var totalHeight = $('#feature-scroll').height();

						var hrefCount = 1;



						var hrefs = new Array();

						$('#recent-links li a.show').each(function(){

										$(this).css({'cursor':'text'}).attr({'title':''}).click(function(){ return false; });

										hrefs.push($(this).attr('href'));

						})



						$.timer(interval, function (timer)

								{

										$('#recent-links li a.show').removeClass('active');



										$('#posts').scrollTo({ top: scrollPos,left: 0 }, speed, { easing: '' + easingType + '' } )

										scrollPos = ( scrollPos + postHeight );

										$("#recent-links li a.show[href='" + hrefs[hrefCount] + "']").addClass('active');



										hrefCount = hrefCount + 1;

										if ( scrollPos == totalHeight )

										{

												hrefCount = 0;

												scrollPos = 0;

										}



										$('#recent-links li a').click(function()

												{

														return false;

												});

								});

				}

				// Click Only

				else

				{

						$( "#recent-links li a.show" ).each(function( i )

								{

										var scrollPos = intIndex + ( postHeight * i )

										$(this).attr({

														href: '#'

										});

										$(this).click(function()

												{

														$('#recent-links li a.show').removeClass('active');

														$(this).addClass('active');

														$('#posts').scrollTo({ top: scrollPos,left: 0 }, speed,{ easing: '' + easingType + '' } )

														return false;

												});

								});

				}

		}

		// Horizontal Scrolling

		else

		{

				$('#featured-posts #posts').css({ 'width' : '62em' });

				$('#feature-scroll').css({ 'width' : '310em' });

				$('#featured-posts #posts .post').css({ 'float' : 'left' });



				// Timed Scrolling

				if ( type == 1 )

				{

						var scrollPos = postWidth;

						var totalWidth = $('#feature-scroll').width();

						var hrefCount = 1;



						var hrefs = new Array();

						$('#recent-links li a.show').each(function(){

										$(this).css({'cursor':'text'}).attr({'title':''}).click(function(){ return false; });

										hrefs.push($(this).attr('href'));

						})



						$.timer(interval, function (timer)

								{

										$('#recent-links li a.show').removeClass('active');



										$('#posts').scrollTo( 

												{ top: 0,left: scrollPos }, 

												speed, 

												{ axis:'x' }, 

												{ easing: '' + easingType + '' } )

										scrollPos = ( scrollPos + postWidth );

										$("#recent-links li a.show[href='" + hrefs[hrefCount] + "']").addClass('active');



										hrefCount = hrefCount + 1;

										if ( scrollPos == totalWidth )

										{

												hrefCount = 0;

												scrollPos = 0;

										}



										$('#recent-links li a').click(function()

												{

														return false;

												});

								});

				}

				// Click Only

				else

				{

						var postWidth = $('#posts:first').width();

						var intIndex = 0;

						$( "#recent-links li a.show" ).each(function( i )

								{

										var scrollPos = intIndex + ( postWidth * i )

										$(this).attr({

														href: '#'

										});

										$(this).click(function()

												{

														$('#recent-links li a.show').removeClass('active');

														$(this).addClass('active');

														$('#posts').scrollTo( { top: 0,left: scrollPos }, speed, {axis:'x'}, { easing: '' + easingType + '' } )

														return false;

												});

								});

				}

		}

}

