function WriteSwf(img,wsize,hsize)
{
	document.write("<object id=mainmenu classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cabversion=6,0,29,0\" width=\""+wsize+"\" height=\""+hsize+"\">");
	document.write("<param name=\"movie\" value=\""+img+"\">");
	document.write("<param name=\"quality\" value=\"high\">");
	document.write("<param name=\"wmode\" value=\"transparent\">");
	document.write("<param name=\"menu\" value=\"false\">");	
	document.write("<embed src=\""+img+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+wsize+"\" height=\""+hsize+"\" menu=\"false\" wmode=\"transparent\"></embed>");
	document.write("</object>");
}

function mostra(layerName) { 
	document.getElementById(layerName).style.display = 'block';
} 
	
function nascondi(layerName) { 
	document.getElementById(layerName).style.display = 'none';
} 
	
function tabSelezionato(layerName, oldLayerName) {
	//alert(layerName + oldLayerName);
	document.getElementById(layerName).style.background = '#fff';
	document.getElementById(oldLayerName).style.background = '#ddd';		
	document.getElementById(oldLayerName).style.background = 'url(../images/bgTab.gif) repeat-x bottom left;';	
	document.getElementById(oldLayerName).style.color = '#cc0000';		
}

var min=1;
var max=2;
function increaseFontSize() {
   var p = document.getElementsByTagName('body');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("em",""));
      } else {
         var s = 1;
      }
      if(s<max) {
         s += 0.1;
      }
      p[i].style.fontSize = s+"em"
   alert("the font size is" + p[i].style.fontSize);    
    createCookie("ActiveFontSize",activetSize,1000);     
   }
}
function decreaseFontSize() {
   var p = document.getElementsByTagName('body');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("em",""));
      } else {
         var s = 1;
      }
      if(s!=min) {
         s -= 0.1;
      }
      p[i].style.fontSize = s+"em"
   }   
}

function createCookie(cookie_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 = cookie_name+"="+value+expires+"; path=/";
}

function setActiveTextSize(activetSize){
   var p = document.getElementsByTagName('body');  
   for(i=0;i<p.length;i++) {   	
      p[i].style.fontSize = activetSize+"em"
    }
    // write/rewrite cookie 
    document.getElementById('a'+activetSize).className='selezionato';    
    createCookie("ActiveFontSize",activetSize,1000);
}
function createCookie(cookie_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 = cookie_name+"="+value+expires+"; path=/";
}
function readCookie(cooke_name) {
    regexpr = cooke_name+ '=(.*?)(;|$)';
    var results = document.cookie.match (regexpr);
    if ( results ) {
        return ( unescape ( results[1] ) );
    }
    else { return null; }
    }
 
function applystyle(){
    var Currentfontsize = 0.8+"em";
    if (readCookie('ActiveFontSize')) {
      var Currentfontsize = readCookie('ActiveFontSize');     
      setActiveTextSize(Currentfontsize);
    } else {
      setActiveTextSize(Currentfontsize);
    }
}

