/*Funzioni di gestione del sito www.diegosegre.it
 * Autore: Emanuele Leomanni
 * sito: http://emanuele183.googlepages.com/
 * email: emanuele.leomanni@gmail.com
 */

var delay = 13000;
var delay_short = 7000;

var mySlideList = ['images/photo/bisalta_L.jpg', 'images/photo/bisalta1_L.jpg', 'images/photo/bisalta2_L.jpg', 'images/photo/bisalta3_L.jpg', 'images/photo/bisalta4_L.jpg', 'images/photo/bisalta6_L.jpg'];

var mySlideListPatologie = ['../images/photo/bisalta_L.jpg', '../images/photo/bisalta1_L.jpg', '../images/photo/bisalta2_L.jpg', '../images/photo/bisalta3_L.jpg', '../images/photo/bisalta4_L.jpg', '../images/photo/bisalta6_L.jpg'];

var mySlideListFoto = ['images/photo/foto_L.jpg', 'images/photo/foto_sala_L.jpg', 'images/photo/foto_montagna_L.jpg', 'images/photo/foto_sci_L.jpg'];

function SlideShow(slideList, speed, name, current_start)          
{
  this.slideList = slideList;
  this.speed = speed;
  this.name = name;
  this.current = current_start;
  this.timer = 0;
}
SlideShow.prototype.play = SlideShow_play;  
function SlideShow_play()       
{
  with(this)
  {
    if(current++ == slideList.length-1) current = 0;
    switchImage(name,slideList[current],current);
    clearTimeout(timer);
    timer = setTimeout(name+'.play()', speed);
  }
}

function switchImage(name,imgSrc,current) 
{
	if(name!="mySlideShowPatologie" && name!="mySlideShowFoto"){
		if(current==0){
			document.getElementById('header').style.background='url(images/photo/bisalta_L.jpg) no-repeat';
		}else if(current==1){
			document.getElementById('header').style.background='url(images/photo/bisalta1_L.jpg) no-repeat';
		}else if(current==2){
			document.getElementById('header').style.background='url(images/photo/bisalta2_L.jpg) no-repeat';
		}else if(current==3){
			document.getElementById('header').style.background='url(images/photo/bisalta3_L.jpg) no-repeat';
		}else if(current==4){
			document.getElementById('header').style.background='url(images/photo/bisalta4_L.jpg) no-repeat';
		}else if(current==5){
			document.getElementById('header').style.background='url(images/photo/bisalta6_L.jpg) no-repeat';
		}
		else{
			document.getElementById('header').style.background='url(images/photo/bisalta_L.jpg) no-repeat';
		}
	}else if(name=="mySlideShowFoto"){
		if(current==0){
			document.getElementById('foto_DS').src='images/photo/foto_sala_L.jpg';
		}else if(current==1){
			document.getElementById('foto_DS').src='images/photo/foto_sci_L.jpg';
		}else if(current==2){
			document.getElementById('foto_DS').src='images/photo/foto_montagna_L.jpg';
		}else{
			document.getElementById('foto_DS').src='images/photo/foto_L.jpg';
		}
	} else{
		if(current==0){
			document.getElementById('header').style.background='url(../images/photo/bisalta_L.jpg) no-repeat';
		}else if(current==1){
			document.getElementById('header').style.background='url(../images/photo/bisalta1_L.jpg) no-repeat';
		}else if(current==2){
			document.getElementById('header').style.background='url(../images/photo/bisalta2_L.jpg) no-repeat';
		}else if(current==3){
			document.getElementById('header').style.background='url(../images/photo/bisalta3_L.jpg) no-repeat';
		}else if(current==4){
			document.getElementById('header').style.background='url(../images/photo/bisalta4_L.jpg) no-repeat';
		}else if(current==5){
			document.getElementById('header').style.background='url(../images/photo/bisalta6_L.jpg) no-repeat';
		}
		else{
			document.getElementById('header').style.background='url(../images/photo/bisalta_L.jpg) no-repeat';
		}
	}
}

function ChangePhoto(photoName){
	var photo = document.getElementById('foto_congressi');
	switch (photoName){
		case"presidente":
			photo.src='images/photo/congressi/presidente_L.png';
		break;
		case"relatore":
			photo.src='images/photo/congressi/relatore_L.png';
		break;
		default:
			photo.src='images/photo/congressi_L.jpg';
		break;
	}
	return false;
}

/*Google*/
 function map_initialize() {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
		map.setMapType(G_HYBRID_MAP);
        map.setCenter(new GLatLng(44.39131029897125, 7.549543976783752), 15);
		var point = new GLatLng(44.39131029897125, 7.549543976783752);
		map.addOverlay(new GMarker(point));
        map.setUIToDefault();
    }
	/*$('map_canvas').appear();*/
	$('map_canvas').style.borderStyle = "solid";
	$('map_canvas').style.borderWidth = "3px";
	$('map_canvas').style.borderColor = "#999999";
}

function map2_initialize() {
    if (GBrowserIsCompatible()) {
		var map2 = new GMap2(document.getElementById("map_canvas2"));
        map2.setMapType(G_HYBRID_MAP);
		map2.setCenter(new GLatLng(44.696069, 7.858036), 15);
		var point2 = new GLatLng(44.696069, 7.858036);
		map2.addOverlay(new GMarker(point2));
        map2.setUIToDefault();
    }
	/*$('map_canvas2').appear();*/
	$('map_canvas2').style.borderStyle = "solid";
	$('map_canvas2').style.borderWidth = "3px";
	$('map_canvas2').style.borderColor = "#999999";
}


