function slide_home(){
	$('.ppt li:gt(0)').hide();
	$('.ppt li:last').addClass('last');
	var cur = $('.ppt li:first');

	function animate() {
		cur.fadeOut( 1000 );
		if ( cur.attr('class') == 'last' )
			cur = $('.ppt li:first');
		else
			cur = cur.next();
		cur.fadeIn( 1000 );
	}


	$(function() {
		setInterval( animate, 5000 );
	} );
}

function slide_sezioni(){
	var sezione1 = ["chirurgia01.jpg", "chirurgia02.jpg", "chirurgia03.jpg"];
	var sezione2 = ["ostetrica01.jpg", "ostetrica02.jpg", "ostetrica03.jpg"];
	var sezione3 = ["diagnostica01.jpg", "diagnostica02.jpg", "diagnostica03.jpg"];
	
	for(var i=1; i<sezione1.length; i++){	//il primo dell'array non interessa inserirlo perche' gia' presente
		$("<img src='images/"+sezione1[i]+"' alt='' />").appendTo($(".sezione_first .image"));
	}
	
	for(var i=1; i<sezione2.length; i++){	//il primo dell'array non interessa inserirlo perche' gia' presente
		$("<img src='images/"+sezione2[i]+"' alt='' />").appendTo($(".sezione_second .image"));
	}
	
	for(var i=1; i<sezione3.length; i++){	//il primo dell'array non interessa inserirlo perche' gia' presente
		$("<img src='images/"+sezione3[i]+"' alt='' />").appendTo($(".sezione_third .image"));
	}
	
	anima_sezione1();
	setTimeout(anima_sezione2 ,1000);
	setTimeout(anima_sezione3 ,2000);
	
	function anima_sezione1(){
		$('.sezione_first .image img:gt(0)').hide();
		$('.sezione_first .image img:last').addClass('last');
		var cur = $('.sezione_first .image img:first');

		function animate_sezioni() {
			cur.fadeOut( 1000 );
			if ( cur.attr('class') == 'last' )
				cur = $('.sezione_first .image img:first');
			else
				cur = cur.next();
			cur.fadeIn( 1000 );
		}

		$(function() {
			setInterval( animate_sezioni, 8000 );
		} );
	}
	
	function anima_sezione2(){
		$('.sezione_second .image img:gt(0)').hide();
		$('.sezione_second .image img:last').addClass('last');
		var cur = $('.sezione_second .image img:first');

		function animate_sezioni() {
			cur.fadeOut( 1000 );
			if ( cur.attr('class') == 'last' )
				cur = $('.sezione_second .image img:first');
			else
				cur = cur.next();
			cur.fadeIn( 1000 );
		}

		$(function() {
			setInterval( animate_sezioni, 8000 );
		} );
	}
	
	function anima_sezione3(){
		$('.sezione_third .image img:gt(0)').hide();
		$('.sezione_third .image img:last').addClass('last');
		var cur = $('.sezione_third .image img:first');

		function animate_sezioni() {
			cur.fadeOut( 1000 );
			if ( cur.attr('class') == 'last' )
				cur = $('.sezione_third .image img:first');
			else
				cur = cur.next();
			cur.fadeIn( 1000 );
		}

		$(function() {
			setInterval( animate_sezioni, 8000 );
		} );
	}
	
}

function initSpecialLinks() {
	var i, lk, c;
	if (document.getElementsByTagName) {
		lk = document.getElementsByTagName('a');
		if (lk) {
			c = lk.length;
			for (i=0; i < c; i++) {
				if (lk[i].rel.indexOf('external') != -1) {
					lk[i].target = '_blank';
				}
			}
		}
	}
}

