﻿// JScript File
var r = 1;
var g = 1;
var b = 1;
						
//var N_IMG	= 19;				// Memorizza il numero di immagini che conterrà
								// l'array per il rollover

var N_IMG	= 23;

var nImg	= 0
var aRoll	= new Array(N_IMG);
						
for (i = 0; i < N_IMG + 1; i++)
{
	aRoll[i] = new Image();
}
aRoll[0].src = "DirFoto/P_LABORATORIO2.JPG";
aRoll[1].src = "DirFoto/P_LABORATORIO3.JPG";
aRoll[2].src = "DirFoto/P_LABORATORIO5.JPG";
aRoll[3].src = "DirFoto/P_LABORATORIO.JPG";
aRoll[4].src = "DirFoto/P_MAGAZZ.RIC.JPG";
aRoll[5].src = "DirFoto/P_PICT0384.JPG";
aRoll[6].src = "DirFoto/P_PICT0385.JPG";
aRoll[7].src = "DirFoto/P_PICT0386.JPG";
aRoll[8].src = "DirFoto/P_PICT0387.JPG";
aRoll[9].src = "DirFoto/P_POSTAZ.1.JPG";
aRoll[10].src = "DirFoto/P_POSTAZ.2.JPG";
aRoll[11].src = "DirFoto/P_POSTAZ.4.JPG";
aRoll[12].src = "DirFoto/P_POSTAZIONE3.JPG";
aRoll[13].src = "DirFoto/P_POSTAZIONE REWORKING B.G.A.JPG";
aRoll[14].src = "DirFoto/P_POSTAZIONEAGGIORNAMENTI.JPG";
aRoll[15].src = "DirFoto/P_PSTAZ.3.JPG";
aRoll[16].src = "DirFoto/P_RECEPTION1.JPG";
aRoll[17].src = "DirFoto/P_RECEPTION2.JPG";
aRoll[18].src = "DirFoto/P_RECEPTION4.JPG";
aRoll[19].src = "DirFoto/P_RECEPTION6.JPG";
aRoll[20].src = "DirFoto/P_SOST.BGA.jpg";
aRoll[21].src = "DirFoto/P_STAZIONE DI TEST BRACCIALI E CALZATURE.JPG";
aRoll[22].src = "DirFoto/P_UFFICIO.JPG";

	// ----------------------------------------------------------------------------- //
	// Base.js versione 1.0.1
	// Ultima modifica:	09/10/2004 17.00
	// Autore:			Lattanzio Pierpaolo
	// Note:			E' severamente vietato riprodurre, in parte o integralmente,
	//					o modificare il codice di questo file
	// ----------------------------------------------------------------------------- //

var url="http://www.testcom.it"
var title="Il sito www.testcom.it"
			
function addfavorite(){
	if (document.all)
	window.external.AddFavorite(url,title)
}
	
function addhomepage(){
	if(document.all) document.body.style.behavior='url(#default#homepage)';
	document.body.setHomePage(url);
}

	
	// Apre una finestra
	function OpenWindow(page,features)
	{
		var win;
		win = window.open(page,null,features);
	}
	
	// Apre la finestra delle news
	function OpenNews(Id)
	{
	  var features;

    features = "top=150,left=150,location=no,locationbar=no,menubar=no,resizable=yes,scrollbars=no,";
    features += "status=no,titlebar=no,toolbar=no,width=400,height=320;";
    
		var win;
		win = window.open("ShowNews.aspx?CN=" + Id,null,features);
	}

	// Elimina gli spazi da una stringa
	function m_trim(s)
	{
		var re;
			
		re = /\s/
			
		while (s.indexOf(" ",1) != -1)
		{
			s = s.replace(re,"");
		}
		s = s.replace(re,"");
		return s;
	}
	
	// Controlla se in una stringa ci sono caratteri non validi (\/:*?"<>)
	function m_filterstringa(s)
	{
		var re;
		var schar = "\\/:*?\"<>";
			
		if (s.indexOf("\'",1) != -1 || s.indexOf("\\",1) != -1 || +
			s.indexOf("\/",1) != -1 || s.indexOf("\:",1) != -1 || +
			s.indexOf("\*",1) != -1 || s.indexOf("\?",1) != -1 || +
			s.indexOf("\"",1) != -1 || s.indexOf("\<",1) != -1 || +
			s.indexOf("\>",1) != -1)
		{
			alert("I caratteri (" + schar + ") non sono validi.");
			return false;
		}
		return true;
	}
	
	// Aggiunge degli 0 davanti ad una stringa minore di una lunghezza
	// data
	function m_padr(valore,ndig)
	{	
		var i;
		var sadd = new String;
		var result = new String;
		
		result = m_trim(valore);
		
		// Controllo se la stringa passata alla funzione ha una lunghezza
		// inferiore al numero delle digitazioni stabilite
		if (result.length < ndig)
		{	
			for (i = 1; (sadd.length < (ndig - result.length)); i++)
			{
				// Creo la stringa per l'aggiunta degli 0
				sadd += "0";
			}
		}
		// Creo la stringa finale
		result = sadd + result
		// Restituisco il valore
		return result;
	}
	
	// Questa funzione controlla se il valore è nullo
		function m_checkValueForm(oggetto,nome)
		{
			var obj = new Object;
			var valore = new String;
			
			obj = oggetto;
			valore = m_trim(obj.value);
			if (valore.length == 0)
				{	
					alert("Campo " + nome + " obbligatorio!");
					obj.focus();
					return false;
				}
		}
	
	function CheckEmail(Email)
	{
		var pEmail = new String(Email)
				
		if (pEmail.length > 5) 
			{ 
				if (pEmail.indexOf('@')!= -1 && pEmail.indexOf('.')!= -1)
				{return true;}
			}
				
		alert("Attenzione il campo email non è valido \nAssicurarsi di aver digitato una email corretta");
		return false;
	}
						
	function CentraTesto()
	{
		var w_h;
		var w_w;
					
		// Imposto l'altezza e la larghezza del documento
		w_h = document.body.offsetHeight;
		w_w = document.body.offsetHeight;
					
		//Testo.clientTop = w_h / 2;
	}

	function InProgress()
	{
				
		if (r == 255)
		{
			if (g == 255)
				{
					if (b == 255)
					{
						r = 1;
						g = 1;
						b = 1;
					}
				else
					{
						b++;
					}
				}
			else
				{
					g++;
				}		
		}
		else
		{
			r++;
		}
		// window.status = "r=" + r + " g=" + g + "b =" + b;
		// progress.bgColor = (r * g * b);
		HiFi.style.color = (r * g * b);		
	}

	function Rollover()
	{
		// Carico l'immagine
		frmHome.imgRoll.src = aRoll[nImg].src;
		// Incremento il contatore
		nImg++;
		// Se è l'ultima riparto da 0
		if (nImg == N_IMG) {nImg = 0}
	}

	function ShowFoto()
		{
			var oWin;
			var pathFoto = new String();
			var oImg = new Image();
			var opzioni;
			var i;
			
			pathFoto = imgRoll.src;
			pathFoto = pathFoto.substr(0,pathFoto.length - 5);
			pathFoto = pathFoto + ".jpg";
			
			oImg.src = pathFoto;
			// alert(typeof(oImg));
			
			// opzioni = "width=" + oImg.width + ",height=" + oImg.height;
			opzioni = "location=0,resizable=yes"
			oWin = window.open(pathFoto,"Foto",opzioni);
			// oWin.document.title = "L\''azienda da vicino.";
			
			oImg = undefined;
			return false;
		}
	
	function ShowImg(pathImg)
		{
			var oWin;
			var opzioni;
			
			opzioni = "location=0,resizable=yes"
			oWin = window.open(pathImg,"Immagine",opzioni);
			
			oImg = undefined;
			return false;
		}

