﻿// JScript File
var images=new Array();
	
var imagenames=new Array('Fabbrutto_Band.jpg','Max_Band.jpg','Marco_Band.jpg','Kevin_Band.jpg','Mao_Band.jpg','Band.jpg');

function NewWindow(mypage,myname,w,h,scroll,full,res)
{ 
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; 
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0; 
	if (full)
		settings ='status=yes,resizable=yes,fullscreen=yes,top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
	else
	{
		if (res)	settings ='resizable=yes,height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',status=no';
		else		settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',status=no';
	}
	win = window.open(mypage,myname,settings) 
	//win.window.focus();
}

function Crealink(tipo)
{
	var y=prompt("Inserisci il link", "");
	
	var testo = document.getElementById("ctl00_ContentPlaceHolder1_txtDescrizioneEdit").value;
	
	if(tipo == "Link")
		testo = testo + "<a href=\"" + y + "\">" + y + "</a>";
	else
		testo = testo + "<a href=\"mailto:\"" + y + ">" + y + "</a>";
	 
	document.getElementById("ctl00_ContentPlaceHolder1_txtDescrizioneEdit").value = testo;
	
}

function PreLoadImmagini(event)
{
	for(n=0;n<imagenames.length;n++)
	{
		images[n]=new Image();
		images[n].src='Immagini/Band/' + imagenames[n];
	}
}

function CambiaImmagine(e)
{
	//Se mi sposto troppo velocemente dal menu all'immagine della band, javascript non fa in tempo a caricare le immagini e quindi 
	//la variabile images non è ancora valorizzata. Perciò eseguo un return
	if(images.length == 0)
		return;

	var tempX, tempY;
	if (typeof e.offsetX != 'undefined') //IE
		tempX = e.offsetX;
	else if (typeof e.pageX != 'undefined') //NS Firefox
		tempX = e.pageX - e.target.offsetLeft;
		
	if (typeof e.offsetY != 'undefined') //IE
		tempY = e.offsetY;
	else if (typeof e.pageX != 'undefined') //NS Firefox
		tempY = e.pageY - e.target.offsetTop;

	if(tempY < 180)
	{
		document.getElementById("ctl00_ContentPlaceHolder1_j").src = images[5].src//"immagini/band/Band.jpg";
		return;
	}	

  if(tempX >= 0 && tempX <= 100 )
		document.getElementById("ctl00_ContentPlaceHolder1_j").src = images[0].src//"immagini/band/Fabbrutto_Band.jpg";
	else
		if(tempX >= 101 && tempX <= 200 )
			document.getElementById("ctl00_ContentPlaceHolder1_j").src = images[1].src//"immagini/band/Max_Band.jpg";
		else
			if(tempX >= 201 && tempX <= 300 )
				document.getElementById("ctl00_ContentPlaceHolder1_j").src = images[2].src//"immagini/band/Marco_Band.jpg";
			else
				if(tempX >= 301 && tempX <= 400 )
					document.getElementById("ctl00_ContentPlaceHolder1_j").src = images[3].src//"immagini/band/Kevin_Band.jpg";
				else
					if(tempX >= 401 && tempX <= 550 )
						document.getElementById("ctl00_ContentPlaceHolder1_j").src = images[4].src//"immagini/band/Mao_Band.jpg";
					else
						document.getElementById("ctl00_ContentPlaceHolder1_j").src = images[5].src//"immagini/band/Band.jpg";

}

function ResetImmagine()
{
	//Se mi sposto troppo velocemente dal menu all'immagine della band, javascript non fa in tempo a caricare le immagini e quindi 
	//la variabile images non è ancora valorizzata. Perciò eseguo un return
	if(images.length == 0)
		return;
		
	document.getElementById("ctl00_ContentPlaceHolder1_j").src = images[5].src//"immagini/band/Band.jpg";
}