function openWin( windowURL, windowName, windowFeatures ) { 
	return window.open( windowURL, windowName, windowFeatures ) ; 
}

function eliminaSpazi(strTarget) {
        var strRet="" ;
        var i = 0 ;
        strTarget = strTarget.replace(/^\s*/, "") ;
        strTarget = strTarget.replace(/\s*$/, "") ;

        return (strTarget) ;
}

function eliminaHTML(strTarget) {
        strTarget = strTarget.replace(/(\<.*\>|\<|\>)/gi, "") ;

        return (strTarget) ;
}

/*
Devono essere definiti gli array:
labels		Con le etichette per i campi obbligatori,
fields		Con i nomi dei campi obbligatori
*/
function verificaForm(frm, labels, fields) {
        // modifica i tag html
        for(var i=0; i < frm.length ; i++) {
                if(frm[i].type == "text" || frm[i].type == "textarea" || frm[i].type == "password") frm[i].value = eliminaHTML(frm[i].value) ;
        }


        for(var i=0; i < labels.length ; i++) {
                var text = eliminaSpazi(frm[fields[i]].value) ;
                if(text.length == 0) {
                        alert("Il campo '"+labels[i]+"', non puo' essere vuoto") ;
                        return false ;
                }
        }
        return true ;
}

/*
Devono essere definiti gli array:
labels		Con le etichette per i campi obbligatori,
fields		Con i nomi dei campi obbligatori
*/
function verificaFormWithHTML(frm, labels, fields) {

        for(var i=0; i < labels.length ; i++) {
                var text = eliminaSpazi(frm[fields[i]].value) ;
                if(text.length == 0) {
                        alert("Il campo '"+labels[i]+"', non puo' essere vuoto") ;
                        return false ;
                }
        }
        return true ;
}


/*
ZTE launcher
*/

function zte_launcher(np)
{
	var W= screen.availWidth-10;
	var H= screen.availHeight-30;
	var L=(screen.availWidth-800)/2;
	var T=(screen.availHeight-600)/2;
	var param;
	if (navigator.userAgent.indexOf("MSIE") != -1)// internet explorer
   	{param="resizable=yes,scrollbars=yes,toolbar=no,status=no,width=790,height=550,left="+L+",top="+T;}
	else// netscape
   	{param="resizable=yes,scrollbars=yes,toolbar=no,status=no,width="+W+",height="+H+",screenX=0,screenY=0"}
 
	url = "http://www.looplab.it:82/Zte/Home1.jsp?nomeprova="+np;
	window.open (url,"ZTEWIN",param);
}

function requestLoginObj(obj){
	var frm = document.getElementById("bulletLoginObj").className = "displayOn" ;
	var frm = document.getElementById("inputLoginObj").value = obj ;
}  

function requestLoginFile(obj){
	var frm = document.getElementById("bulletLoginObj").className = "displayOn" ;
	var frm = document.getElementById("inputLoginFile").value = obj ;
}  

function requestLoginUrl(obj){
	var frm = document.getElementById("bulletLoginObj").className = "displayOn" ;
	var frm = document.getElementById("inputLoginUrl").value = obj ;
} 


function tallon() {		
	var curtop = 0;
	var obj = document.getElementById('selected');

	try{
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
	curtop += obj.y;
	}catch(e) {
		return ;
	}
	var x = document.getElementById("talloncino");
	x.style.top = (curtop-14)+"px";
	x.style.display = "block";

	var obj2 = document.getElementById('selected');
	try{
	if (obj2.offsetHeight > 25)
	x.style.top = (curtop-7)+"px";
	//x.style.border = "0px solid red";
	//x.style.height = "122px";
	}catch(e) {
		return ;
	}
}


// script per la gestione e visualizzazione delle copertine dei volumi

	function changeCover(immagine) {
		var x = document.getElementById("coverImg");
		x.style.backgroundImage = "url(/img/_copertine/"+immagine+")";
	}
	
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////



