//links that will be attached to the slideshow images
links_arr = new Array(
"",
"http://www.tampere.fi/english_under_construction.html",
"http://www.nokia.com/",
"http://www.microsoft.com/en/us/default.aspx?pf=true",
"http://www.tekes.fi/en/community/Home/351/Home/473",
"http://www.finnvera.fi/eng",
"http://www.finnode.com/",
"http://www.diges.info/?id=0.2",
"http://www.technopolis.fi/index.php?id=21&lang_id=1",
"http://www.lexia.fi/",
"http://www.digibusiness.fi/portal/eu",
"http://www.hermia.fi/in_english/",
"http://www.zeelandsociety.fi/",
"http://www.oske.net/ubi/ubiquitous_computing/",
"http://www.oske.net/en/",
"http://restate.fi/english/restate-eng/",
"http://www.acm.org/",
"http://www.wsis-award.org/index.wbp",
"http://www.itive.net/",
"http://www.luovatampere.fi/eng/",
"http://www.tut.fi/public/index.cfm?siteid=32",
"http://www.uta.fi/english/",
"http://www.tamk.fi/en/",
"http://www.demola.fi/",
"http://www.coss.fi/en",
"http://www.sombiz.net/",
"http://www.hermia.fi/neogames/neogames_in_english/",
"http://www.osketampere.fi/www_digitampere_fi/"
);

//default value for the timeout variable
//this sets whether timeout is taking time for
//fadein or fadeout -function
//and is used in case we have to stop the timeout
//status-value is neutral
to_status = "status";

$(document).ready(function(){

	fadeIn(1);

});

function fadeIn(id){

	//remove the active-class (gray background) from all the image-navigation links
	//and add it to the link that actually is active
	$(".logo_carousel_active").removeClass("logo_carousel_active");	
	$("#control_link_"+id).addClass("logo_carousel_active");
	
	//start the actual fadein-function and after it's finished
	//set a timeout for a fadeout-function
	//change the status variable accordingly	
	$("#slideshow_image_"+id).fadeIn(600, function () {        	
		fi_to = setTimeout(function(){fadeOut(id)},1500);
		to_status = "fi";

      	});		

}

function fadeOut(id){

	//start the fadeout-function and after it's finished	
	//set a timeout for a fadein-function
	//change the status variable accordingly	
	$("#slideshow_image_"+id).fadeOut(600, function () {
		id++;
		if ( $("#slideshow_image_"+id).length == 0 )
			id = 1;        	
		fo_to = setTimeout(function(){fadeIn(id)},300);
		to_status = "fo";
      	});		

}

function scaleBanner(){

	if($("#slideshow_images").height() == 150)
		var h = 500;
	else
		var h = 150;	

	$("#slideshow_images").animate({ 
		height: h
	}, 1500);

}
