var slideshow_pics = [
                        'een.jpg',
                        'twee.jpg',
                        'drie.jpg',
                        ];

var slideshow_index = 0;
function startSlideShow() {  
    Effect.Fade('normalcontent');
    setTimeout("updateSlide('"+slideshow_pics[slideshow_index]+"')", 2000);
    
    setTimeout("continueSlideShow()", 7000);
}

function continueSlideShow() {
    slideshow_index++;
    if (slideshow_index >= slideshow_pics.length) {
        slideshow_index = 0;
    }
    Effect.Fade('slideshow');
    setTimeout("updateSlide('"+slideshow_pics[slideshow_index]+"')", 1000);
    setTimeout("continueSlideShow()", 7000);
}

function updateSlide(new_image) {
    $('slideshow_curpic').src='/img_upload/'+new_image;
    Effect.Appear('slideshow');
}
/*
window.onload = function() {
	var speed = 0.4;
	var repeat = true;
	var id = 'news_ticker';
	if ($(id)) {
		var news_items = $(id).getElementsByTagName('div');
		new Effect.Appear(news_items[0], {duration:0});
		setTimeout("startNewsTicker('"+id+"', "+speed+", "+repeat+")", (speed * 6 * 1000));	
	}
}*/


/*---------------------------------------------------------News ticker--------------------------------
function startNewsTicker(id, speed, repeat) {
	var news_items = $(id).getElementsByTagName('div');
	tickNews(id, speed, repeat);
	setInterval("tickNews('"+id+"', "+speed+", "+repeat+")", (speed * news_items.length * 8 * 1000));	
}
function tickNews(id, speed, repeat, i) {
	var news_items = $(id).getElementsByTagName('div');
	
	if (news_items.length > 1) {
		for (var x=1;x<=news_items.length;x++) {
			var fade_item = news_items[x-1];
			if (x == news_items.length) {
				var appear_item = news_items[0];
			}
			else {
				var appear_item = news_items[x];
			}
			
			new Effect.Fade(fade_item, {duration: speed, from: 1, to: 0, queue: {position: 'end', scope: 'slidescope'} });
			new Effect.Appear(appear_item, {duration: speed, from: 0, to: 1, queue: {position: 'end', scope: 'slidescope'} });
			new Effect.Appear(id, {duration: (speed * 6), queue: {position: 'end', scope: 'slidescope'} });
		}
		if (repeat == true && i>0) {
			i--;
			tickNews(id, speed, repeat, i);
		}
	}
}*/

/*----------------------------------------------------- Custom Lightbox -----------------------------------*/
function showFlash(nr)
{
	if (typeof(nr) == "undefined") {
		nr = '';
	}
	else {
		nr = '-'+nr;	
	}
	
	var sWidth  = document.body.clientWidth;
	var sHeight = document.body.clientHeight;
	
	document.getElementById("c-lightbox-content"+nr).style.left = sWidth - 900 - ((sWidth-900)/2) + "px";
	document.getElementById("c-lightbox-content"+nr).style.top = (getScrollTop() + (getWindowHeight()/2) - 225) + 'px';
    document.getElementById("c-lightbox-content"+nr).style.display = 'block';
    document.getElementById("c-lightbox-overlay"+nr).style.height = getPageY() + 'px';
    document.getElementById("c-lightbox-overlay"+nr).style.display = 'block';

	return false;
}

function closeFlash(nr)
{
	if (typeof(nr) == "undefined") {
		nr = '';
	}
	else {
		nr = '-'+nr;	
	}
	
    document.getElementById("c-lightbox-content"+nr).style.display = 'none';
    document.getElementById("c-lightbox-overlay"+nr).style.display = 'none';
	
	return false;
}

function getPageY(){
	
	var yScroll = getYScroll();
	var windowHeight = getWindowHeight();
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	//arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return pageHeight;
}

function getYScroll() {
	var yScroll = 0;
	
	if (window.innerHeight && window.scrollMaxY) {	
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight + getWindowHeight();
	}
	
	return yScroll;
}

function getWindowHeight() {
	var windowHeight = 700;
	
	if (self.innerHeight) {	// all except Explorer
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowHeight = document.body.clientHeight;
	}	

	return windowHeight;
}

function getScrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
