//nostre
function popup(target)
{
	newwindow=window.open(target ,'','scrollbars=yes,resizable=no,width=470,height=500,status=no,location=no,toolbar=no');
	newwindow.creator=self;
}
function popupMedia(target)
{
	newwindow=window.open(target ,'','scrollbars=yes,resizable=yes,width=760,height=540,status=no,location=no,toolbar=no');
	newwindow.creator=self;
}
function popupsize(target,w,h)
{
	newwindow=window.open(target ,'','scrollbars=yes,resizable=no,width=' + w +',height=' + h +',status=no,location=no,toolbar=no');
	newwindow.creator=self;
}
function popupdocument(target)
{
	newwindow=window.open(target ,'','scrollbars=yes,resizable=no,width=650,height=430,status=no,location=no,toolbar=no');
	newwindow.creator=self;
}
function popupnewdocument(target)
{
	newwindow=window.open(target ,'','scrollbars=yes,resizable=no,width=650,height=430,status=no,location=no,toolbar=no');
	newwindow.creator=self;
}
function popupwordino(target)
{
	newwindow=window.open(target ,'','scrollbars=yes,resizable=yes,width=750,height=640,status=no,location=no,toolbar=no');
	newwindow.creator=self;
}
function link(treelink,mainlink)
{
	window.parent.tree.location=treelink;
	window.parent.main.location=mainlink;
}
function check_all(box) {
	if (box.name == "check_list") {
		for(i = 0; i < formlist.length; i++) {
			e = formlist.elements[i];
			if (e.type == 'checkbox' && box.checked == true) {
				e.checked = true;
				if (e.parentElement.parentElement.tabIndex == "123") {
					e.parentElement.parentElement.setAttribute('bgcolor', MouseOverChecked, 0);
				}
			}
			if (e.type == 'checkbox' && box.checked == false) {
				e.checked = false;
				if (e.parentElement.parentElement.tabIndex == "123") {
					e.parentElement.parentElement.setAttribute('bgcolor', DefaultColor, 0);
				}
			}
		}
	} else if (box.name == "check_media") {
		for(i = 0; i < allmedia.length; i++) {
			e = allmedia.elements[i];
			if (e.type == 'checkbox' && box.checked == true) {
				e.checked = true;
				if (e.parentElement.parentElement.tabIndex == "123") {
					e.parentElement.parentElement.setAttribute('bgcolor', MouseOverChecked, 0);
				}
			}
			if (e.type == 'checkbox' && box.checked == false) {
				e.checked = false;
				if (e.parentElement.parentElement.tabIndex == "123") {
					e.parentElement.parentElement.setAttribute('bgcolor', DefaultColor, 0);
				}
			}
		}
	}
}

// Questa funzione viene usata quando si crea un nuovo documento.
// Serve per levare tutto quello che c'è prima del <BODY> e dopo il </BODY>,
// facendo partire il form 'doc'.
function testo_word (testo) {
	testo = testo.split ("<BODY>");
	testo = testo[1];
	testo = testo.split("</BODY>");
	doc.document_description.value=testo[0];
	doc.onsubmit;
	doc.submit();
}


// IMPORTANTE !!! 
// I VALORI ESADECIMALI DEVONO ESSERE SCRITTI MINUSCOLI
MouseOverColor = "#b3c5cf";
DefaultColor = "";
ClickColor = "#ffffff";
MouseOverChecked = "#ffffff";

function over_colore(elemento) {
	if (elemento.getAttribute ('bgcolor') != ClickColor && elemento.getAttribute ('bgcolor') != MouseOverChecked) {
		elemento.setAttribute('bgcolor', MouseOverColor, 0);
	} else {
		elemento.setAttribute('bgcolor', MouseOverChecked, 0);
	}
}
function out_colore(elemento) {
	if (elemento.getAttribute ('bgcolor') != ClickColor && elemento.getAttribute ('bgcolor') != MouseOverChecked) {
		elemento.setAttribute('bgcolor', DefaultColor, 0);
	} else if (elemento.getAttribute ('bgcolor') != ClickColor && elemento.getAttribute ('bgcolor') == MouseOverChecked) {
		elemento.setAttribute('bgcolor', ClickColor, 0);
	}
}
function down_colore(elemento,num_check,nome_form,nome_check) {
	if (elemento.getAttribute ('bgcolor') == ClickColor || elemento.getAttribute ('bgcolor') == MouseOverChecked) {
		elemento.setAttribute('bgcolor', DefaultColor, 0);
		eval(nome_form+"."+nome_check+num_check).checked = false;
	} else {
		elemento.setAttribute('bgcolor', ClickColor, 0);
		eval(nome_form+"."+nome_check+num_check).checked = true;
	}

}
