$(document).ready(function(){

	$('#feat_table td').each(function(){
	
	
		var a = $(this).find('a').remove();
		var t = $(this).html()
		$(this).html('');
		$(a).find('img').attr('title',t);
		$(this).prepend(a);
		
	});

$("#feat_table td img[title]").tooltip();

/*
	$('#feat_table td').each(function(){
	
	
		var a = $(this).find('a').remove();
		var t = $(this).wrapInner('<p></p>');
		$(this).prepend(a)
		$(this).hover(
  		function () {
    		$(this).find('p').fadeIn('fast');
  		},
  		function () {
    		$(this).find('p').fadeOut('fast');
  		}
		);
	});
	
	*/
	
	var pages = Math.floor($('#feat_table').width()/700);
	var currentPage = 1
	
	checkArrows = function(){
		if (pages > currentPage) {$("#feat_btn_right a").fadeIn('fast');} else {$("#feat_btn_right a").fadeOut('fast');}
		if (currentPage > 1) {$("#feat_btn_left a").fadeIn('fast');} else {$("#feat_btn_left a").fadeOut('fast');}
	}
	
	checkArrows();
	
	$("#feat_btn_right a").click(function() {
	
		if (currentPage < pages) {
			
  		$('#feat_table').animate({
    		left: "-=700",
    		easing: "easeout"
 				},500)
 				currentPage++;
 				checkArrows();
			}
		/*else
			{
			$('#feat_table').animate({
    	left: "0",
    	easing: "easeout",
 			},500);
 			currentPage = 1;
			}*/
	 });
	
 	$("#feat_btn_left a").click(function() {

 	if (currentPage > 1) {
			
  		$('#feat_table').animate({
    		left: "+=700",
    		easing: "easeout"
 				},500);
 				currentPage--;
 				checkArrows()
			}
		/*else
			{
			$('#feat_table').animate({
    	left: "0",
    	easing: "easeout",
 			},500);
 			currentPage = 1;
			}*/
	 });
	
});
	
	


