function apri_immagine(nome,titolo,variabili,w, h) 
{
// alert('entro');
//var img = new Image(); 
//img.src = nome;

window.open (nome, titolo, variabili+ ',width=' + (w+20) +', height='+ (h+25) );

//window.showmodaldialog (nome,titolo,variabili);
return false;
}
// Set the horizontal and vertical position for the popup
PositionX = 100;
PositionY = 100;
// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth  = 700;
defaultHeight = 700;
// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = true;
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4)
{
var isNN=(navigator.appName.indexOf("Microsoft")!=-1)?0:1;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
//
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:10px;color:white}</style>');
writeln('<sc'+'ript>');
writeln('var isNN,isIE;');
writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName.indexOf("Microsoft")!=-1)?0:1;');
writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');
writeln('if (isIE){');
writeln('window.resizeTo(400,400);');
writeln('width=420-(document.body.clientWidth-document.images[0].width);');
writeln('height=420-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');
writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width+20;');
writeln('window.innerHeight=document.images["George"].height+20;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');
writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor="white" scroll="no" onload="reSizeToImage();doTitle();self.focus();">')
else 
writeln('</head><body bgcolor="white" scroll="no" onload="reSizeToImage();doTitle();self.focus();" onblur="self.close()">');
writeln('<img name="George"  src='+imageURL+' style="display:block"></body></html>');
close();		
}}

var rector=3
var stopit=0
var a=1

function init(which){
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}

function rattleimage(){
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1){
shake.style.top=parseInt(shake.style.top)+rector
}
else if (a==2){
shake.style.left=parseInt(shake.style.left)+rector
}
else if (a==3){
shake.style.top=parseInt(shake.style.top)-rector
}
else{
shake.style.left=parseInt(shake.style.left)-rector
}
if (a<4)
   a++
else
   a=1
setTimeout("rattleimage()",50)
}

function stoprattle(which){
stopit=1
which.style.left=0
which.style.top=0
}

var id,pause=0,position=0;

function banner(aaaa) 
{       
        var i,k, msg;
        msg=aaaa;
        k=(70/msg.length)+1;
        for(i=0;i<=k;i++) 
                msg+="                    "+msg;                  
        window.status=msg.substring(position,position+120);     
        if(position++==msg.length) 
                position=0;             
       
        id=setTimeout("banner('"+aaaa+"')",200); 
}

function messaggio(p_mess) 
{       
        window.status=p_mess;
      
}

function fogliostile(p_pag)
  {
   var ScrnSize;
   ScrnSize = screen.width ;
      if(ScrnSize=="640" && p_pag=="D") 
         {  document.write('<link rel = stylesheet href="testi800.css" type="text/css">'); }
      else if(ScrnSize=="800" && p_pag=="D")      
        { document.write('<link rel = stylesheet href="testi800.css" type="text/css">'); }
      else if (p_pag=="D") 
         { document.write('<link rel = stylesheet href="testi.css" type="text/css">');}
      else if(ScrnSize=="640" && p_pag=="S") 
         {  document.write('<link rel = stylesheet href="style800.css" type="text/css">'); }
      else if(ScrnSize=="800" && p_pag=="S")      
        { document.write('<link rel = stylesheet href="style800.css" type="text/css">'); }
      else if (p_pag=="S") 
         { document.write('<link rel = stylesheet href="style.css" type="text/css">');}
  }

function countdown(){
	iniData= new Date(2009,8,18,00,00,00); // data inizio sequenza mesi-1 es. set=8
	oggi= new Date();
	//oggi.setHours(1,1,1,0) ;
	iniDataST=iniData.getDate()+'/'+(iniData.getMonth()+1)+'/'+iniData.getFullYear();
	iniDataIt=iniData.getDate()+'-'+(iniData.getMonth()+1)+'-'+iniData.getFullYear()+' '+iniData.getHours()+':'+iniData.getMinutes()+':'+iniData.getSeconds();
	milDif=(iniData-oggi)
	giorni=parseInt(milDif/86400000);  
	milDif=milDif-(giorni*86400000); //millisecondi restanti talti i giorni
	ore=parseInt(milDif/3600000);
	milDif=milDif-(ore*3600000); //millisecondi restanti talti i giorni
	minuti=parseInt(milDif/60000);
	milDif=milDif-(minuti*60000); //millisecondi restanti talti i giorni
	secondi=parseInt(milDif/1000);
	milDif=milDif-(secondi*1000); //millisecondi restanti talti i giorni
	testo='Il countdown è cominciato!!!<BR>Al giorno: '+iniDataST+' mancano '+giorni+' giorni, '+ore+' ore, '+minuti+' minuti e '+secondi+' secondi';
	//alert(testo); //commentare
	//return testo
	if (secondi<0) 
	    document.getElementById("timerdiv").innerHTML='<blink>Il nuovo cd è in vendita!</blink>';
        else
	     document.getElementById("timerdiv").innerHTML=testo;
	    
     setTimeout("countdown()",1000)
}

function countdown23(){
	iniData= new Date(2009,02,05,09,00,00); // data inizio sequenza mesi-1 es. set=8
	oggi= new Date();
	//oggi.setHours(1,1,1,0) ;
	iniDataST=iniData.getDate()+'/'+(iniData.getMonth()+1)+'/'+iniData.getFullYear();
	iniDataIt=iniData.getDate()+'/'+(iniData.getMonth()+1)+'/'+iniData.getFullYear()+' '+'alle 09:00:00';
	milDif=(iniData-oggi)
	giorni=parseInt(milDif/86400000);  
	milDif=milDif-(giorni*86400000); //millisecondi restanti talti i giorni
	ore=parseInt(milDif/3600000);
	milDif=milDif-(ore*3600000); //millisecondi restanti talti i giorni
	minuti=parseInt(milDif/60000);
	milDif=milDif-(minuti*60000); //millisecondi restanti talti i giorni
	secondi=parseInt(milDif/1000);
	milDif=milDif-(secondi*1000); //millisecondi restanti talti i giorni
	testo='<font size =-1><B>Il countdown è cominciato!!<BR><BR>"Non solo io, la mia storia"<BR><b><font color =black>il nuovo libro</font> di Umberto Tozzi<BR>sarà nei negozi dal '+iniDataIt+'<BR><BR>Mancano '+giorni+' giorni, '+ore+' ore, '+minuti+' minuti e '+secondi+' secondi</B></font>';
	//alert(testo); //commentare
	//return testo
	if (secondi<0) 
	    document.getElementById("timerdiv").innerHTML='<blink>"Non solo io, la mia storia",<BR>Il nuovo Libro è in vendita!</blink>';
        else
	     document.getElementById("timerdiv").innerHTML=testo;
	    
     setTimeout("countdown23()",1000)
}


var toggleMenu = {
	init : function(sContainerClass, sHiddenClass) {
		if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
		var arrMenus = this.getElementsByClassName(document, 'ul', sContainerClass);
		var arrSubMenus, oSubMenu, oLink;
		for (var i = 0; i < arrMenus.length; i++) {
			arrSubMenus = arrMenus[i].getElementsByTagName('ul');
			for (var j = 0; j < arrSubMenus.length; j++) {
				oSubMenu = arrSubMenus[j];
				oLink = oSubMenu.parentNode.getElementsByTagName('a')[0];
				oLink.onclick = function(){toggleMenu.toggle(this.parentNode.getElementsByTagName('ul')[0], sHiddenClass); return false;}
				this.toggle(oSubMenu, sHiddenClass);
			}
		}
	},
	toggle : function(el, sHiddenClass) {
		var oRegExp = new RegExp("(^|\\s)" + sHiddenClass + "(\\s|$)");
		el.className = (oRegExp.test(el.className)) ? el.className.replace(oRegExp, '') : el.className + ' ' + sHiddenClass; // Add or remove the class name that hides the element
	},
/* addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html */
	addEvent : function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn](window.event);}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	},
/*
Written by Jonathan Snook, http://www.snook.ca/jonathan
Add-ons by Robert Nyman, http://www.robertnyman.com
*/
	getElementsByClassName : function(oElm, strTagName, strClassName){
	    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
	    var arrReturnElements = new Array();
	    strClassName = strClassName.replace(/\-/g, "\\-");
	    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	    var oElement;
	    for(var i=0; i<arrElements.length; i++){
	        oElement = arrElements[i];      
	        if(oRegExp.test(oElement.className)){
	            arrReturnElements.push(oElement);
	        }   
	    }
	    return (arrReturnElements)
	}
};
toggleMenu.addEvent(window, 'load', function(){toggleMenu.init('menu','hidden');});


function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}
function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.60
else if (which2.filters)
which2.filters.alpha.opacity=60
}

function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}
