//Use $j because $ conflicts with prototype
var $j = jQuery.noConflict(); 

/************************************** Append Prepend Images ******************************************/
$j(document).ready(function(){
		$j('.nav-wrapper ul li ul li').append('');	
		$j('.block-title span:not(.newsletter-block)').prepend('<img src="'+SKIN_URL+'images/ico-petland.jpg" width="17" height="18" /> ');	
});

/************************************** Preload Images ******************************************/
$j(document).ready(function(){
	
	(function($j) {
	  var cache = [];
	  // Arguments are image paths relative to the current page.
	  $j.preLoadImages = function() {
		var args_len = arguments.length;
		for (var i = args_len; i--;) {
		  var cacheImage = document.createElement('img');
		  cacheImage.src = arguments[i];
		  cache.push(cacheImage);
		}
	  }
	})($j)
	
	$j.preLoadImages(""+SKIN_URL+"images/nav-sub-wrapper.png",
					 ""+SKIN_URL+"images/reviews-star1-over.jpg",
					 ""+SKIN_URL+"images/reviews-star2-over.jpg",
					 ""+SKIN_URL+"images/reviews-star3-over.jpg",
					 ""+SKIN_URL+"images/reviews-star4-over.jpg",
					 ""+SKIN_URL+"images/reviews-star5-over.jpg",
					 ""+SKIN_URL+"images/nav-over.jpg");
});

/************************************** Turn Autocomplete ON ******************************************/
$j(document).ready(function(){
	$j('.search-box').attr('autocomplete', 'on');		
});

/************************************** Tab reviews ******************************************/
$j(document).ready(function(){
	var url = location.href;
	if(url.indexOf('#tabs') != -1) {
		$j('.tabs ul li').removeClass('over');
		$j('.tab-wrapper div').removeClass('opened');
		$j('.tab2').addClass('over');
		$j('.tab-wrapper div.content2').addClass('opened');
	}
});

/************************************** Promo Randomizer ******************************************/
$j(document).ready(function(){
	$j('.catalog-promos').cycle({
		fx: 'fade', // ex: fade, scrollUp, shuffle
		timeout: 0,
		delay: -1000,
		speed: 400,
		random: 1
	});
});

/************************************** Header td spacing fix ******************************************/
$j(document).ready(function(){
	$j('.spec-links td:even').css('padding', '0 3px 0 0');
});	
	
/************************************** Arrow fix ******************************************/
$j(document).ready(function(){
	if($j.browser.webkit) {
		$j('.featured-titles span.arrow').css('top', '28px');
	}
});	
/************************************** Infinite Scroller ******************************************/
$j.fn.infiniteCarousel = function () {

    function repeat(str, num) {
        return new Array( num + 1 ).join( str );
    }

    return this.each(function () {
        var $wrapper = $j('> div', this).css('overflow', 'hidden'),
            $slider = $wrapper.find('> ul'),
            $items = $slider.find('> li'),
            $single = $items.filter(':first'),

            singleWidth = $single.outerWidth(),
			// note: doesn't include padding or border
            visible = (Math.ceil($wrapper.innerWidth() / singleWidth)),
            currentPage = 1,
            pages = Math.ceil($items.length / visible);


        /* 1. Pad so that ' visible' number will always be seen, otherwise create empty item */

        if (($items.length % visible) != 0) {
            $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
            $items = $slider.find('> li');
        }

        // 2. Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
        $items.filter(':first').before($items.slice(- visible).clone().addClass('cloned'));
        $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
        $items = $slider.find('> li'); // reselect

        // 3. Set the left position to the first 'real' item
        $wrapper.scrollLeft(singleWidth * visible);

        // 4. paging function
        function gotoPage(page) {
            var dir = page < currentPage ? -1 : 1,
                n = Math.abs(currentPage - page),
                left = singleWidth * dir * visible * n;

            $wrapper.filter(':not(:animated)').animate({
                scrollLeft : '+=' + left
            }, 500, function () {
                if (page == 0) {
                    $wrapper.scrollLeft(singleWidth * visible * pages);
                    page = pages;
                } else if (page > pages) {
                    $wrapper.scrollLeft(singleWidth * visible);
                    // reset back to start position
                    page = 1;
                }

                currentPage = page;
            });

            return false;
        }

        // 5. Bind to the forward and back buttons
        $j('a.back').click(function () {
            return gotoPage(currentPage - 1);
        });

        $j('a.forward').click(function () {
            return gotoPage(currentPage + 1);
        });

        // create a public interface to move to a specific page
        $j(this).bind('goto', function (event, page) {
            gotoPage(page);
        });
    });
};

$j(document).ready(function () {
  $j('.infiniteCarousel').infiniteCarousel();
});

/************************************** Left side nav accordian ******************************************/
$j(document).ready(function () {
	$j('.left-nav > a').click(function() {
		if($j(this).prev().css('height') != '100%') {
			$j(this).prev().animate({height: '100%' }, 'fast');
			$j(this).html('<strong>See Less Categories</strong>');
		} else {
			$j(this).prev().animate({height: '46px' }, 'fast');
			$j(this).html('<strong>See All Categories</strong>');
		}
	});
});

/************************************** Home Page Featured Top Sellers ******************************************/
$j(document).ready(function () {
	
	$j('#dog-products').fadeIn('fast');
	
	$j('#dog').mouseover(function() {
		$j('.featured-products').css('display', 'none');
		$j('span.arrow').stop(true, true).animate({ left: '261px'  }, 'fast');
		$j('#dog-products').stop(true, true).fadeIn('slow');
	});
	
	$j('#cat').mouseover(function() {
		$j('.featured-products').css('display', 'none');
		$j('span.arrow').stop(true, true).animate({ left: '310px'  }, 'fast');
		$j('#cat-products').stop(true, true).fadeIn('slow');
	});
	
	$j('#bird').mouseover(function() {
		$j('.featured-products').css('display', 'none');
		$j('span.arrow').stop(true, true).animate({ left: '359px'  }, 'fast');
		$j('#bird-products').stop(true, true).fadeIn('slow');
	});
	
	$j('#reptile').mouseover(function() {
		$j('.featured-products').css('display', 'none');
		$j('span.arrow').stop(true, true).animate({ left: '420px'  }, 'fast');
		$j('#reptile-products').stop(true, true).fadeIn('slow');
	});
	
	$j('#small-animal').mouseover(function() {
		$j('.featured-products').css('display', 'none');
		$j('span.arrow').stop(true, true).animate({ left: '513px'  }, 'fast');
		$j('#small-animal-products').stop(true, true).fadeIn('slow');
	});
	
	$j('#fish').mouseover(function() {
		$j('.featured-products').css('display', 'none');
		$j('span.arrow').stop(true, true).animate({ left: '599px'  }, 'fast');
		$j('#fish-products').stop(true, true).fadeIn('slow');
	});

});

/************************************** Accordian ******************************************/
$j(document).ready(function(){
	$j('#directory').accordion({
		active: false,
		alwaysOpen: false, 
		header: '.head',
		active: '.selected',
		autoheight: false
	}); 
});

/************************************** Dropdown Menu ******************************************/
$j(document).ready(function () {

		$j('#dogHead').hover(
		function () {
			$j('.dogWrap').stop(true,true).fadeIn('fast');
			$j('#dogHead > a').css('color', '#566c11');
			$j('#dogHead').addClass('tabOver');
		},
		function () {
			$j('.dogWrap').stop(true,true).fadeOut(0);
			$j('#dogHead > a').css('color', '#fff');
			$j('#dogHead').removeClass('tabOver');
		}
		);
	
});
$j(document).ready(function () {

		$j('#catHead').hover(
		function () {
			$j('.catWrap').stop(true,true).fadeIn('fast');
			$j('#catHead > a').css('color', '#566c11');
			$j('#catHead').addClass('tabOver');
		},
		function () {
			$j('.catWrap').stop(true,true).fadeOut(0);
			$j('#catHead > a').css('color', '#fff');
			$j('#catHead').removeClass('tabOver');
		}
		);

	
});
$j(document).ready(function () {

		$j('#birdHead').hover(
		function () {
			$j('.birdWrap').stop(true,true).fadeIn('fast');
			$j('#birdHead > a').css('color', '#566c11');
			$j('#birdHead').addClass('tabOver');
		},
		function () {
			$j('.birdWrap').stop(true,true).fadeOut(0);
			$j('#birdHead > a').css('color', '#fff');
			$j('#birdHead').removeClass('tabOver');
		}
		);
	
});
$j(document).ready(function () {

		$j('#reptileHead').hover(
		function () {
			$j('.reptileWrap').stop(true,true).fadeIn('fast');
			$j('#reptileHead > a').css('color', '#566c11');
			$j('#reptileHead').addClass('tabOver');
		},
		function () {
			$j('.reptileWrap').stop(true,true).fadeOut(0);
			$j('#reptileHead > a').css('color', '#fff');
			$j('#reptileHead').removeClass('tabOver');
		}
		);
	
});
$j(document).ready(function () {

		$j('#smallHead').hover(
		function () {
			$j('.smallWrap').stop(true,true).fadeIn('fast');
			$j('#smallHead > a').css('color', '#566c11');
			$j('#smallHead').addClass('tabOver');
		},
		function () {
			$j('.smallWrap').stop(true,true).fadeOut(0);
			$j('#smallHead > a').css('color', '#fff');
			$j('#smallHead').removeClass('tabOver');
		}
		);

	
});
$j(document).ready(function () {

		$j('#pondHead').hover(
		function () {
			$j('.pondWrap').stop(true,true).fadeIn('fast');
			$j('#pondHead > a').css('color', '#566c11');
			$j('#pondHead').addClass('tabOver');
		},
		function () {
			$j('.pondWrap').stop(true,true).fadeOut(0);
			$j('#pondHead > a').css('color', '#fff');
			$j('#pondHead').removeClass('tabOver');
		}
		);
	
});
$j(document).ready(function () {

		$j('#fishHead').hover(
		function () {
			$j('.fishWrap').stop(true,true).fadeIn('fast');
			$j('#fishHead > a').css('color', '#566c11');
			$j('#fishHead').addClass('tabOver');
		},
		function () {
			$j('.fishWrap').stop(true,true).fadeOut(0);
			$j('#fishHead > a').css('color', '#fff');
			$j('#fishHead').removeClass('tabOver');
		}
		);
	
});

/************************************** Tabs Product View ******************************************/
$j(document).ready(function () {
	$j('.tabs ul li.tab1').click(function() {
		$j('.tabs ul li').removeClass('over');
		$j('.tab-wrapper div').removeClass('opened');
		$j(this).addClass('over');
		$j('.tab-wrapper div.content1').addClass('opened');
	});
	$j('.tabs ul li.tab2').click(function() {
		$j('.tabs ul li').removeClass('over');
		$j('.tab-wrapper div').removeClass('opened');
		$j(this).addClass('over');
		$j('.tab-wrapper div.content2').addClass('opened');
	});	
	$j('.tabs ul li.tab3').click(function() {
		$j('.tabs ul li').removeClass('over');
		$j('.tab-wrapper div').removeClass('opened');
		$j(this).addClass('over');
		$j('.tab-wrapper div.content3').addClass('opened');
	});	
});

//If the user clicks on "Write a Review" it will open the tab
$j(document).ready(function () {
	$j('.review-btn').click(function() {
		$j('.tabs ul li').removeClass('over');
		$j('.tab-wrapper div').removeClass('opened');
		$j('.tabs ul li.tab2').addClass('over');
		$j('.tab-wrapper div.content2').addClass('opened');							  
	});
});	

/************************************** Category Dropdowns ******************************************/

$j(document).ready(function () {
	$j('.cat-options-wrapper').hover(
	function() {	
	},
	function () {
		$j(this).css('display', 'none');
		$j('.cat-dropdown-wrapper').removeClass('over');
	});
});	

$j(document).ready(function () {
	$j('.tab1').click(function() {
		$j('.cat-dropdown-wrapper').removeClass('over');	
		$j(this).addClass('over').fadeIn('fast');					   
		$j('.cat-options-wrapper').css('display', 'none');
		$j('.c1').fadeIn('fast');
	});
	$j('.tab2').click(function() {
		$j('.cat-dropdown-wrapper').removeClass('over');
		$j(this).addClass('over');
		$j('.cat-options-wrapper').css('display', 'none');
		$j('.c2').fadeIn('fast');
	});	
	$j('.tab3').click(function() {
		$j('.cat-dropdown-wrapper').removeClass('over');
		$j(this).addClass('over');
		$j('.cat-options-wrapper').css('display', 'none');
		$j('.c3').fadeIn('fast');
	});	
	

});	

$j(document).ready(function() { 
	$j(".c1 .list").quickPager({
		pageSize: 60
	});
});
$j(document).ready(function () {
	if($j('.c1 .pageNav').length) {
		$j('.c1').css('height', '418px');
	}
});	
/************************************** Search Dropdown ******************************************/



$j(document).ready(function () {
							 
	$j('.all-cats-wrapper .options').hover(
		function() {	
		},
		function () {
			$j(this).fadeOut('fast');
	});

	$j('.form-search > .all-cats-wrapper').click(function() {
		$j('.all-cats-wrapper .options').removeClass('over');
		$j('.all-cats-wrapper .options').fadeIn('fast');
	});
	
	$j('.all-cats-wrapper .options li').click(function() {
		$j('.all-cats-wrapper .all').html($j(this).html());	
		$newValue = $j('.all-cats-wrapper .all a').attr("value");
		$searchString = $j('.search-box').attr("value");
		$j('#search_mini_form').attr("action", STORE_URL+"catalogsearch/result/?q="+$searchString+"&cat="+$newValue+"");
		$j('.category-id').attr("value", $newValue);
		$j('.search-box').focus();

	});
	
	$j('#search-submit').click(function() {
		$newValue = $j('.all-cats-wrapper .all a').attr("value");
		$searchString = $j('.search-box').attr("value");
		$j(this).attr("href", STORE_URL+"catalogsearch/result/?q="+$searchString+"&cat="+$newValue+"");
	});
	
	$j(".all-cats-wrapper").click(function(e){
		e.stopPropagation();
	});
	
	$j(document).click(function() { 
		$j('.all-cats-wrapper .options').fadeOut('fast');
	});
	
});	


/************************************** CMS Active Links ******************************************/
function extractPageName(hrefString)
{
	var arr = hrefString.split('/');
	return  (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();               
}

function setActiveMenu(arr, crtPage)
{
	for (var i=0; i<arr.length; i++)
	{
		if(extractPageName(arr[i].href) == crtPage)
		{
			if (arr[i].parentNode.tagName != "DIV")
			{
				arr[i].className = "current";
				arr[i].parentNode.className = "current";
			}
		}
	}
}

function setPage()
{
	hrefString = document.location.href ? document.location.href : document.location;

	if (document.getElementById("cmsnav")!=null)
		setActiveMenu(document.getElementById("cmsnav").getElementsByTagName("a"), extractPageName(hrefString));
}

/************************************** Ask Safari Stan Scripts ******************************************/
$j(document).ready(function () {
							 
	$j('.safari-answers li').css('display', 'none');	
	$j('#default').css('display', 'block');	
	
	$j('#q1').click(function() {
		$j('.safari-answers li').css('display', 'none');
		$j('#a1').fadeIn('fast');					 
	});
	
	$j('#q2').click(function() {
		$j('.safari-answers li').css('display', 'none');
		$j('#a2').fadeIn('fast');					 
	});
	
	$j('#q3').click(function() {
		$j('.safari-answers li').css('display', 'none');
		$j('#a3').fadeIn('fast');					 
	});
	
	$j('#q4').click(function() {
		$j('.safari-answers li').css('display', 'none');
		$j('#a4').fadeIn('fast');					 
	});
	
	$j('#q5').click(function() {
		$j('.safari-answers li').css('display', 'none');
		$j('#a5').fadeIn('fast');					 
	});
	
	$j('#q6').click(function() {
		$j('.safari-answers li').css('display', 'none');
		$j('#a6').fadeIn('fast');					 
	});
	
	$j('#q7').click(function() {
		$j('.safari-answers li').css('display', 'none');
		$j('#a7').fadeIn('fast');					 
	});
	
	$j('#q8').click(function() {
		$j('.safari-answers li').css('display', 'none');
		$j('#a8').fadeIn('fast');					 
	});
	
});	

/************************************** Form onfocus/onblur ******************************************/
/*$j(document).ready(function () {
	$j('input, textarea').focus(function() {
		value=$j(this).val();
		$j(this).attr("value","");
	});
	$j('input, textarea').blur(function() {
		if($j(this).val()=="") {
			$j(this).val(value);
		}
	});
});		
*/

/************************************** Product View Mojo Zoom ******************************************/
$j(document).ready(function () {
	MojoZoom.makeZoomable(  
		$j('#product-image'), 
		150, 300,  
		true  
	); 
});	

/************************************** Customer Support ******************************************/
$j(document).ready(function () {
	
	$j('#contactFields').click(function() {
		$j('.contact-form-wrap').fadeIn('fast');
	});
	
});	

/************************************** Weekend Warrior Promotion ******************************************/
$j(document).ready(function () {
	if($j('#black').length) {
		$j('.breadcrumbs').css('display', 'none');	
		$j('.block-banner').css('background', '#fff');
		$j('.block-content').css('padding', '0');
		$j('.toolbar').css('display', 'none');
		$j('.category-products').css('padding', '20px 0');
		$j('.col1-layout .products-grid').css('width', '926px');
		$j('.no-rating').css('display', 'none');
		$j('.promo-wrap').eq(0).addClass('first');
		$j('.promo-wrap').eq(1).addClass('second');
		$j('.promo-wrap').eq(2).addClass('third');
		$j('.first .products-grid').eq(1).after('<p style="text-align: center;" ><a href="'+STORE_URL+'free-shipping-info/"><img src="'+SKIN_URL+'images/tankreonvation-shipping.jpg" alt="Five Dollar Flat Rate Shipping" /></a></p>');
		$j('.second .products-grid').eq(1).after('<p style="text-align: center;" ><a href="'+STORE_URL+'free-shipping-info/"><img src="'+SKIN_URL+'images/tankreonvation-shipping.jpg" alt="Five Dollar Flat Rate Shipping" /></a></p>');
		$j('.third .products-grid').eq(1).after('<p style="text-align: center;" ><a href="'+STORE_URL+'free-shipping-info/"><img src="'+SKIN_URL+'images/tankreonvation-shipping.jpg" alt="Five Dollar Flat Rate Shipping" /></a></p>');
		$j('.products-grid.last').append('<li><a href="'+SKIN_URL+'images/promo-instore-big.jpg" target="_blank"><img src="'+SKIN_URL+'images/promo-instore.jpg" alt="In-Store Special" /></a></li>')
		$j('.price-box p').css('margin', '0');
	}
});

/************************************** Dental / Smile Promotion ******************************************/
$j(document).ready(function () {
	if($j('#dental').length) {
		$j('.breadcrumbs').css('display', 'none');	
		$j('.block').css('background', 'none');
		$j('.block').css('border', '0');
		$j('.block-content').css('padding', '0');
		$j('.toolbar').css('display', 'none');
		$j('.category-products').css('padding', '20px 0');
		$j('.col1-layout .products-grid').css('width', '926px');
		$j('.no-rating').css('display', 'none');
		$j('.promo-wrap').eq(0).addClass('first');
		$j('.promo-wrap').eq(1).addClass('second');
		$j('.promo-wrap').eq(2).addClass('third');
		$j('.first .products-grid').eq(1).after('<p style="text-align: center;" ><a href="'+STORE_URL+'free-shipping-info/"><img src="'+SKIN_URL+'images/tankreonvation-shipping.jpg" alt="Five Dollar Flat Rate Shipping" /></a></p>');
		$j('.second .products-grid').eq(1).after('<p style="text-align: center;" ><a href="'+STORE_URL+'free-shipping-info/"><img src="'+SKIN_URL+'images/tankreonvation-shipping.jpg" alt="Five Dollar Flat Rate Shipping" /></a></p>');
		$j('.third .products-grid').eq(1).after('<p style="text-align: center;" ><a href="'+STORE_URL+'free-shipping-info/"><img src="'+SKIN_URL+'images/tankreonvation-shipping.jpg" alt="Five Dollar Flat Rate Shipping" /></a></p>');
		$j('.products-grid.last').append('<li><a href="'+SKIN_URL+'images/promo-instore-big.jpg" target="_blank"><img src="'+SKIN_URL+'images/promo-instore.jpg" alt="In-Store Special" /></a></li>')
		$j('.price-box p').css('margin', '0');
		
		$j('#dental').accordion({
			active: false,
			alwaysOpen: false, 
			header: '#dental-roll',
			event: 'mouseover',
			active: '.selected',
			autoheight: false,
			animated: 'easeslide'
		});
	}
	
	if($j('#lll').length) {
		$j('.breadcrumbs').css('display', 'none');	
		$j('.block-banner').css('background', '#fff');
		$j('.block-content').css('padding', '0');
		$j('.toolbar').css('display', 'none');
		$j('.category-products').css('padding', '20px 0');
		$j('.col1-layout .products-grid').css('width', '926px');
		$j('.no-rating').css('display', 'none');
		$j('.price-box p').css('margin', '0');
		
		$j('#lll .lll-buttons div').click(function() {
			$j('#lll .lll-buttons div .lll-arrow').css('display', 'none');
			$j('#lll .lll-buttons div span').css('height', '70px');
			$j('#lll .lll-buttons div').addClass('unselected');
			$j(this).removeClass('unselected');
			$j('#lll .lll-buttons div').removeClass('selected');
			$j(this).find('.lll-arrow').css('display', 'block');
			$j(this).addClass('selected');
			$j(this).find('span').animate({height: '80px'}, 'fast')
			
			if($j('#lll .lll-buttons div').eq(0).hasClass('selected')) {
				$j('.lll-products').fadeOut('fast');
				$j('.lll-content').fadeIn('fast');
			} else {
				$j('.lll-content').fadeOut('fast');
				$j('.lll-products').fadeIn('fast');
			}
		});
		
		$j('.products-grid.last').append('<li><a href="'+SKIN_URL+'images/promo-instore-big.jpg" target="_blank"><img src="'+SKIN_URL+'images/promo-instore.jpg" alt="In-Store Special" /></a></li>')
		$j('.products-grid').eq(1).after('<p style="text-align: center;" ><a href="'+STORE_URL+'free-shipping-info/"><img src="'+SKIN_URL+'images/tankreonvation-shipping.jpg" alt="Five Dollar Flat Rate Shipping" /></a></p>');

	}
});

/************************************** Accordian ******************************************/
$j(document).ready(function(){
	$j('#directory').accordion({
		active: false,
		alwaysOpen: false, 
		header: '.head',
		active: '.selected',
		autoheight: false
	}); 
});

/************************************** Cart ******************************************/
/*
$j(document).ready(function () {
	
	if($j('.method-remove').length) {
		$j('.sp-methods dt:last').remove();
		$j('.sp-methods dd:last').remove();
		$j('.shipment-methods dt:last').remove();
		$j('.shipment-methods dd:last').remove();
	}
	
});	
*/
/************************************** Reviews ******************************************/
$j(document).ready(function () {
	$j('.stars ul li').click(function() {
		$j('.stars ul li').removeClass('selected');
		$j(this).addClass('selected');	
	});
	
	$j('#star1').click(function() {
		$j('#Rating_1').trigger('click');
	});
	$j('#star2').click(function() {
		$j('#Rating_2').trigger('click');
	});
	$j('#star3').click(function() {
		$j('#Rating_3').trigger('click');
	});
	$j('#star4').click(function() {
		$j('#Rating_4').trigger('click');
	});
	$j('#star5').click(function() {
		$j('#Rating_5').trigger('click');
	});
});

/************************************** Recaptcha ******************************************/

 var RecaptchaOptions = {
    theme : 'clean'
 };
 
 /************************************** Home Banner Slider ******************************************/
 $j(document).ready(function() {	

	//Show Banner
	$j(".main_image .desc").show(); //Show Banner
	$j(".main_image .blocker").animate({ opacity: 0.85 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$j(".image_thumb ul li:first").addClass('active'); 
	$j(".image_thumb ul li").click(function(){ 
		//Set Variables
		var imgAlt = $j(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $j(this).find('a').attr("href"); //Get Main Image URL
		var imgDesc = $j(this).find('.blocker').html(); 	//Get HTML of block
		var imgDescHeight = $j(".main_image").find('.blocker').height();	//Calculate height of block	
		
		if ($j(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser				
			$j(".main_image .blocker").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
				$j(".main_image .blocker").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
				$j(".main_image img").attr({ src: imgTitle , alt: imgAlt});
			});
		}
		
		$j(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
		$j(this).addClass('active');  //add class of 'active' on this list only
		return false;
		
	}) .hover(function(){
		$j(this).addClass('hover');
		}, function() {
		$j(this).removeClass('hover');
	});
			
	//Toggle Teaser
	$j("a.collapse").click(function(){
		$j(".main_image .blocker").slideToggle();
		$j("a.collapse").toggleClass("show");
	});
	
});//Close Function

 /************************************** Home Banner Slider (Cycle) ******************************************/
$j(document).ready(function(){
	$j('.banner-images').cycle({
		fx: 'fade', // ex: fade, scrollUp, shuffle
		pager: '.image_thumb',
		pagerAnchorBuilder: function(idx, slide) { 
			// return selector string for existing anchor 
			return '.image_thumb li:eq(' + idx + ') a'; 
		} 
	});
});

