///////////////////////////////////////////////////////////////////////////////////////////
// SIMIT 2010
// JavaScript library utility
// (c) Novembre 2009 - Effetti srl
// by Gianluca De Grandis
///////////////////////////////////////////////////////////////////////////////////////////

// Funzione per cambiare lo sfondo del td di menù
function chBg(td,setting){
	if (setting == 1) document.getElementById(td).style.backgroundImage = "url('/images/filettoMenu.jpg')";
	else document.getElementById(td).style.background = "";
}

// cambia il colore di sfondo dell'oggetto objName con bgColor
function chBGcolor(objName,bgColor){
	document.getElementById(objName).bgColor = bgColor;	
}

// Cambia l'immagine imgId con imgSrc
function changeImg(imgId,imgSrc){
	document.getElementById(imgId).src = imgSrc;
}

// precarica le immagini presenti nel percorso passato come parametro (parametri multipli separati da,)
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}








///////////////////////////////////////////////////////////////////////////////////////////////
// Cambia il colore dello sfondo di un td
function changeBgcolor(obj_id,color){
	// bt_day_01
	btn_id = obj_id.substring(8,9);
	if ((document.getElementById(obj_id)) && (btn_id != global_day)) {		
		document.getElementById(obj_id).bgColor = color;
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////
function fillIframe(day){
	var iFrameId = document.getElementById("dayIframe");
	switch (day){
		case 1:
			iFrameId.src = "day01.html";
			global_day = day;
			resetBtnColor();
			break;
		case 2:
			iFrameId.src = "day02.html";
			global_day = day;
			resetBtnColor();			
			break;
		case 3:
			iFrameId.src = "day03.html";
			global_day = day;
			resetBtnColor();			
			break;			
		case 4:
			iFrameId.src = "day04.html";
			global_day = day;
			resetBtnColor();			
			break;			
		default:
			iFrameId.src = "day01.html";
			global_day = 1;
			resetBtnColor();			
			break;			
	}
}

function resetBtnColor(){
	if (global_day != 1) document.getElementById("bt_day_01").bgColor = "#0d5d9c";
	if (global_day != 2) document.getElementById("bt_day_02").bgColor = "#0d5d9c";
	if (global_day != 3) document.getElementById("bt_day_03").bgColor = "#0d5d9c";
	if (global_day != 4) document.getElementById("bt_day_04").bgColor = "#0d5d9c";	
}

function showDiv(){
	alert("inside");
	document.getElementById("navigationInfo").style.display = "";
	document.getElementById("navigationInfo").style.visibility = "visible";
	document.getElementById("navigationInfo").style.position = "absolute";
	document.getElementById("navigationInfo").style.width = "270px";
	document.getElementById("navigationInfo").style.height ="320px";
	document.getElementById("navigationInfo").style.zIndex = "1";
}

function hideDiv(){
	document.getElementById("navigationInfo").style.display = "none";
	document.getElementById("navigationInfo").style.visibility = "hidden";
}

///////////////////////////////////////////////////////////////////////////////////////////////
// Visualizza o basconde il box di login nella home page
function showLoginBox(){
	var td = document.getElementById("loginBox");
	if (td.style.visibility == "hidden") {
		td.style.visibility = "visible";
		td.style.display = "";
		document.getElementById("loginForm").userName.focus();
	}
	else {
		td.style.visibility = "hidden";
		td.style.display = "none";
	}	
}
///////////////////////////////////////////////////////////////////////////////////////////////

function openSession(parameters){
	var pageToOpen = "http://www.makevent.it/ScientificProgrammeScheme/Session.jsp" + parameters;
	var openWindows = window.open(pageToOpen,'session','width=700, height=620, top=0,left=0,scrollbars=1');
}

function openCourse(course){
	var openWindows = window.open(course,'session','width=700, height=620, top=0,left=0,scrollbars=1');
}
