$(document).ready(maininit);
function maininit() {
    /* Markieren von Tabellenzeilen ermöglichen */
    $('table tbody tr').click(function() {
        $(this).toggleClass('marked');
    });

    /* Alle internen Links weich scrollen lassen */
    $('a[@href^="#"]').click(function() {
        var parts        = this.href.split('#');
        var scrolltarget = '#' + parts[1];
        $(scrolltarget).ScrollTo(800);
        return false;
    });
};

$(document).ready(function(){
	$('#news').innerfade({
		animationtype: 'slide',
		speed: 950,
		timeout: 6000,
		type: 'random',
		containerheight: '3em'
	});
});


$(document).ready(function(){

$('p.fourthparagraph').hide(); 

//Code for example B
$("a.buttonBslidedown").click(function(){ $("div.contentToChange").find("p.fourthparagraph:hidden").slideDown("slow"); });
$("input.buttonBslideup").click(function(){ $("div.contentToChange").find("p.fourthparagraph:visible").slideUp("slow"); });
//show code example B
$("a.codeButtonB").click(function(){$("pre.codeB").toggle()});


function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
	var delta = maxValue - minValue;
	var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
	return Math.ceil(stepp)
}

function addFade() {
		doBGFade(this,[255,255,100],[255,255,255],'transparent',75,20,4);
	}
	
function doBGFade(elem,startRGB,endRGB,finalColor,steps,intervals,powr) {
	if (elem.bgFadeInt) window.clearInterval(elem.bgFadeInt);
	var actStep = 0;
	elem.bgFadeInt = window.setInterval(
		function() {
			elem.style.backgroundColor = "rgb("+
				easeInOut(startRGB[0],endRGB[0],steps,actStep,powr)+","+
				easeInOut(startRGB[1],endRGB[1],steps,actStep,powr)+","+
				easeInOut(startRGB[2],endRGB[2],steps,actStep,powr)+")";
			actStep++;
			if (actStep > steps) {
			elem.style.backgroundColor = finalColor;
			window.clearInterval(elem.bgFadeInt);
			}
		}
		,intervals)
}


});

