var $j = jQuery.noConflict();
$j(document).ready(function(){
		
			if ($j("#s4").length) {
			$j.fn.cycle.defaults.timeout = 6000;
					$j(function() {
					// run the code in the markup!
					$j('#s4').after('<div id="nav"><span id="prevCase"><img src="/images/prevcase.png" /></span><span id="nextCase"><img src="/images/nextcase.png" /></span>').cycle({
						fx:     'fade',
						speed:  'slow',
						timeout: 10000,
						pager:  '#nav',
						height:	'240px',
						next: 'span#nextCase',
						prev: 'span#prevCase'
					});
					});
				};
			//$j('#nav').prepend('<span id="prevCase" style="margin:0px 5px 0px 0px;">&laquo;</span>');
			//$j('#nav').append('<span id="nextCase" style="float:right; cursor: pointer;line-height: 5px; font-size: 14px;">&raquo;</span>');
		    if ($j("#featureCarousel").length) {
			$j(document).ready(function() {
								$j("#featureCarousel").featureCarousel({
								});
			});
			};
			$j.fn.equalHeight = function() {
				var group = this;
				$j(window).bind('resize', function(){
				var tallest = 0;
				$j(group).height('auto').each(function() {
				tallest = Math.max(tallest, $j(this).height());
				}).height(tallest);
				}).trigger('resize');
			}
			$j('#prevCase, #nextCase').mouseover(function(){
				$j(this).css('text-decoration','underline');
			}).mouseout(function(){
				$j(this).css('text-decoration','none');
			});
			// prettyPhoto
			if ($j(".novisites_lightbox_image").length) {
			$j("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
			};		
			// lightbox image
			$j(".novisites_lightbox_image").append("<span></span>")
					
			$j(".novisites_lightbox_image").hover(function(){
				$j(this).find("img").stop().animate({opacity:0.5}, "normal")
			}, function(){
				$j(this).find("img").stop().animate({opacity:1}, "normal")
			});
			$j(".novisites_lightbox_video").append("<span></span>")
				
			$j(".novisites_lightbox_video").hover(function(){
				$j(this).find("img").stop().animate({opacity:0.5}, "normal")
			}, function(){
				$j(this).find("img").stop().animate({opacity:1}, "normal")
			});

			$j('#s4').click(function(){//$j.scrollTo works EXACTLY the same way, but scrolls the whole screen
				//$j.scrollTo( this.hash, 1500);
				$j(this.hash).find('#options-examples').text( this.title );
				return false;
			});
	});
