

function SetTitleValuebis()
{
var tipo
tipo = ''
for (var kk=0;kk<document.all.tags("input").length;kk++)
	{
		if (document.all.tags("input")[kk].type=='radio')
			{
				if (document.all.tags("INPUT")[kk].checked == true)
					{
						tipo = tipo + (document.all.tags("input")[kk].value)
					}
			}
	}
	

if (tipo == '')
	{
		alert("Selezionare il tipo di upload da effettuare.")
		document.retValue=false;
		return;
	}

		//document.retValue=false;
	if (tipo == 'img')
	{
			if (document.form1.File1.value.search('.jpg')==-1 && document.form1.File1.value.search('.gif')==-1 && document.form1.File1.value.search('.bmp')==-1 &&document.form1.File1.value.search('.swf')==-1 &&document.form1.File1.value.search('.png')==-1)
				{alert('Sono accettati solo files *.jpg,*.gif,*.bmp,*.swf,*.png');return;}
	}
	
	if (tipo == 'doc')
	{
			if (document.form1.File1.value.search('.doc')==-1 && document.form1.File1.value.search('.pdf')==-1 && document.form1.File1.value.search('.xls')==-1 && document.form1.File1.value.search('.txt')==-1 && document.form1.File1.value.search('.ppt')==-1 )
				{alert('Sono accettati solo files *.doc,*.pdf,*.xls');return;}
	}				
				
		document.retValue=true;
		document.form1.action="gestione_upload.asp?" + document.form1.File1.value+'&tipo='+tipo;
		return;
	}

function showFiles()
		{
		window.open('gestione_showFiles.asp?screenX='+(self.screen.width-590)/2+'&screenY='+(self.screen.height-450)/2+' ','Immagini','left='+(self.screen.width-590)/2+',top='+(self.screen.height-450)/2+',width=590,height=450,status=yes,resizable=yes,scrollbars=yes,toolbar=no,menubar=no');
		}
		
		
		
		
function showComunica(i)
{
	window.open('gestione_showComunica.asp?kk=+'+i+'&screenX='+(self.screen.width-590)/2+'&screenY='+(self.screen.height-450)/2+' ','Immagini','left='+(self.screen.width-590)/2+',top='+(self.screen.height-450)/2+',width=590,height=450,status=yes,resizable=yes,scrollbars=yes,toolbar=no,menubar=no');
}
function PubblicazioniIntranet_SelezionaFile(i)
{
	window.open('gestione_PubblicazioniIntranet_SelezionaFile.asp?kk=+'+i+'&screenX='+(self.screen.width-590)/2+'&screenY='+(self.screen.height-450)/2+' ','Immagini','left='+(self.screen.width-590)/2+',top='+(self.screen.height-450)/2+',width=590,height=450,status=yes,resizable=yes,scrollbars=yes,toolbar=no,menubar=no');
}	
		


function AttivaCollegamento()
{
	tab=document.getElementById("rigacoll")
	if (tab.style.display == "none")
	{
		tab.style.display = "inline"
		tab=document.getElementById("tabdescrcompl")
		tab.style.display = "none"
	}
	else
	{
		tab.style.display = "none"
		tab=document.getElementById("tabdescrcompl")
		tab.style.display = "inline"
		tab=document.getElementById("collegamento")
		tab.value = "http://"
	}
}

function showImages()
		{
		window.open('gestione_showimages.asp?screenX='+(self.screen.width-590)/2+'&screenY='+(self.screen.height-450)/2+' ','Immagini','left='+(self.screen.width-590)/2+',top='+(self.screen.height-450)/2+',width=590,height=450,status=no,resizable=yes,scrollbars=yes,toolbar=no,menubar=no');
		}

function PopUpUpen(stringa)
{
	//pagina = "gestione_news_dettaglio.asp?idnews="+idNews
	window.open(stringa,'Anteprima','scrollbars=yes,resizable=yes,width=800,height=600,status=no,location=no,toolbar=no');
}

function initEditor(editor) {
  //editor = new HTMLArea(mytextarea);
  // comment the following two lines to see how customization works
  editor.generate();
  return false;

  var cfg = editor.config; // this is the default configuration
  cfg.registerButton({
    id        : "my-hilite",
    tooltip   : "Highlight text",
    image     : "ed_custom.gif",
    textMode  : false,
    action    : function(editor) {
                  editor.surroundHTML("<span class=\"hilite\">", "</span>");
                },
    context   : 'table'
  });

  cfg.toolbar.push(["linebreak", "my-hilite"]); // add the new button to the toolbar

  // BEGIN: code that adds a custom button
  // uncomment it to test
  var cfg = editor.config; // this is the default configuration
  /*
  cfg.registerButton({
    id        : "my-hilite",
    tooltip   : "Highlight text",
    image     : "ed_custom.gif",
    textMode  : false,
    action    : function(editor) {
                  editor.surroundHTML("<span class=\"hilite\">", "</span>");
                }
  });
  */

function clickpointerler(editor, buttonId) {
  switch (buttonId) {
    case "my-toc":
      editor.insertHTML("<h1>Table Of Contents</h1>");
      break;
    case "my-date":
      editor.insertHTML((new Date()).toString());
      break;
    case "my-bold":
      editor.execCommand("bold");
      editor.execCommand("italic");
      break;
    case "my-hilite":
      editor.surroundHTML("<span class=\"hilite\">", "</span>");
      break;
  }
};
cfg.registerButton("my-toc",  "Insert TOC", "ed_custom.gif", false, clickpointerler);
cfg.registerButton("my-date", "Insert date/time", "ed_custom.gif", false, clickpointerler);
cfg.registerButton("my-bold", "Toggle bold/italic", "ed_custom.gif", false, clickpointerler);
cfg.registerButton("my-hilite", "Hilite selection", "ed_custom.gif", false, clickpointerler);

cfg.registerButton("my-sample", "Class: sample", "ed_custom.gif", false,
  function(editor) {
    if (HTMLArea.is_ie) {
      editor.insertHTML("<span class=\"sample\">&nbsp;&nbsp;</span>");
      var r = editor._doc.selection.createRange();
      r.move("character", -2);
      r.moveEnd("character", 2);
      r.select();
    } else { // Gecko/W3C compliant
      var n = editor._doc.createElement("span");
      n.className = "sample";
      editor.insertNodeAtSelection(n);
      var sel = editor._iframe.contentWindow.getSelection();
      sel.removeAllRanges();
      var r = editor._doc.createRange();
      r.setStart(n, 0);
      r.setEnd(n, 0);
      sel.addRange(r);
    }
  }
);


  /*
  cfg.registerButton("my-hilite", "Highlight text", "ed_custom.gif", false,
    function(editor) {
      editor.surroundHTML('<span class="hilite">', '</span>');
    }
  );
  */
  cfg.pageStyle = "body { background-color: #efd; } .hilite { background-color: yellow; } "+
                  ".sample { color: green; font-family: monospace; }";
  cfg.toolbar.push(["linebreak", "my-toc", "my-date", "my-bold", "my-hilite", "my-sample"]); // add the new button to the toolbar
  // END: code that adds a custom button

  editor.generate();
}

function tipoMenu()
{
var tipo
tipo = ''
for (var kk=0;kk<document.all.tags("input").length;kk++)
	{
		if (document.all.tags("input")[kk].type=='radio')
			{
				if (document.all.tags("INPUT")[kk].checked == true)
					{
						tipo = tipo + (document.all.tags("input")[kk].value)
					}
			}
	}
if (tipo != '')
	document.f1.submit();
}

function ApriCalendario()
 { window.open('calendario/samples/mlcpopupeventi.asp','','resizable=no,toolbar=no,menubar=no,status=no,location=no,height=190,width=170,left=580,top=225');}


function numerico()
{
	if (isNaN(document.f1.durata.value) || document.f1.durata.value+'' == '')
		document.f1.durata.value = '1'
}

function proprietanews()
{
	if (document.f1.chk_primo.checked == true)
		{
			document.f1.chk_visibile.checked = true
			document.f1.chk_home.checked = true
		}
	if (document.f1.chk_home.checked == true)
		{
			document.f1.chk_visibile.checked = true
		}
}

function ricerca()
{if ( (Trim(document.frm_ricerca.text_cerca.value) == ''))
	{alert("Inserire un parametro di ricerca")
		frm_ricerca.text_cerca.select();
	return;} 
 else
 	if ( (Trim(document.frm_ricerca.text_cerca.value)).length < 3  )
			{alert("Inserire una parola chiave di almeno 3 caratteri")
			frm_ricerca.text_cerca.select();
			return;} 
		else
			document.frm_ricerca.submit();
}
