/*
*  common.js
* ----------------------------------------------------------------------------
*  Copyright © 1995-2003 Intesys S.r.l. Verona (I). All rights reserved.
* ----------------------------------------------------------------------------
*  Data e versione:
*	21/08/2003 - 1.00
* ----------------------------------------------------------------------------
*  Descrizione:
*	Elenco funzioni comune :
*	- profilo(tipo)
* ----------------------------------------------------------------------------
*/


/*
 * Assegna in un cookie il profilo	
*/
function profilo(tipo){
		setOn(document.images[tipo]);
		//setOn(genitore);
		page = document.location;
		valCookie = "PROFILO="+tipo+";";
		document.cookie=valCookie;
		valCookie = "PAGE="+page+";";
		document.cookie=valCookie;
}

function initProfilo(){
	valCookie = document.cookie;
	if (valCookie.indexOf("PROFILO")>-1){
		indiceProfilo=valCookie.indexOf('PROFILO=');
		indice=valCookie.indexOf(';',indiceProfilo);
		if (indice<0) indice=valCookie.length;
		tipo = valCookie.substring(indiceProfilo+8,indice);
		profilo(tipo);
	}
	else {
		tipo = "docente";
	}
	document.images['imgIcona'].src = "widgets/icona_"+tipo+".gif";
}

function initProfilo2(){
	valCookie = document.cookie;
	if (valCookie.indexOf("PROFILO")>-1){
		indiceProfilo=valCookie.indexOf('PROFILO=');
		indice=valCookie.indexOf(';',indiceProfilo);
		if (indice<0) indice=valCookie.length;
		tipo = valCookie.substring(indiceProfilo+8,indice);
		profilo(tipo);
	}
}

function pageLeggenda(){
	valCookie = document.cookie;
	/*
	if (valCookie.indexOf("PAGE")>-1){
		indiceProfilo=valCookie.indexOf('PAGE=');
		indice=valCookie.indexOf(';',indiceProfilo);
		if (indice<0) indice=valCookie.length;
		tipo = valCookie.substring(indiceProfilo+5,indice);
		document.location = tipo;
	}
	*/
	document.location = "percorsi.php";
	
}