$(document).ready(function(){
			if ($("#s4").length) {
			$.fn.cycle.defaults.timeout = 6000;
					$(function() {
					// run the code in the markup!
					$('#s4').before('<div id="nav" class="nav">').cycle({
						fx:     'fade',
						speed:  'slow',
						autostopCount:   5,
						autostop:   0,
						timeout: 6000,
						pager:  '#nav'
					});
					});
				};
		    if ($("#featureCarousel").length) {
			$(document).ready(function() {
								$("#featureCarousel").featureCarousel({
								});
			});
			};
			$.fn.equalHeight = function() {
				var group = this;
				$(window).bind('resize', function(){
				var tallest = 0;
				$(group).height('auto').each(function() {
				tallest = Math.max(tallest, $(this).height());
				}).height(tallest);
				}).trigger('resize');
			}
			// prettyPhoto
			if ($(".psma_lightbox_image").length) {
			$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
			};		
			// lightbox image
			$(".psma_lightbox_image").append("<span></span>")
					
			$(".psma_lightbox_image").hover(function(){
				$(this).find("img").stop().animate({opacity:0.5}, "normal")
			}, function(){
				$(this).find("img").stop().animate({opacity:1}, "normal")
			});
			$(".psma_lightbox_video").append("<span></span>")
				
			$(".psma_lightbox_video").hover(function(){
				$(this).find("img").stop().animate({opacity:0.5}, "normal")
			}, function(){
				$(this).find("img").stop().animate({opacity:1}, "normal")
			});

			$('#toc a').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
				$.scrollTo( this.hash, 1500);
				$(this.hash).find('#options-examples').text( this.title );
				return false;
			});
			$(".psma_height").equalHeight();
						jQuery('ul.psma_menu').superfish();
						DD_roundies.addRule('.psma_button_small_rev, .psma_button_small, .psma_pagination a, .psma_picture, .psma_pagination, .psma_act', '5px');
	});	
	
