Cufon.replace('.jane', {
    fontFamily: 'Jane'
});

hs.graphicsDir = 'js/highslide/graphics/';
hs.wrapperClassName = 'draggable-header';
hs.dimmingOpacity = 0;
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.fadeInOut = true;
hs.captionEval = 'this.a.title';

function changeCredit(carousel, item, idx, state) {
	var credit = $("#item"+idx).attr('title');
	$("#credit").html(credit);
}

function mycarousel_initCallback(carousel) {
    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });
    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


jQuery(document).ready(function() {

	
	if($("#experiences").length == 1) {
		$("#mycarousel").jcarousel({
	        scroll: 1,
			auto: 10,
	        wrap: 'last',
	        initCallback: mycarousel_initCallback,
	        itemVisibleInCallback: {
            onBeforeAnimation: changeCredit
        	},
	        // This tells jCarousel NOT to autobuild prev/next buttons
	        buttonNextHTML: null,
	        buttonPrevHTML: null
	    });
	}	
	
	function positioning() {
		if($("#home").length == 1) { //if Homepage
			$("#home").hide();
			var pos = $("#imageholder").offset(); 
			var hh = $("#imageholder").height();
			var ww = $("#imageholder").width();
			$("#home").css( { "left": (pos.left+675) + "px", "top":(pos.top+415) +"px" } );
			$("#home").fadeIn();
		}
		
		if($("#about").length == 1) { //if Homepage
			$("#about").hide();
			var pos = $("#imageholder").offset(); 
			$("#about").css( { "left": (pos.left+575) + "px", "top":(pos.top+270) +"px" } );
			$("#about").fadeIn();
		}
		
		if($("#contact").length == 1) { //if Homepage
			$("#contact").hide();
			var pos = $("#imageholder").offset(); 
			$("#contact").css( { "left": (pos.left+635) + "px", "top":(pos.top+404) +"px" } );
			$("#contact").fadeIn();
		}
		
		if($("#prev").length == 1) { //if Homepage
			var pos = $("#imageholder").offset(); 
			$("#prev").css( { "left": (pos.left) + "px", "top":(pos.top+235) +"px" } );

		}	
		if($("#next").length == 1) { //if Homepage
			var pos = $("#imageholder").offset();
			var ww = $("#imageholder").width();
			$("#next").css( { "left": (pos.left+ww-30) + "px", "top":(pos.top+235) +"px" } );
		}	
	}

	
	
	positioning();
	
	$(window).bind('resize', function() {
		positioning();
	});
	
	$(document).pngFix(); 

});
