// Pixel di spostamento per ogni ciclo
var Step = 5;

// Velocita' di scorrimento: millisecond per il setInterval() - piu' piccolo il numero --> piu' veloce lo scorrimento
var Tempo = 100;

// ---- Fine sezione personalizzabile

var nn = document.layers?true:false;
var N6 = navigator.userAgent.toLowerCase().indexOf("gecko")!=-1?true:false;
var LayText=null;
var AltezzaLivello=0;
var LarghezzaLivello=0;
var Limite =0;
var texTop=0;
var DeltaTop = 0;
var timsc=null;

// JavaScript Document
function popup(url, name, width, height) {
  self.blur();
  //newwindow = window.open(url, name, 'width='+width+', height='+height+', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes');
  var newwindow=window.open(url, name, 'width='+width+', height='+height+', top=10, left=10, status=no, menubar=no, toolbar=no scrollbar=yes, resizable=yes'); 
  newwindow.window.focus();
}

function Start() {
	LayText=nn?document.layers.textLayer:N6?document.getElementById("textLayer").style:document.all.textLayer.style;
	DeltaTop=nn?LayText.top:N6?document.getElementById("textLayer").offsetTop:document.all.textLayer.offsetTop;
	AltezzaLivello=parseInt(nn?LayText.clip.height:N6?LayText.height:LayText.height);
	LarghezzaLivello=parseInt(nn?LayText.clip.width:N6?LayText.width:LayText.width);
	Limite=-AltezzaLivello+(nn?LayText.document.height:N6?document.getElementById("divN6").offsetHeight:document.all.textLayer.clientHeight);
	}

function Move(where) {
	where?texTop>=Limite?null:texTop+=Step:texTop==0?null:texTop-=Step;
	LayText.top=-texTop+DeltaTop;
	if (nn) {
		LayText.clip.top=texTop;
		LayText.clip.bottom=eval(texTop+AltezzaLivello);
	}
	else
		LayText.clip = "rect(" + texTop + ", " + LarghezzaLivello + ", " +eval(texTop+AltezzaLivello) + ", 0)";
	}


function StartScroll(updown) {
  timsc=setInterval(updown?"Move(true)":"Move(false)",Tempo);
}
	
function StopScroll() {
  clearInterval(timsc);
}

/*
* mostra descrizione dei menu
*/
function mostra_desc(codice) {

  var desc = new Array();

  desc['portoni'] = '';
  desc['comeca'] = 'COMECA';
  desc['portoni'] = 'COMECA';
  desc['sekur'] = 'SEKURLINE';
  desc['exe'] = 'EXE\'';
  desc['vuoto'] = '';

  document.getElementById("desc_sez").innerHTML = desc[codice];
}

/*
* carica la lingua
*/
function lang() {
  var qst=top.location.href;
  var arr_split = qst.split("/");

  var lingua = "";
  if(arr_split[3] == "restyling"  || arr_split[3] == "comeca")
    lingua = arr_split[4];
  else lingua = arr_split[3];

  if(lingua == "eng" || lingua == "jap" || lingua == "esp" || lingua == "fra")
    return lingua;

  return "";
}
