// ---- Sezione personalizzabile (v. scheda nel sito: http://www.jsdir.com/staffscripts/script062.asp)

// 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;

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);}


function warning(){
	if(confirm("Attenzione!\nProcedendo verranno applicati i cambiamenti.\nSi desidera procedere?")){
		return true;
	}else{
		return false;
	}
}
function checkForm(){
	var flag = false;
	var checkVar = document.getElementById("checkVar");
	var option = checkVar.getElementsByTagName('OPTION');
	var option1 = option.item(1);
	var option2 = option.item(2);
	var elem = new Array();
	elem = document.getElementsByTagName("input");//prendo tutti gli elementi input
	for(var i = 0; i < elem.length; i ++){
		if(elem[i].getAttribute("type") == 'text'){//...scarto gli elementi input hidden, submit, reset...
//******** Controllo in caso Modalita' = S  ******************
			if(option1.selected){
					if(elem[i].getAttribute("check") == "true"){
						if(elem[i].getAttribute("value") != ""){
							flag = true;
						}
						else{
							flag = false;
							alert("Attenzione! Compilare il campo " + elem[i].getAttribute("name").toUpperCase());
							elem[i].focus();
							break;
						}
					}
//******************* Controllo in caso Modalita' = A ***********
			}else if(option2.selected){
					if((elem[i].getAttribute("check") == "true")||(elem[i].getAttribute("check") == "maybe")){
							if(elem[i].getAttribute("value") != ""){
								flag = true;
							}
					        else{
						        flag = false;
                                alert("Attenzione! Compilare il campo " + elem[i].getAttribute("name").toUpperCase());
						        elem[i].focus();
						        break;
					        }
                    }
			//***************************************************************
			}else{
				alert("Attenzione! Selezionare una Modalita'!");
				checkVar.focus();
				break;
			}
		}
	}
	return flag;
}
function showHideFields(campo){
	var S = "Attenzione:\nse si sceglie la modalita' Sincrona('S'),\nNON si devono compilare i campi:\n\n- SERVER\n- JMS connection factory\n- Queue name\n- JNDI factory.";
	var A = "Attenzione:\nse si sceglie la modalita' Asincrona('A'),\nE' NECESSARIO compilare i campi:\n\n- SERVER\n- JMS connection factory\n- Queue name\n- JNDI factory.";
	if(campo.value == "S"){
		alert(S);
		document.forms[0].XsltInput.focus();
	}else{
		alert(A);
	}
}
function openWin(url){
	var nuova = window.open(url,'notizie','width=400,height=200,toolbars=0, status=0');
}



