$j(document).ready(function(){
	// $j(".logo").css("border","1px solid #f00"); 
	
//==== Category Slider =====//
	
	$j(function(){
		$j('.slides').slides({
			preload: false,
			preloadImage: 'img/loading.gif',
			//play: 5000,
			pause: 2500,
			hoverPause: true,
			generatePagination: false
		});
	});

	$j(".category-slider .category-title a").hover(
		function(){$j(this).children("span").css("visibility","visible");},
		function(){$j(this).children("span").css("visibility","hidden");}
	);

//==== Product Images =====//

	$j(function(){
		$j('#product-media').slides({
			preload: true,
			preloadImage: 'img/loading.gif',
			effect: 'slide, fade',
			crossfade: true,
			slideSpeed: 200,
			fadeSpeed: 400,
			generateNextPrev: false,
			generatePagination: false
		});
	});

//==== Sheer Explanation =====//

	$j(".sheer").hover(
		function(){$j(".sheer #main").show();},
		function(){$j(".sheer #main").hide();}
	);

//====Hide Tack Ons and Show More Button=====//

if( $j('.tack-ons ol li:nth-child(n+2)').length == 0 ) {

//only one tack on

} else {

//$j(".tack-ons ol li:nth-child(n+2)").hide();
$j(".tack-show-more").hide(); //delete the top padding on share bar and chage this to show

//$j('.tack-ons .show-more').click(function() {
  //$j('.tack-ons ol li:nth-child(n+2)').show();
  //$j(".tack-show-less").show();
  //$j(".tack-show-more").hide();
//});

//$j('.tack-show-less').click(function() {
  //$j('.tack-ons ol li:nth-child(n+2)').hide();
  //$j(".tack-show-less").hide();
  //$j(".tack-show-more").show();
//});

}
   
//============================================//


//==== Share Button =====//

$j(".share-links-title").click(function() {
  $j(".more-share-links").toggle();
});

$j(".share-close").click(function() {
  $j(".more-share-links").hide();
});

//=======================//


	
	$j.fn.scrollFloat = function() {
	
		var $jitem 				= this;
		$jitem.css({ position: 'absolute' });
		
		var startTop	 		= $jitem.offset().top;
		$jitem.css({ top: startTop });
		
		var maxBottom			= $jitem.parent().height()-$jitem.height()+startTop;
		var offsetTop		 	= parseInt($jitem.parent().css('padding-top'));
		var offsetBottom	 	= parseInt($jitem.parent().css('padding-bottom'));
		var speed	           	= 200;
	
		$j(window).scroll(function () { 
		
			$jitem.stop();
			
			var newTop = $j(document).scrollTop()+offsetTop;
			var newBottom = $j(document).scrollTop()-$jitem.height()+$j(window).height()-offsetBottom;
			
			if ( newTop < startTop)
				 newTop = startTop;	
		
			if ( newBottom > maxBottom )
				 newBottom = maxBottom;						
	
			if ( $jitem.height() > $j(window).height() ){	// IF item is bigger than visable window							
				
				if ( $j(document).height()-$j(document).scrollTop()-$j(window).height() < $j(document).height()-$jitem.offset().top-$jitem.height()-offsetBottom )
					$jitem.animate({top: newBottom}, speed);
			
				if ( $j(document).scrollTop() < $jitem.offset().top-offsetTop )
					$jitem.animate({top: newTop}, speed);
			}
			
			else {	// IF item is NOT bigger than visable window	
			
				if ( newTop >= maxBottom )
					newTop = maxBottom;
				 		
				$jitem.animate({ top: newTop }, speed );
			};
		});
	};
	
	//$j('.sidebar').scrollFloat();
	
	
	//========Ebay Counter========//
	
$j("#ebay55-contentbox").keyup(function()
{
var box=$j(this).val();
var main = box.length *100;
var value= (main / 55);
var count= 55 - box.length;

if(box.length <= 55)
{
$j("#ebay55-bar").css("background-color","#5fbbde"); 
$j("#ebay55-count").css("color","#666666"); 
$j('#ebay55-count').html(count);
$j('#ebay55-bar').animate(
{
"width": value+'%',
}, 1);
}
else
{
$j('#ebay55-count').html(count);
$j("#ebay55-bar").css("background-color","red"); 
$j("#ebay55-count").css("color","red"); 
}
return false;
});
			
});  //ENDS (document).ready
