var imgg=new Array();
	
		imgg[0]=new Image();
		imgg[0].src="http://www.cafe-badilatti.ch/fileadmin/templates/img/home/bacche.jpg";
		imgg[1]=new Image();
		imgg[1].src="http://www.cafe-badilatti.ch/fileadmin/templates/img/home/test.jpg";
		imgg[2]=new Image();
		imgg[2].src="http://www.cafe-badilatti.ch/fileadmin/templates/img/home/germogli.jpg";
		imgg[3]=new Image();
		imgg[3].src="http://www.cafe-badilatti.ch/fileadmin/templates/img/home/macinino.jpg";
		imgg[4]=new Image();
		imgg[4].src="http://www.cafe-badilatti.ch/fileadmin/templates/img/home/ragazza.jpg";
		
var cntr = 0;

function changeOpac(opacity, id) {

    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}


function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;
    var i = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
    //var txt1 = window.startTimer("setImg();", 500);
    setImg();
	}


function setImg() {

	var hs1i = document.getElementById('is1');
	hs1i.src = imgg[cntr].src;
	
	var shs1i = hs1i.style
	shs1i.opacity = 1;
    shs1i.MozOpacity = 1;
    shs1i.KhtmlOpacity = 1;
    shs1i.filter = "alpha(opacity=100)";
    
    var tyt = window.setTimeout("opacity('is1', 100, 0, 500);", 7000);
    
    setImgBg();
}

function setImgBg() {

	var imggl = imgg.length;
	cntr++;
	if (cntr==imggl) cntr = 0; 
	//alert(imgg[cntr].src);
	
	var hs1 = document.getElementById('hs1').style;
	
	hs1.backgroundImage = 'url('+imgg[cntr].src+')';
	hs1.backgroundRepeat = 'no-repeat';
	hs1.backgroundPosition = 'top center';
	
}

function startFade () {
	//alert('startFade()');
	setImg();
}


var startMenu = function() {
if (document.all&&document.getElementById) 
{
	cssmenu = document.getElementById("csstopmenu");
	for (i=0; i<cssmenu.childNodes.length; i++) 
	{
		node = cssmenu.childNodes[i];
		if (node.nodeName=="LI") 
		{
			node.onmouseover=function() 
			{
				this.className+=" over";
			}
			node.onmouseout=function()
			{                  
				this.className=this.className.replace(" over", "")
			}
		}
	}
}
}


function hvr0 (a) {
	$(a).getElement('a').setStyle('background-position', '0px -56px');
}

function dvt0 (a) {
	$(a).getElement('a').setStyle('background-position', '0px 0px');
}

function hvr(a) {
	$(a).getParent('li').getElement('a').setStyle('background-position', '0px -56px');
}

function dvt(a) {
	$(a).getParent('li').getElement('a').setStyle('background-position', '0px 0px');
}




/*function menutopselezione(target,dove) {
	//target.style.background="url(../img/sfondomenutop_03.gif);";
	
	if (dove=='in')
	{
		$$(target).setStyle('background-image', 'url("fileadmin/templates/img/sfondomenutopb.gif")');
	}
	else
	{
		$$(target).setStyle('background-image', 'url("fileadmin/templates/img/sfondomenutopr.gif")');
	}
	//$$(target).setStyle('border', '1px solid #000000 !important');
	//alert("kl"+target);
	/*if(target.parentNode) 
	{
		var p = target.parentNode;
		if(p.parentNode) 
		{
			var p = p.parentNode;
			
			p.style.borderStyle="2px solid #000";
			
			alert("kl"+p);
			//var formId = p.id;
			//currentForm = document.getElementById(formId);
			
		}
	}
target.style.paddingLeft="20px";
//	parent=lipadre.parentNode;
//	parent.style.borderStyle="dotted double";
//	$$('#dropdownMenu div.pre').setStyle('visibility', 'hidden'); onmouseout="
	*/
//}


if (window.attachEvent)
window.attachEvent("onload", startMenu)
else
window.onload=startMenu;


/*window.addEvent("domready", startFade());

window.addEvent("domready", startMenu());*/


