$(document).ready(function(){

/*
$(window).load(function() {
$('#loader').fadeOut(400, function() { $("#loader").remove(); });
});
$("#loader").click(function() { 
	$(this).fadeOut(400);
});
*/

$("li a").click(function() { 
	target = "#post-" + $(this).attr("id");
	$("li a").removeClass("highlight");
	$(this).addClass("highlight");
	$.scrollTo($(target), 800 ,{axis:'xy', easing:'easeInOutExpo'});
	return false;

});
$(window).scroll(function(){ 
$(".post:in-viewport").each(function() {
 myThis = ("#" + $(this).attr("title"));
	$("li a").removeClass("highlight");
	$(myThis).addClass("highlight");
});
});

/*
$("#contact").mouseenter(function(){ 
	if ($(this).text() === "SCHWARZLOSE LUND") {
	$(this).text("LUND SCHWARZLOSE");
	} else {
	$(this).text("SCHWARZLOSE LUND");
	};
});
*/

$("div.fac").cycle({ 
    speed:  '400', 
    timeout: 0, 
    prev:	'.prev-fac',
    next:   '.fac',
	after:  onFac
    });
function onFac(curr,next,opts) {
	var fac = '' + (opts.currSlide + 1) + '/' + opts.slideCount;
	$('#fac-cap').html(fac);
}
$("div.holes").cycle({ 
    speed:  '400', 
    timeout: 0, 
    prev:	'.prev-holes',
    next:   '.holes',
	after:  onHoles
    });
function onHoles(curr,next,opts) {
	var holes = '' + (opts.currSlide + 1) + '/' + opts.slideCount;
	$('#holes-cap').html(holes);
}
$("div.fc").cycle({ 
    speed:  '400', 
    timeout: 0, 
    prev:	'.prev-fc',
    next:   '.fc',
	after:  onfc
    });
function onfc(curr,next,opts) {
	var fc = '' + (opts.currSlide + 1) + '/' + opts.slideCount;
	$('#fc-cap').html(fc);
}
$("div.gray").cycle({ 
    speed:  '400', 
    timeout: 0, 
    prev:	'.prev-gray',
    next:   '.gray',
	after:  onGray
    });
function onGray(curr,next,opts) {
	var gray = '' + (opts.currSlide + 1) + '/' + opts.slideCount;
	$('#gray-cap').html(gray);
}

$("div.d").cycle({ 
    speed:  '400', 
    timeout: 0, 
    prev:	'.prev-d',
    next:   '.d',
	after:  onD
    });
function onD(curr,next,opts) {
	var d = '' + (opts.currSlide + 1) + '/' + opts.slideCount;
	$('#d-cap').html(d);
}
$("div.jm").cycle({ 
    speed:  '400', 
    timeout: 0, 
    prev:	'.prev-jm',
    next:   '.jm',
	after:  onJm
    });
function onJm(curr,next,opts) {
	var jm = '' + (opts.currSlide + 1) + '/' + opts.slideCount;
	$('#jm-cap').html(jm);
}
$("div.od").cycle({ 
    speed:  '400', 
    timeout: 0, 
    prev:	'.prev-od',
    next:   '.od',
	after:  onoD
    });
function onoD(curr,next,opts) {
	var od = '' + (opts.currSlide + 1) + '/' + opts.slideCount;
	$('#od-cap').html(od);
}

if (jQuery.browser.msie && jQuery.browser.version=="6.0") { 
 } else {
	$("#sidebar li a, h1").click(function(){ 
		col = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')'; 
		myCol = $(this).attr("rel");
		myText = $(this).text();
		$("#show h4").text(myText);
		$("#show").css("background-color", myCol);
		$("#show").show();
		$("#show").animate({opacity: 0.8}, 800).fadeOut(800);
	
	
	});
};

});












