/*
	Copyright (c) 2005 - 2009 Dacon, http://www.dacon.nl
*/
var ImgIdx = 0;
var counterTime = 5000;
var imageArray = Array();
var run = false;

function createImage(src, title, width, height){
	this.src 	= src;
	this.title 	= title;
	this.width	= width;
	this.height	= height;
}

function PreloadImg(){
	var img = new Image();
	for(nr=0; nr < imageArray.length; nr++){
		img.src = imageArray[nr].src;
	}
}

$(document).ready(function(){
	$('#actueel').append('<img src="http://www.dacon.nl/previews/jbouman/custom/projecten/template.jpg" id="Slideshow" /><div id="Slideshow_title"></div>');	
	PreloadImg();
	changeImage();
})

function changeImage(){	

	$("#Slideshow_title").slideUp((counterTime/10), (function(){
		$("#Slideshow_title").text(imageArray[ImgIdx].title);
		
		$("#Slideshow").ImageSwitch({
			Type: $(this).attr("rel"),
			NewImage: imageArray[ImgIdx].src,
			Direction: "DownTop",
			EffectOriginal: false
		});
		
		if(!jQuery.browser.msie)
			theWidth = Math.ceil(175+(imageArray[ImgIdx].width/2)-100);
		else
			theWidth = imageArray[ImgIdx].width-100;

		$("#watermark").hide();
		$("#watermark").css("margin","0px");
		$("#watermark").css("marginLeft",theWidth+"px");
		$("#watermark").css("marginTop",(imageArray[ImgIdx].height-30)+"px");
		$("#watermark").show();
		
		$("#Slideshow_title").slideDown((counterTime/10),(function(){
			ImgIdx++;
			if (ImgIdx >= imageArray.length) {		
				ImgIdx = 0;
			}	
		}));
	}) );			
	
	setTimeout("changeImage()",counterTime);
}

