function check_openWindow(thisObj) {
	if ( thisObj.type=="button" || thisObj.type=="submit" ) {
		for ( i=0; i<thisObj.form.elements.length; ++i ) {
			if ( thisObj.form.elements[i].type=="hidden"
			&&   thisObj.form.elements[i].name=="SUBMIT_BUTTON"
			) {
				thisObj.form.SUBMIT_BUTTON.value=thisObj.name
			}
			if ( thisObj.form.elements[i].type=="hidden"
			&&   thisObj.form.elements[i].name=="SUBMIT_VALUE"
			) {
				thisObj.form.SUBMIT_VALUE.value=thisObj.value
			}
		}
		thisObj.form.submit();
	} else {
		loc = thisObj.href
		if ( thisObj.target=="_top" )
			top.location.href = loc;
		else if ( thisObj.target=="_parent" )
			parent.window.location.href = loc;
		else if ( thisObj.target!="_self" && thisObj.target!="" && thisObj.target!=null) {
			var pos = thisObj.target.indexOf(' ',0);
			var target = thisObj.target;
			var options = ""

			if ( pos>=0 ) {
				target = thisObj.target.substring(0,pos)
				options = thisObj.target.substring(pos+1,thisObj.target.length);
			}
			newwindow = window.open(loc,target,options);
		} else 
			location.href = loc
	}
	return false;
}


function open_window(obj,options) {
	var	newopts = ""
	var	v = stringSplit(options,',');
	var	w = ""
	var	h = ""
	var	a = "c"; // x difetto al centro

	for ( var j=0; j<v.length; ++j ) {
		var	eq = v[j].indexOf('=',0)
		var	nm = ""

		if ( eq>=0 ) nm = v[j].substring(0,eq)
		if ( nm=="anchor" )
			a = v[j].substring(eq+1,v[j].length)
		else {
			if ( nm=="width" )
				w = v[j].substring(eq+1,v[j].length)
			else if ( nm=="height" )
				h = v[j].substring(eq+1,v[j].length)
			if ( newopts!="" ) newopts += ","
			newopts += v[j];
		}
	}
	if ( w && h ) {
		var	top = 0
		var	left= 0
		var	h_offs = 50; // 

		if ( a=="nw" ) {
			top = 0
			left = 0
		} else if ( a=="n" ) {
			top = 0
			left = (screen.width-w)/2
		} else if ( a=="ne" ) {
			top =  0
			left = screen.width-w
		} else if ( a=="w" ) {
			left = 0
			top = (screen.height-h)/2
		} else if ( a=="e" ) {
			left = screen.width-w
			top = (screen.height-h)/2
		} else if ( a=="sw" ) {
			top = screen.height-h-h_offs
			left = 0
		} else if ( a=="s" ) {
			top = screen.height-h-h_offs
			left = (screen.width-w)/2
		} else if ( a=="se" ) {
			top = screen.height-h-h_offs
			left = screen.width-w
		} else {
			top =  (screen.height-h)/2;
			left = (screen.width-w)/2;
		}
		if ( navigator.appName == "Netscape" ) {
			newopts += ',top=' + top + ',left=' + left;
		} else {
			newopts += ',screenY=' + top + ',screenX=' + left;
		}
//		alert("sw="+screen.width+"=sh="+screen.height+"=top="+top+"=left="+left)
	}
//	alert("newopts=" + newopts + "=anchor="+a+"=w="+w+"=h="+h+"=")
	newwindow = window.open(obj.href,"_blank",newopts)
	return false
}
//-->
<!--- Hide script from browsers that don't understand JavaScript

//   Copyright 1999- by sbv-builder - Sistema Bibliotecario del Vimercatese

var	currentType="";
var	currentObj;
var	sbv_bibute="";
var	sbv_tipUte="";
var	sbv_numute="";
var	sbv_passwd="";


function stringReplace(str,seq,newseq) {
	var newstr = ""
	var l = seq.length;

	while ( (idx=str.indexOf(seq,0))>=0 ) {
		newstr = newstr + str.substring(0,idx) + newseq
		str = str.substring(idx+l)
	}
	newstr = newstr + str
	return newstr
}

function getCurrentTypeCheck() {
	return currentType;
}

function setIdKeys(bibute,tipute,numute,pswd) {
	sbv_bibute = bibute;
	sbv_tipute = tipute;
	sbv_numute = numute;
	sbv_passwd = pswd;
}

function executeCmd() {
	newwindow.close();
	if ( currentObj.type=="button" || currentObj.type=="submit" ) {
		currentObj.form.SBVUID_BIBUTE.value = sbv_bibute;
		currentObj.form.SBVUID_TIPUTE.value = sbv_tipute;
		currentObj.form.SBVUID_NUMUTE.value = sbv_numute;
		currentObj.form.SBVUID_PASSWORD.value = sbv_passwd;
		for ( i=0; i<currentObj.form.elements.length; ++i ) {
			if ( currentObj.form.elements[i].type=="hidden"
			&&   currentObj.form.elements[i].name=="SUBMIT_BUTTON"
			) {
				currentObj.form.SUBMIT_BUTTON.value=currentObj.name
			}
			if ( currentObj.form.elements[i].type=="hidden"
			&&   currentObj.form.elements[i].name=="SUBMIT_VALUE"
			) {
				currentObj.form.SUBMIT_VALUE.value=currentObj.value
			}
		}
		currentObj.form.submit();
	} else {
		loc = currentObj.href
		if ( currentObj.search=="" )
			loc += "?"
		else
			loc += "&"
		loc += "SBVUID_BIBUTE=" + escape(sbv_bibute)
		loc += "&" + "SBVUID_TIPUTE=" + escape(sbv_tipute)
		loc += "&" + "SBVUID_NUMUTE=" + escape(sbv_numute)
		loc += "&" + "SBVUID_PASSWORD=" + stringReplace(escape(sbv_passwd),'+','%2B');
		if ( currentObj.target=="_top" )
			top.location.href = loc;
		else if ( currentObj.target=="_parent" )
			parent.window.location.href = loc;
		else if ( currentObj.target!="_self" && currentObj.target!="" && currentObj.target!=null) {
			var pos = currentObj.target.indexOf(' ',0);
			var target = currentObj.target;
			var options = ""

			if ( pos>=0 ) {
				target = currentObj.target.substring(0,pos)
				options = currentObj.target.substring(pos+1,currentObj.target.length);
			}
			newwindow = window.open(loc,target,options);
		} else 
			location.href = loc
	}
}

function check_password(type_check,thisObj) {

	currentType = type_check;
	currentObj = thisObj;
	var h = 300;
	var w = 440;
	options = "toolbar=0,status=0,menubar=0,scrollbars=1," +
			"resizable=0,width=" + w +
			",height=" + h;
	var left = (screen.width-w)/2;
	var top = (screen.height-h)/2;
	if ( navigator.appName == "Netscape" ) {
		options += ',top=' + top + ',left=' + left;
	} else {
		options += ',screenY=' + top + ',screenX=' + left;
	}
//	newwindow=window.open("/utility/identify.html","passwdWindow", options);
        var u = "/cgi-bin/identify.cgi?SBVUID_TYPE=" + type_check;

	if ( currentObj.type=="button" || currentObj.type=="submit" ) {
		for ( i=0; i<currentObj.form.elements.length; ++i ) {
			if ( currentObj.form.elements[i].name=="SIGLA_LANG" )
				u = u + "&SIGLA_LANG=" + currentObj.form.elements[i].value
		}
	} else {
		var sigla = ""
		var v = stringSplit(currentObj.search,'&');
		for ( var j=0; j<v.length; ++j ) {
	                var end = v[j].indexOf ('=',0)
			var name = ""
			var value = ""

			if ( end>0 && (name = v[j].substring(0,end))=="SIGLA_LANG" ) {
				var s = v[j].substring(end+1,v[j].length)
				if ( s!="" ) sigla = s;
			}
		}
		if ( sigla!="" )
			u = u + "&SIGLA_LANG=" + sigla

	}
//	alert ("u=" + u);
	newwindow=window.open(u,"passwdWindow", options);
	return false
}
//-->
<!--- Hide script from browsers that don't understand JavaScript

function close_window() {
	self.close();
}
//-->
<!--- Hide script from browsers that don't understand JavaScript

function print_page() {
	var VERSION = parseInt(navigator.appVersion);
	if ( VERSION <=3 ) {
		alert("Non e' possibile stampare con questa versione del browser.")
	} else {
		var NS = (navigator.appName == "Netscape");
		NS = 1
		if (NS) {
			window.print() ;  
		} else {
			var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
			document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
			WebBrowser1.ExecWB(6, 2);
			WebBrowser1.outerHTML = "";  
		}
	}
}
//-->
function stringSplit ( string, delimiter ) { 
    if ( string == null || string == "" ) { 
        return null; 
    } else if ( string.split != null ) { 
        return string.split ( delimiter ); 
    } else { 
        var ar = new Array(); 
        var i = 0; 
        var start = 0; 
        while( start >= 0 && start < string.length ) { 
             var end = string.indexOf ( delimiter, start ) ; 
             if( end >= 0 ) { 
                 ar[i++] = string.substring ( start, end ); 
                 start = end+1; 
             } else { 
                 ar[i++] = string.substring ( start, string.length ); 
                 start = -1; 
             } 
        } 
        return ar; 
    } 
} 
