// Cufon font replacement
Cufon.replace('.entry-title');
Cufon.replace('.seo h2');
Cufon.replace('h1.page-title');

jQuery(document).ready(function($){ 
	
	$('#featured-container').serialScroll({
		target:'#featured', 
		items:'li',
		event: 'click',
		prev:'a.left',
		next:'a.right',
		duration:700,
		interval:8000,
		cycle: true,
		step:1,
		onBefore:function( e, elem, $pane, $items, pos ){ 
		e.preventDefault(); 
		if( this.blur ) 
		this.blur();
		},
		onAfter:function( elem ){ 
		} 
	});
	
	$('#big_icon').cycle({
		fx: 'fade'
	});

	$('#charts_and_stats').cycle({
		fx: 'fade'
	});
	
	$("#image_wrap img[title]").tooltip('#dynatip');
	
	$("div.scrollable").scrollable().circular().autoscroll({autoplay: true, interval: 5000, steps: 5, autopause: true});
	
	$(".items a").click(function($) { 
	    // calclulate large image's URL based on the thumbnail URL
	    var url = jQuery(this).attr("rel");
		var dest = jQuery(this).attr("rev");
	    // get handle to element that wraps the image and make it semitransparent 
	    var wrap = jQuery("#image_wrap").fadeTo("fast", 0.5); 
	    var img = new Image();
	    // call this function after it's loaded 
	    img.onload = function() { 
	        // make wrapper fully visible 
	        wrap.fadeTo("fast", 1); 
	        // change the image 
	      	wrap.find("img").attr("src", url);
			wrap.find("a").attr("href", dest);
    	}; 
 
    	// begin loading the image from flickr 
    	img.src = url; 
 
	// when page loads simulate a "click" on the first image 
	}).filter(":first").click();
	
	$("div.tabs").tabs(".seo > div", {
	effect: 'fade',
	fadeOutSpeed: "fast",
	rotate: true
	}).slideshow({
		clickable: false
	});
	
	$("div.scrollable_content").scrollable({
		vertical: true,
		clickable: false,
		size: 1 
	}).mousewheel();
	
	$("#bignav a").hover(function(){
		jQuery(this).animate({
			opacity: "0"
		}, 500);
	}, function(){
		jQuery(this).animate({
			opacity: "1"
		}, 500);
	});
	
	$(".sf-menu a").hover(function(){
		jQuery(this).animate({
			opacity: "0"
		}, 500);
	}, function(){
		jQuery(this).animate({
			opacity: "1"
		}, 500);
	});
	
	$(".explore img").hover(function(){
		jQuery(this).animate({
			opacity: "0"
		}, 500);
	}, function(){
		jQuery(this).animate({
			opacity: "1"
		}, 500);
	});
	
	$("a.back_to_portfolio").hover(function(){
		jQuery(this).animate({
			opacity: "0"
		}, 500);
	}, function(){
		jQuery(this).animate({
			opacity: "1"
		}, 500);
	});
	
	$("#image_wrap a").hover(function(){
		jQuery(this).animate({
			opacity: "1"
		}, 500);
	}, function(){
		jQuery(this).animate({
			opacity: "0"
		}, 500);
	});
	
});


