var grootActive = false;
var imageArray  = new Object();

if(type != "page")
{
	Event.observe(window, 'load', loadImages); 
}

imageArray['assisiRight'] = new Array( "550", "430", "assisiLaPila", "jpg");
imageArray['castelLeft'] = new Array( "250", "350", "castelMonte", "jpg");
imageArray['castelRight'] = new Array( "450", "100", "castelMonte", "jpg");
imageArray['campanaRight'] = new Array( "755", "360", "campana", "jpg");
imageArray['avalonRight'] = new Array( "660", "345", "avalon", "jpg");
imageArray['avalonLeft'] = new Array( "450", "250", "avalon", "png");
imageArray['challiceWellImage'] = new Array( "580", "100", "challiceWell", "jpg");


function showGroot(image)
{	
	if(!grootActive)
	{
		imageGroot = new Image();
		imageGroot.src = ("images/assets/groot/" + image + ".jpg");
		
 		$(image).style.zIndex=50;
		new Effect.Opacity(imageArray[image][2], { from: 1.0, to: 0.5, duration: 0.5 });
		if(image != 'challiceWellImage')
		{
			new Effect.Opacity("menu", { from: 1.0, to: 0.5, duration: 0.5 });
			new Effect.Opacity("titel", { from: 1.0, to: 0.5, duration: 0.5 });
		}
		new Effect.Scale($(image), 200, 
		{
			scaleContent:true,
			afterFinish:function()
			{
				document[image].src = "images/assets/groot/" + image + ".jpg";
			}
		});
		if(image!= 'challiceWellImage')
		{
			new Effect.Move($(image), { x: 260, y: 100, mode: 'absolute' });
		}else{
			new Effect.Move($(image), { x: 230, y: 7, mode: 'absolute' });
		}
		grootActive = true;
	}else{
		new Effect.Opacity(imageArray[image][2], { from: 0.5, to: 1, duration: 0.5 });
		if(image != 'challiceWellImage')
		{
			new Effect.Opacity("menu", { from: 0.5, to: 1, duration: 0.5 });
			new Effect.Opacity("titel", { from: 0.5, to: 1, duration: 0.5 });
		}
		new Effect.Move($(image), { x: imageArray[image][0], y: imageArray[image][1], mode: 'absolute' });
		new Effect.Scale($(image), 50, 
		{
			scaleContent:true,
			afterFinish:function()
			{
				grootActive = false;
				$(image).style.zIndex=3;
				document[image].src = "images/assets/" + image + "." + imageArray[image][3];
			}
		});
		
	}
}

function loadImages()
{	
	 var imagesLOADED = new Array;

     for (var picNum=0; picNum<fotoArray.length; picNum++) 
     {
         imagesLOADED[picNum] = new Image();
         imagesLOADED[picNum].src = (url + "images/sfeer/images/" + fotoArray[picNum]);
     }
}

function openWindow(URLtoOpen,windowName,height,width) 
{
	winLeft = (screen.width-width)/2;
	winTop = (screen.height-(height+110))/2; 
	myPopup = window.open(URLtoOpen,windowName,"width=" + width + "px,height=" + height + "px,left=" + winLeft + "px,top=" + winTop +"px");
	if (!myPopup.opener)
	{
 		myPopup.opener = self; 
 	}
}