//----------------------------------------------------------------------------
// To open TOC.
//----------------------------------------------------------------------------
function openIndex(url) {
	var f = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=580,height=560" ;
	window.open(url, 'lindipendente_toc', f) ;
	return false ;
}

//----------------------------------------------------------------------------
// To toggle divisions' visibility.
//----------------------------------------------------------------------------
function toggleById(id) {
	if (document.all) {
		if (document.all[id].style.display == 'none') {
			document.all[id].style.display = '' ;
		} else {
			document.all[id].style.display = 'none' ;
		}
		return false ;
	} else if (document.getElementById)	{
		if (document.getElementById(id).style.display == 'none') {
			document.getElementById(id).style.display = 'block' ;
		} else {
			document.getElementById(id).style.display = 'none' ;
		}
		return false ;
	}
}

function openById(id) {
	if (document.all) {
		document.all[id].style.display = '' ;
		return false ;
	} else if (document.getElementById)	{
		document.getElementById(id).style.display = 'block' ;
		return false ;
	}
}

function closeById(id) {
	if (document.all) {
		document.all[id].style.display = 'none' ;
		return false ;
	} else if (document.getElementById)	{
		document.getElementById(id).style.display = 'none' ;
		return false ;
	}
}

//----------------------------------------------------------------------------
// To translate to English
//----------------------------------------------------------------------------
function translate() {
	var engUrl = "http://translate.google.com/translate?hl=en&sl=it&u=" + location.href ;
	window.open(engUrl,'engpage','') ; 
	return false ;
}

//----------------------------------------------------------------------------
// For social bookmarking
//----------------------------------------------------------------------------
function socialBookmarking(postUrl,postTitle) {
	postTitle = postTitle.replace(/<\/?[^>]+(>|$)/g, "") ;
	var url = 'http://www.addthis.com/bookmark.php?wt=nw&pub=dejudicibus&url=' ;
	url += encodeURIComponent(postUrl) + '&title=' + encodeURIComponent(postTitle) ;
	var f = 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no' ;
	f += ',status=no,screenX=200,screenY=100,left=200,top=100' ;
	window.open(url, 'addthis', f) ; 
	return false;
}