  $(document).ready(function() {
    
    Cufon.replace('h1,h2,h3,h4,h5,h6,#myslidemenu a,.leftpost,.postcomment', {hover: 'true'});
    
		$("a[rel=fancy]").fancybox({
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
		});
        
    /* Slideshow Cycle*/
    imageLoader();
            
    /* Animate Portfolio Items */
    if ($.browser.msie && $.browser.version < 7) return;
    $(".imgportfolio").fadeTo(1, 1);
    $(".imgportfolio").hover(
      function () {
        $(this).fadeTo("fast", 0.5)
        $(".loader").css("background","url(./images/zoom.png) 50% 50% no-repeat");
      },
      function () {
        $(this).fadeTo("slow", 1);
      }
    );
    
    
	});	
	
// Image loader
function imageLoader() {
	
    $('.loader').each(function () {
					  
        var loader = $(this);
        var pathToImage = loader.attr('title');
        var img = new Image();
	  
        $(img).css("opacity", "0.0").load(function () {
								    
            loader.append(this).removeAttr('title');
		
            $(this).css("margin", "0px").css("opacity", "0.0").animate({
											     
                opacity: 1.0
		    
            },400, function () {
			
                loader.css({ "background-image": "none", "background-color": "transparent" });
		    
            });
		
        }).attr('src', pathToImage);
	  
    });
    
}	
	
