/***********************************************
* Sliding Menu Bar Script- © Dynamic Drive (www.dynamicdrive.com)
* Visit http://www.dynamicdrive.com/ for full source code
* This notice must stay intact for use
***********************************************/
function getMail()
{
	a="luciano";
	b="\x40";
	c="lucianomorpurgo.com";
	return a+b+c;
}
function writeMail()
{
	document.write(getMail());
}
function mailUrl()
{
	location.assign("mailto:"+getMail());
}

function clickMenu()
{
	window.showMenu=true;
	return true;
}

function writeSessionCookie (cookieName, cookieValue) {
  if (testSessionCookie()) {
    document.cookie = escape(cookieName) + "=" + escape(cookieValue) + "; path=/";
    return true;
  }
  else return false;
}

function getCookieValue (cookieName) {
  var exp = new RegExp (escape(cookieName) + "=([^;]+)");
  if (exp.test (document.cookie + ";")) {
    exp.exec (document.cookie + ";");
    return unescape(RegExp.$1);
  }
  else return false;
}

function testSessionCookie () {
  document.cookie ="testSessionCookie=Enabled";
  if (getCookieValue ("testSessionCookie")=="Enabled")
    return true 
  else
    return false;
}

function ShowMenu() {
  if (testSessionCookie()) {
    writeSessionCookie ("bShowMenu", "true");
  }
  else
    alert ("Sorry - session cookies are currently disabled."); 
}

var slidemenu_width='120px' //specify width of menu (in pixels)
var slidemenu_reveal='20px' //specify amount that menu should protrude initially
var slidemenu_top=40   //specify vertical offset of menu on page

var ns4=document.layers?1:0
var ie4=document.all
var ns6=document.getElementById&&!document.all?1:0

if (ie4||ns6)
document.write('<div id="slidemenubar2" style="left:'+((parseInt(slidemenu_width)-parseInt(slidemenu_reveal))*-1)+'px; top:'+slidemenu_top+'; width:'+slidemenu_width + '; z-index:4;" onMouseover="pull()" onMouseout="draw()" class="menutransparent" >')
else if (ns4){
document.write('<style>\n#slidemenubar{\nwidth:'+slidemenu_width+';}\n<\/style>\n')
document.write('<layer id="slidemenubar" left=0 top='+slidemenu_top+'px width='+slidemenu_width+' onMouseover="pull()" onMouseout="draw()" visibility=hide>')
}

var sitems=new Array()

///////////Edit below/////////////////////////////////

//sitems[x]=[image, url, uniqueObjectName,image_onMouseOver]

sitems[0]=["img/home.gif", "index.html","home","img/home_roll.gif"]
sitems[1]=["img/curriculum.gif", "curriculum.html","curriculum","img/curriculum_roll.gif"]
sitems[2]=["img/foto.gif", "foto.html","foto","img/foto_roll.gif"]
sitems[3]=["img/music.gif", "audio/music.html","music","img/music_roll.gif"]
sitems[4]=["img/blog.gif", "http://scia-scia.blogspot.com/","blog","img/blog_roll.gif","_blank"]
sitems[5]=["img/mm2.gif", "javascript:apri_mm2()","mm2","img/mm2_roll.gif"]
sitems[6]=["img/mpeg2.gif", "mpeg2.html","mpeg2","img/mpeg2_roll.gif"]
sitems[7]=["img/diari.gif", "Villas92.html","diari","img/diari_roll.gif"]
sitems[8]=["img/links.gif", "link.html","links","img/links_roll.gif"]
sitems[9]=["img/mail.gif", "javascript:mailUrl()","mail","img/mail_roll.gif"]

//If you want the links to load in another frame/window, specify name of target (ie: target="_new")
var target=""
var drawing = false
/////////////////////////////////////////////////////////

if (ie4||ns4||ns6){
	for (i=0;i<sitems.length;i++){
		if (sitems[i][1])
		{
			document.write('<a href="'+menupath+sitems[i][1]+'" target="')
			if(sitems[i][4]) 
				document.write(sitems[i][4]+'" ')
			else
				document.write(target+'" ');
			
			if(sitems[i][2] && sitems[i][3])
				document.write(' onMouseover="' + sitems[i][2] + ".src='" + menupath+sitems[i][3]+ "'" + ';return true;" onMouseOut = "'+sitems[i][2]+".src='"+menupath+sitems[i][0]+"'"+';return true;" onClick = "ShowMenu();return true;"');
			document.write('>');
				
			document.write('<img src="'+menupath+sitems[i][0]+'" border="0" ');
			if(sitems[i][2])
				document.write('name="'+sitems[i][2]+'"');
			document.write('></a>');
		}	
		document.write('<br>\n')
	}
}

function regenerate(){
window.location.reload()
}

rightboundary=0
leftboundary=(parseInt(slidemenu_width)-parseInt(slidemenu_reveal))*-1

function regenerate2()
{
	if (ie4||ns6)
	{
		themenu=(ns6) ? document.getElementById("slidemenubar2").style : document.all.slidemenubar2.style
	}
	else if (ns4)
	{
		document.write('</layer>')
		themenu=document.layers.slidemenubar
	}
/*
	var c =getCookieValue ("bShowMenu");
	if(c)
	{
		if(c=="true")
		{
			alert(c);
			themenu.left=  0;
		}
		else
			themenu.left=  leftboundary;
	}
	else
		themenu.left=  leftboundary;
    writeSessionCookie("bShowMenu", "false");
 */
}
window.onload=regenerate2


if (ie4||ns6)
{
	document.write('</div>')
	themenu=(ns6)? document.getElementById("slidemenubar2").style : document.all.slidemenubar2.style
}
else if (ns4)
{
	document.write('</layer>')
	themenu=document.layers.slidemenubar
}

function pull()
{
	if (window.drawit)
		clearInterval(drawit)
	pullit=setInterval("pullengine()",10)
}
function draw()
{
//if( event.clientX>2)
{
	clearInterval(pullit)
	drawit=setInterval("drawengine()",10)
}
}
function pullengine()
{
	if ((ie4||ns6)&&parseInt(themenu.left)<rightboundary)
	{
		themenu.left=parseInt(themenu.left)+10+"px"
		drawing = true;
	}
	else if(ns4&&themenu.left<rightboundary)
	{
		drawing = true;
		themenu.left+=10
	}
	else if (window.pullit)
	{
		themenu.left=0
		drawing = false;
		clearInterval(pullit)
	}
}

function drawengine()
{
	if ((ie4||ns6)&&parseInt(themenu.left)>leftboundary)
	{
		themenu.left=parseInt(themenu.left)-10+"px"
		drawing = true;
	}
	else if(ns4&&themenu.left>leftboundary)
	{
		drawing = true;
		themenu.left-=10
	}
	else if (window.drawit)
	{
		themenu.left=leftboundary
		drawing = false;
		clearInterval(drawit)
	}
}

/*
Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="fromtop"

function JSFX_FloatTopDiv()
{
	var startX = 3,
	startY = 30;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.top=y;};
		//el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function()
	{
		if (verticalpos=="fromtop")
		{
			var pY = ns ? pageYOffset : document.body.scrollTop;
			ftlObj.y = pY+startY;//+= (pY + startY - ftlObj.y)/8;
		}
		else
		{
			var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
			ftlObj.y = pY-startY;//+= (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		//if(ns)
		//	setTimeout("stayTopLeft()", 10);
		window.onscroll =stayTopLeft;
	}
	ftlObj = ml("slidemenubar2");
	/*if(ns) 
		stayTopLeft();
	else*/
		window.onscroll =stayTopLeft;
}
JSFX_FloatTopDiv();

var c =getCookieValue ("bShowMenu");
if(c)
{
	if(c=="true")
	{
		themenu.left=  0;
	}
	else
		themenu.left=  leftboundary;
}
else
	themenu.left=  leftboundary;
writeSessionCookie("bShowMenu", "false");
    
function apri_mm2() {
  /*if(navigator.appName.indexOf('Explorer')>-1) pat="/ie/";
	else*/ pat= "/";
  x=window.open("mm2"+pat+"mm2.html","","scrollbars=no,status=yes,width=616,height=416");
  document.location="mm2.html";
}


