var randnum = Math.random();
var inum = 7;
var rand1 = Math.round(randnum * (inum-1)) + 1;
images = new Array
images[1] = "/fileadmin/images/backgrounds/001.jpg"
images[2] = "/fileadmin/images/backgrounds/002.jpg"
images[3] = "/fileadmin/images/backgrounds/003.jpg"
images[4] = "/fileadmin/images/backgrounds/004.jpg"
images[5] = "/fileadmin/images/backgrounds/005.jpg"
images[6] = "/fileadmin/images/backgrounds/006.jpg"
images[7] = "/fileadmin/images/backgrounds/007.jpg"
var image = images[rand1]

$(document).ready(function(){

	$('.navi a.open').toggle(function(){
		$(".cover", ".boxgrid").stop().animate({top:'160px'},{queue:false,duration:600});
		$(".icon").attr("src", "/fileadmin/templates/img/icon_open.gif");
	}, function() {
		$(".cover", ".boxgrid").stop().animate({top:'428px'},{queue:false,duration:600});
		$(".icon").attr("src", "/fileadmin/templates/img/icon_close.gif");
	});
	
	// Colorbox Lightbox
	$("a[rel='zertifikate']").colorbox({
		maxWidth: "80%",
		maxHeight: "80%",
		current: "Bild {current} von {total}",
		previous: "zurück",
		next: "weiter",
		close: "schliessen"
	});

});	
	

$(window).load(function() {
	$('#slider').nivoSlider({
        effect:'fade', // Specify sets like: 'fold,fade,sliceDown'
        slices:15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed: 600, // Slide transition speed
        pauseTime: 6000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:false, // 1,2,3... navigation
        controlNavThumbs:false, // Use thumbnails for Control Nav
        keyboardNav:false, // Use left & right arrows
        pauseOnHover:false, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:0.8, // Universal caption opacity
        prevText: 'zur&uuml;ck', // Prev directionNav text
        nextText: 'weiter', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
});

// Cufon
Cufon.replace('h1');
