


function Hook_Image_Slideshow(imgarray, divid, fadeIn, fadeOut, delay, width, height)
{
	// Require
	dojo.require("dojo._base.fx");
	fadeIn = parseInt(fadeIn);
	fadeOut = parseInt(fadeOut);
	delay = parseInt(delay);
	
	// The div
	var divNode = dojo.byId(divid);
	divNode.innerHTML = "";
	
	// The img
	var imgNode = document.createElement("img");
	var imgId = "hook_slideshow_img";
	imgNode.id = imgId;
	imgNode.style.opacity = "0";
	imgNode.src = imgarray[0];
	
	// Width and height
	if(height > 0)
		imgNode.height = height;
	if(width > 0)
		imgNode.width = width;
	
	divNode.appendChild(imgNode);
	
	// Fadeing
	var In = dojo.fadeIn({node: imgId, duration:fadeIn });
	dojo.connect(In,"onEnd",function(){ 
		setTimeout(function(){ Hook_Image_Slideshow_Create(imgarray, imgId, 0, fadeIn, fadeOut, delay) }, delay);
	});
	In.play();
}

function Hook_Image_Slideshow_Create(imgarray, imgId, next, fadeIn, fadeOut, delay)
{
	// Fadeing out
	var Out = dojo.fadeOut({node: imgId, duration:fadeOut });
	dojo.connect(Out,"onEnd",function(){
		
		// Finding the next
		var amount = imgarray.length;
		next++;
		next = (next >= amount) ? 0 : next;
		
		// Changing the image
		dojo.byId(imgId).src = imgarray[next];
		
		// Fading In again
		var In = dojo.fadeIn({node: imgId, duration:fadeIn });
		dojo.connect(In,"onEnd",function(){ 
			setTimeout(function(){ Hook_Image_Slideshow_Create(imgarray, imgId, next, fadeIn, fadeOut, delay) }, delay);
		});
		In.play();
	});
	Out.play();
}

function Hook_Calendar(id, month, year, test)
{
	ajaxresponse("/api/ajax?type=calendar&month=" + month + "&year=" + year, id, true);
	return false;
}

















