NomeScuola = "Liceo Foscarini di Venezia"
Autore = "Paolo Bonavoglia"
Titolo = "Metodi numerici"

function GetElement(nome){
   return document.getElementById(nome);
}

Array.prototype.Set = function(ind){
	var foto  = GetElement('Foto');
	foto.src = this[ind][0];
	if (this[ind][2]) foto.style.width  = this[ind][2];
	if (this[ind][3]) foto.style.height = this[ind][3];
	GetElement('Legenda').innerHTML = this[ind][1];
	GetElement('Scelta').value = ind;
}

Array.prototype.Change = Array.prototype.Set;

Array.prototype.Next = function(){
	var ind = GetElement('Scelta').value;
	if (ind < this.length - 1) ++ind; else ind = 0;
	this.Set(ind);
}

Array.prototype.Prev = function(){
	var ind = GetElement('Scelta').value;
	if (ind > 0) --ind; else ind = this.length -1;
	this.Set(ind);
}

Array.prototype.MMSet = function(ind){
	var media = GetElement('Media');
	var html = '<';
	posext = this[ind][0].indexOf('.');
	var ext = this[ind][0].substr(posext+1, 7);
	if ((ext  == 'jpeg') || (ext == 'jpg') || (ext == 'png') || (ext == 'gif')) {
		html += "img src= '" + this[ind][0] +"'";
	} else if ((ext == 'wma') ||(ext == 'mp3') || (ext == 'mpg') || (ext == 'mpeg')){
		html += "embed src='" + this[ind][0] +"'";
	} else if (ext == 'YouTube') {
		sorg = 'http://www.youtube.com/v/' + this[ind][0].substr(7, 255) + '&hl=it&rel=0&fs=1&color2=0xe4a400';
		html += "embed type='application/x-shockwave-flash' src='" + sorg + "'";
	} else {
		sorg = 'http://video.google.com/googleplayer.swf?docid=' + this[ind][0].substr(6, 255) + '&amp;hl=it&amp;fs=true';
		html += "embed type='application/x-shockwave-flash' src='" + sorg + "'";
	}
	if (this[ind][2]) html += "width= " + this[ind][2] + " style='width:" + this[ind][2] + ";'";
	if (this[ind][3]) html += "height= " + this[ind][3] + " style='height:" + this[ind][3] + ";'";
	html += '>';
	media.innerHTML = html;
	GetElement('Legenda').innerHTML = this[ind][1];
	GetElement('Scelta').value = ind;
}

Array.prototype.MMNext = function(){
	var ind = GetElement('Scelta').value;
	if (ind < this.length - 1) ++ind; else ind = 0;
	this.MMSet(ind);
}

Array.prototype.MMPrev = function(){
	var ind = GetElement('Scelta').value;
	if (ind > 0) --ind; else ind = this.length -1;
	this.MMSet(ind);
}

function ScriviLogo(dir){
	document.writeln('<IMG SRC="', dir, 'logo.png" USEMAP="#Logo">');
	document.writeln('<MAP NAME="Logo">');
	document.writeln('<AREA SHAPE="rect" COORDS="0,0,168,25" HREF="', dir, 'index.html">');
	document.writeln('<AREA SHAPE="rect" COORDS="64,88,180,105" HREF="', dir, '../../index.html">');
	document.writeln('</MAP>');
}

function ScriviBarra(dir){
	document.write('<A HREF="', dir, 'equazioni/equazioni.htm" TITLE="Soluzione numerica di equazioni">')
	document.write('Equazioni</A>');
	document.write(' - <A HREF="', dir, 'quadrature/index.html" TITLE="Calcolo numerico di aree">')
	document.write('Quadrature</A>');
}

function CaricaImmCorde(imm, nome){
	imm.src = "corde" + nome + ".gif";
	imm.width = 256;
	imm.height = 256;
}

function ScriviUltimaData(){
	var datAgg = new Date(document.lastModified);
	with (datAgg) {
		document.writeln(getDate(), '-', getMonth()+1, '-', getFullYear(), '<BR>');
	}
}

function ScriviCoda(dir){
	document.writeln('<br style="clear: both">')
	document.write('<hr>Pagina aggiornata al ')
	ScriviUltimaData();
	document.write('<hr><a href="', dir, 'index.html">')
	document.write(Titolo, '</a><br>@2006 - <em>', Autore)
	document.write(' - ', NomeScuola, '</em>');
}
