function apriimg(url){	
	window.open(url, 'news', 'toolbar=no,directories=no,menubar=no,width=650,height=500,resizable=yes,scrollbars=yes,top=10,left=30');
}

function apri(url){
	window.open(url,'finestra','width=600,height=350,scrollbars=yes');
}
function scollega_art(url){
	window.open(url,'finestra','width=10,height=10,scrollbars=yes');
}
function aprifinestra(url,fin,tipo){
	window.open(url,fin,tipo);
}

function apri_pop(url){
	window.open(url,'finestra_pop','width=550,height=300,scrollbars=yes');
}

function invia_autore(){
    window.opener.document.libri.autore.value = document.form_autori.autore.value;
 window.close();
}
function invia_citta(){
    window.opener.document.edit.citta_principale.value = document.form_citta.citta.value;
 window.close();
}

function invia_citta_adozione(){
    window.opener.document.libri.citta_adozione.value = document.form_citta.citta.value;
 window.close();
}

function invia_editore(){
    window.opener.document.libri.editore.value = document.form_editori.editore.value;
 window.close();
}

function invia_tipografo(){
    window.opener.document.libri.tipografo.value = document.form_tipografi.tipografo.value;
 window.close();
}

function chiudi(){
	window.opener.location.reload(true);
	window.close(true);
}

function cambiaimg(num){
	if (document.images){ 
		for (i=0;i<6 ;i++ )	{
			piuchangei  = new Image 
			piuchangex = new Image 
			piuchangei.src = 'images/piu.gif' 
			piuchangex.src = 'images/meno.gif' 
			if (document.piuchange.src == piuchangei.src)	{
					document.piuchangenum.src =  piuchangex.src;
				}
				else
				{
					document.piuchangenum.src =  piuchangenum.src;
			}
		}
	}
 } 
function cambiaimg1(id_img){
	if (document.images){ 
		id_img = new Image 
		id_img2 = new Image 
		id_img.src = 'images/piu.gif' 
		id_img2.src = 'images/meno.gif' 
	}
	if (document.id_img.src == id_img.src)	{
			document.id_img.src =  id_img2.src;
		}
		else
		{
			document.id_img.src =  id_img.src;
	}
 } 
function cambiaimg2(){
	if (document.images){ 
		piuchange0 = new Image 
		piuchange2 = new Image 
		piuchange0.src = 'images/piu.gif' 
		piuchange2.src = 'images/meno.gif' 
	}
	if (document.piuchange0.src == piuchange0.src)	{
			document.piuchange0.src =  piuchange2.src;
		}
		else
		{
			document.piuchange0.src =  piuchange0.src;
	}
 } 

function toggleLayer(whichLayer){
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
		//document.piuchange.src = "meno";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}

function toggleLayer_n(whichLayer){
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.visibility = "hidden";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.visibility = "hidden";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.visibility = "hidden";
	}
}
function toggleLayer_x(whichLayer){
	if (document.getElementById)
	{
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display ? "":"block";
	}
	else if (document.all)
	{
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display ? "":"block";
	}
	else if (document.layers)
	{
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display ? "":"block";
	}
}
function toggleLayer_y(whichLayer){
	if (document.getElementById)
	{
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "block";
	}
	else if (document.all)
	{
		var style2 = document.all[whichLayer].style;
		style2.display = "block";
	}
	else if (document.layers)
	{
		var style2 = document.layers[whichLayer].style;
		style2.display = "block";
	}
}
function toggleLayer_ny(whichLayer){
	if (document.getElementById)
	{
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "";
	}
	else if (document.all)
	{
		var style2 = document.all[whichLayer].style;
		style2.display = "";
	}
	else if (document.layers)
	{
		var style2 = document.layers[whichLayer].style;
		style2.display = "";
	}
}

function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}

function toggleLayer_all(whichLayer){
	clear_all();
	if (document.getElementById)
	{
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "block";
	}
	else if (document.all)
	{
		var style2 = document.all[whichLayer].style;
		style2.display = "block";
	}
	else if (document.layers)
	{
		var style2 = document.layers[whichLayer].style;
		style2.display = "block";
	}

}
function open_ante(url, name) {
  popupWin = window.open(url, name, 'width=850,height=600,left=0,top=0,scrollbars=yes,resizable=yes,toolbar=no');
}
function openWindow(url, name) {
  popupWin = window.open(url, name, 'width=798,height=580,left=0,top=0,scrollbars=yes,resizable=yes,toolbar=no');
}
function apri_redact(url, name) {
  popupWin =window.open(url,name,'width=200,height=200,left=400,top=30,scrollbars=no,resizable=yes');
}

function apri_redact_ajax(url, name) {
  popupWin =window.open(url,name,'width=200,height=200,left=400,top=30,scrollbars=no,resizable=yes');
}
function apri_nota(id_nota){
	window.open('dettaglio_nota.php?id_nota='+id_nota,'nota','width=500,height=300 ,toolbar=no, location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=100,left=50');
}
