// JavaScript Document

<!--- finestra popup immagini ingrandite centrata --->

function popupimage(theURL,winName,features) {
    finestra=window.open(theURL,winName,features);  
}

<!-- finestra popup generica con variabili-->
function popup_generica (url,wname,w,h,scroll,browserloc,menubar,resizable,status,directories,toolbar) {
	var winl = (screen.width - w) / 2 - 5;
	var wint = (screen.height - h) / 2 -80;
	finestra = window.open(url,wname,'top='+wint+',left='+winl+',width='+w+',height='+h+',buttons=1,scrollbars='+scroll+',location='+browserloc+',menubar='+menubar+',resizable='+resizable+',status='+status+',directories='+directories+',toolbar='+toolbar+',copyhistory=Yes');
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = '; expires='+date.toGMTString();
  }
  else expires = '';
  document.cookie = name+'='+value+expires+'; path=/';
}

function readCookie(name) {
  var nameEQ = name + '=';
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function setFontSize(size) {
	var body = document.getElementsByTagName('body')[0];
	var percentuale = "100%"; // default
	if (size == 1) percentuale = "70%";
	if (size == 2) percentuale = "80%";
	if (size == 3) percentuale = "90%";
	if (size == 4) percentuale = "100%";
	if (size == 5) percentuale = "110%";
	if (size == 6) percentuale = "120%";
	body.style.fontSize = percentuale;
	createCookie('TuoSitoFontSize',size,365);
}

function setBackground(color) {
	var body = document.getElementsByTagName('body')[0];
	var colorebg = "#ffffff"; // default
	if (color == 1) colorebg = "#ffffff";// standard
	if (color == 2) colorebg = "#cccccc";
	if (color == 3) colorebg = "#000000";
	if (color == 4) colorebg = "#000000";
	if (color == 5) colorebg = "#000000";
	if (color == 6) colorebg = "#000000";
	body.style.backgroundColor = colorebg;
	createCookie('TuoSitoBackground',color,365);
}

function setFontColor(colorTemp) {
	var body = document.getElementsByTagName('body')[0];
	var colorefnt = "#000000"; // default
	if (colorTemp == 1) colorefnt = "#000000";// standard
	if (colorTemp == 2) colorefnt = "#000000";
	if (colorTemp == 3) colorefnt = "#ffff00";
	if (colorTemp == 4) colorefnt = "#00ccff";
	if (colorTemp == 5) colorefnt = "#ffffff";
	if (colorTemp == 6) colorefnt = "#ff00ff";	
	body.style.color = colorefnt;
	createCookie('TuoSitofontColor',colorTemp,365);
}


//  begin script per nasconder/visualizzare div
switchBool=true
function doOnCLick(obj) {
      if (document.getElementById(obj).style.display=='block') {
            // fai .....
		document.getElementById(obj).style.display='none';

      } else {
            // fai .....		
	document.getElementById(obj).style.display='block';

      }
      switchBool = !switchBool;
}
//  end script per nasconder/visualizzare div


function addBookmark(title,url) {
  if (window.sidebar)
  {
    window.sidebar.addPanel(title, url,"");
  }
  else if( document.all )
  {
    window.external.AddFavorite( url, title);
  }
  else
  {
    return true;
  }
}


