function openWindow(url) {
  popupWin = window.open(url,'new_page','width=400,height=400')
}
function openWindow2(url) {
  popupWin = window.open(url,'new_page','width=320,height=380')
}
function openWindow3(url) {
  popupWin = window.open(url,'new_page','width=400,height=450,scrollbars=yes')
}
function openWindow4(url) {
  popupWin = window.open(url,'new_page','width=400,height=525')
}
function openWindow5(url) {
  popupWin = window.open(url,'new_page','width=450,height=525,scrollbars=yes,toolbars=yes,menubar=yes,resizable=yes')
}


function impostacolore(nomep,colore){ 
document.all(nomep).bgColor=colore; 
} 
function cambiabgcolor(nomep,colore){ 
document.all(nomep).bgColor=colore;  
} 

function Attenzione(elem) {
	if ((elem.checked)==true){
		alert("ATTENZIONE! La funzione di Auto-Login ti permette di non dover ridigitare UserName e Password la prossima volta che vieni sul sito. Utilizza questa opzione SOLO sul computer di casa o sul tuo portatile! Ti consigliamo invece di NON UTILIZZARE questa opzione se sei in ufficio o in un Internet Cafe.");
          }
}









var TotSmiles=500;
	var Browser=1;
	
	
	if (navigator.appVersion.indexOf("MSIE")==-1) {
		Browser=0;
	}
	if (navigator.appVersion.indexOf("Windows ")==-1) {
		Browser=0;
	}

	function Fuoco() {document.Post.contenuto.focus();}

        function Fuocoi() {document.Post.contenuting.focus();}

	function InsFFZCode(Opz,tgSx,tgDx,tgDx2) 
	{
		Fuoco();
		var TR=document.selection.createRange();
		if(TR!=null)
		{
			var str=new String(TR.text);
			if(Opz!=2) {
				if(Opz==1 && str.length<1) return(2);
				if(tgDx2!="") 		TR.text=tgSx+TR.text+tgDx+TR.text+tgDx2;
				else if(tgDx!="") 	TR.text=tgSx+TR.text+tgDx;
				else 			TR.text=tgSx+TR.text;
			}
			if(Opz==2)	{
				TR.text=tgSx;
			}
			return(0);
		} 
		return(1);
	}
	
function InsFFZCodei(Opz,tgSx,tgDx,tgDx2) 
	{
		Fuocoi();
		var TR=document.selection.createRange();
		if(TR!=null)
		{
			var str=new String(TR.text);
			if(Opz!=2) {
				if(Opz==1 && str.length<1) return(2);
				if(tgDx2!="") 		TR.text=tgSx+TR.text+tgDx+TR.text+tgDx2;
				else if(tgDx!="") 	TR.text=tgSx+TR.text+tgDx;
				else 			TR.text=tgSx+TR.text;
			}
			if(Opz==2)	{
				TR.text=tgSx;
			}
			return(0);
		} 
		return(1);
	}






	function InsTag(tag)
	{
		var x=0;
		if(Browser==1) {
       Fuoco();
			var TR=document.selection.createRange();
			if(TR!=null)
			{
				var str=new String(TR.text);
				str=str.replace(/\[b\]/,"");
				str=str.replace(/\[\/b\]/,"");
				str=str.replace(/\[i\]/,"");
				str=str.replace(/\[\/i\]/,"");
				str=str.replace(/\[u\]/,"");
				str=str.replace(/\[\/u\]/,"");
				str=str.replace(/\[s\]/,"");
				str=str.replace(/\[\/s\]/,"");
				str=str.replace(/\[tit1\]/,"");
				str=str.replace(/\[\/tit1\]/,"");
				str=str.replace(/\[tit2\]/,"");
				str=str.replace(/\[\/tit2\]/,"");
				TR.text=str;
			}
			x=InsFFZCode(3,"["+tag+"]","[/"+tag+"]","");
		}

		if(x!=0 || Browser!=1) {
			document.Post.contenuto.value=document.Post.contenuto.value+"["+tag+"][/"+tag+"]";
			Fuoco();
		}
	}	


function InsTagEdit(tag) {
		var x=0;
		if(Browser==1) {
			Fuoco();
			var TR=document.selection.createRange();
			if(TR!=null)
			{
				var str=new String(TR.text);
				str=str.replace(/\[center\]/,"");
				str=str.replace(/\[\/center\]/,"");
				str=str.replace(/\[right\]/,"");
				str=str.replace(/\[\/right\]/,"");
				str=str.replace(/\[justify\]/,"");
				str=str.replace(/\[\/justify\]/,"");
				TR.text=str;
			}
			if(tag=="left")	return;
			x=InsFFZCode(3,"["+tag+"]","[/"+tag+"]","");
		}
		if(tag=="left")	return;
		if(x!=0 || Browser!=1) {
			document.PostMessaggi.Testo.value=document.PostMessaggi.Testo.value+"["+tag+"][/"+tag+"]";
			Fuoco();
		}
	}

	function Inslistn()
	{
		var x=0;
		if(Browser==1) 	x=InsFFZCode(3,"[list=1][*]","[/*][/list=1]","");
		
		if(x!=0 || Browser!=1) {
			document.Post.contenuto.value=document.Post.contenuto.value+"[list=1][*][/*][/list=1]";
			Fuoco();
		}
	}	

	function Inslistp()
	{
		var x=0;
		if(Browser==1)  x=InsFFZCode(3,"[list][*]","[/*][/list]","");

		if(x!=0 || Browser!=1) {
			document.Post.contenuto.value=document.Post.contenuto.value+"[list][*][/*][/list]";
			Fuoco();
		}
	}	


	function InsImgup()
	{
		var x=0;
		if(Browser==1) x=InsFFZCode(1,"[myimg]","[/img","]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire in nome completo dell`immagine", "");
			if(a==null) { Fuoco(); return; }
			var b=window.prompt("Inserire l'allineamento (libero,sinistra,destra): ","")
			if(b==null) { Fuoco(); return; }
			if(b=="libero")  b="";
			if(b=="sinistra")  b="=left";
			if(b=="destra")  b="=right";
			if(Browser==1)			x=InsFFZCode(2,"[myimg]"+a+"[/img"+b+"]");
			if(x==1 || Browser!=1)	document.Post.contenuto.value=document.Post.contenuto.value+"[myimg]"+a+"[/img"+b+"]";
		}
		Fuoco();
	}
	
	function InsImgweb()
	{
		var x=0;
		if(Browser==1) x=InsFFZCode(1,"[img]","[/img","]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`indirizzo dell`immagine", "http://");
			if(a==null) { Fuoco(); return; }
			var b=window.prompt("Inserire l'allineamento (libero,sinistra,destra): ","")
			if(b==null) { Fuoco(); return; }
			if(b=="libero")  b="";
			if(b=="sinistra")  b="=left";
			if(b=="destra")  b="=right";
			if(Browser==1)			x=InsFFZCode(2,"[img]"+a+"[/img"+b+"]");
			if(x==1 || Browser!=1)	document.Post.contenuto.value=document.Post.contenuto.value+"[img]"+a+"[/img"+b+"]";
		}
		Fuoco();
	}
	
	function Inscolor()
	{
		var x=0;
		if(Browser==1) x=InsFFZCode(1,"[color][cod]","[/cod]","[/color]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire il colore per il testo: ","#");
			if(a==null) { Fuoco(); return; }
			var b=window.prompt("Inserire il testo da colorare con "+a,"");
			if(b==null) { Fuoco(); return; }
			if(Browser==1)			x=InsFFZCode(2,"[color][cod]"+a+"[/cod]"+b+"[/color]");
			if(x==1 || Browser!=1)	document.Post.contenuto.value=document.Post.contenuto.value+"[color][cod]"+a+"[/cod]"+b+"[/color]";
		}
		Fuoco();
	}

	function InsLinkint()
	{
		var x=0;
		if(Browser==1) x=InsFFZCode(1,"[linkinterno][url]","[/url]","[/link]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`indirizzo per il link: ","http://");
			if(a==null) { Fuoco(); return; }
			var b=window.prompt("Inserire la descrizione del link: "+a,"");
			if(b==null) { Fuoco(); return; }
			if(a.search(/^www\./g)!=-1)  a="http://"+a;
			if(Browser==1)			x=InsFFZCode(2,"[linkinterno][url]"+a+"[/url]"+b+"[/link]");
			if(x==1 || Browser!=1)	document.Post.contenuto.value=document.Post.contenuto.value+"[linkinterno][url]"+a+"[/url]"+b+"[/link]";
		}
		Fuoco();
	}
	
	function InsLinkest()
	{
		var x=0;
		if(Browser==1) x=InsFFZCode(1,"[linkesterno][url]","[/url]","[/link]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`indirizzo per il link: ","http://");
			if(a==null) { Fuoco(); return; }
			var b=window.prompt("Inserire la descrizione del link: "+a,"");
			if(b==null) { Fuoco(); return; }
			if(a.search(/^www\./g)!=-1)  a="http://"+a;
			if(Browser==1)			x=InsFFZCode(2,"[linkesterno][url]"+a+"[/url]"+b+"[/link]");
			if(x==1 || Browser!=1)	document.Post.contenuto.value=document.Post.contenuto.value+"[linkesterno][url]"+a+"[/url]"+b+"[/link]";
		}
		Fuoco();
	}	
	
	function InsLinkp()
	{
		var x=0;
		if(Browser==1) x=InsFFZCode(1,"[linkpagina][id]","[/id]","[/linkpagina]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`id della pagina per il link: ","");
			if(a==null) { Fuoco(); return; }
			var b=window.prompt("Inserire la descrizione del link: "+a,"");
			if(b==null) { Fuoco(); return; }
			if(Browser==1)			x=InsFFZCode(2,"[linkpagina][id]"+a+"[/id]"+b+"[/linkpagina]");
			if(x==1 || Browser!=1)	document.Post.contenuto.value=document.Post.contenuto.value+"[linkpagina][id]"+a+"[/id]"+b+"[/linkpagina]";
		}
		Fuoco();
	}	
	
	function InsLinkn()
	{
		var x=0;
		if(Browser==1) x=InsFFZCode(1,"[linknotizia][id]","[/id]","[/linknotizia]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`id della notizia per il link: ","");
			if(a==null) { Fuoco(); return; }
			var b=window.prompt("Inserire la descrizione del link: "+a,"");
			if(b==null) { Fuoco(); return; }
			if(Browser==1)			x=InsFFZCode(2,"[linknotizia][id]"+a+"[/id]"+b+"[/linknotizia]");
			if(x==1 || Browser!=1)	document.Post.contenuto.value=document.Post.contenuto.value+"[linknotizia][id]"+a+"[/id]"+b+"[/linknotizia]";
		}
		Fuoco();
	}	

	function Insdown()
	{
		var x=0;
		if(Browser==1) x=InsFFZCode(1,"[download][file]","[/file]","[/download]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire in nome completo del file", "");
			if(a==null) { Fuoco(); return; }
			var b=window.prompt("Inserire la descrizione del download: "+a,"")
			if(b==null) { Fuoco(); return; }
			if(Browser==1)			x=InsFFZCode(2,"[download][file]"+a+"[/file]"+b+"[/download]");
			if(x==1 || Browser!=1)	document.Post.contenuto.value=document.Post.contenuto.value+"[download][file]"+a+"[/file]"+b+"[/download]";
		}
		Fuoco();
	}




//------------------------------------------------------------



function InsTagi(tag)
	{
		var x=0;
		if(Browser==1) {
       Fuocoi();
			var TR=document.selection.createRange();
			if(TR!=null)
			{
				var str=new String(TR.text);
				str=str.replace(/\[b\]/,"");
				str=str.replace(/\[\/b\]/,"");
				str=str.replace(/\[i\]/,"");
				str=str.replace(/\[\/i\]/,"");
				str=str.replace(/\[u\]/,"");
				str=str.replace(/\[\/u\]/,"");
				str=str.replace(/\[s\]/,"");
				str=str.replace(/\[\/s\]/,"");
				str=str.replace(/\[tit1\]/,"");
				str=str.replace(/\[\/tit1\]/,"");
				str=str.replace(/\[tit2\]/,"");
				str=str.replace(/\[\/tit2\]/,"");
				TR.text=str;
			}
			x=InsFFZCodei(3,"["+tag+"]","[/"+tag+"]","");
		}

		if(x!=0 || Browser!=1) {
			document.Post.contenuting.value=document.Post.contenuting.value+"["+tag+"][/"+tag+"]";
			Fuocoi();
		}
	}	


function InsTagEditi(tag) {
		var x=0;
		if(Browser==1) {
			Fuocoi();
			var TR=document.selection.createRange();
			if(TR!=null)
			{
				var str=new String(TR.text);
				str=str.replace(/\[center\]/,"");
				str=str.replace(/\[\/center\]/,"");
				str=str.replace(/\[right\]/,"");
				str=str.replace(/\[\/right\]/,"");
				str=str.replace(/\[justify\]/,"");
				str=str.replace(/\[\/justify\]/,"");
				TR.text=str;
			}
			if(tag=="left")	return;
			x=InsFFZCodei(3,"["+tag+"]","[/"+tag+"]","");
		}
		if(tag=="left")	return;
		if(x!=0 || Browser!=1) {
			document.Post.contenuting.value=document.Post.contenuting.value+"["+tag+"][/"+tag+"]";
			Fuocoi();
		}
	}

	function Inslistni()
	{
		var x=0;
		if(Browser==1) 	x=InsFFZCodei(3,"[list=1][*]","[/*][/list=1]","");
		
		if(x!=0 || Browser!=1) {
			document.Post.contenuting.value=document.Post.contenuting.value+"[list=1][*][/*][/list=1]";
			Fuocoi();
		}
	}	

	function Inslistpi()
	{
		var x=0;
		if(Browser==1)  x=InsFFZCodei(3,"[list][*]","[/*][/list]","");

		if(x!=0 || Browser!=1) {
			document.Post.contenuting.value=document.Post.contenuting.value+"[list][*][/*][/list]";
			Fuocoi();
		}
	}	


	function InsImgupi()
	{
		var x=0;
		if(Browser==1) x=InsFFZCodei(1,"[myimg]","[/img","]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire in nome completo dell`immagine", "");
			if(a==null) { Fuocoi(); return; }
			var b=window.prompt("Inserire l'allineamento (libero,sinistra,destra): ","")
			if(b==null) { Fuocoi(); return; }
			if(b=="libero")  b="";
			if(b=="sinistra")  b="=left";
			if(b=="destra")  b="=right";
			if(Browser==1)			x=InsFFZCodei(2,"[myimg]"+a+"[/img"+b+"]");
			if(x==1 || Browser!=1)	document.Post.contenuting.value=document.Post.contenuting.value+"[myimg]"+a+"[/img"+b+"]";
		}
		Fuocoi();
	}
	
	function InsImgwebi()
	{
		var x=0;
		if(Browser==1) x=InsFFZCodei(1,"[img]","[/img","]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`indirizzo dell`immagine", "http://");
			if(a==null) { Fuocoi(); return; }
			var b=window.prompt("Inserire l'allineamento (libero,sinistra,destra): ","")
			if(b==null) { Fuocoi(); return; }
			if(b=="libero")  b="";
			if(b=="sinistra")  b="=left";
			if(b=="destra")  b="=right";
			if(Browser==1)			x=InsFFZCodei(2,"[img]"+a+"[/img"+b+"]");
			if(x==1 || Browser!=1)	document.Post.contenuting.value=document.Post.contenuting.value+"[img]"+a+"[/img"+b+"]";
		}
		Fuocoi();
	}

	function Inscolori()
	{
		var x=0;
		if(Browser==1) x=InsFFZCodei(1,"[color][cod]","[/cod]","[/color]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire il colore per il testo: ","#");
			if(a==null) { Fuocoi(); return; }
         		var b=window.prompt("Inserire il testo da colorare con "+a,"");
			if(b==null) { Fuocoi(); return; }
			if(Browser==1)			x=InsFFZCode(2,"[color][cod]"+a+"[/cod]"+b+"[/color]");
			if(x==1 || Browser!=1)	document.Post.contenuting.value=document.Post.contenuting.value+"[color][cod]"+a+"[/cod]"+b+"[/color]";
		}
		Fuoco();
	}
	
	function InsLinkinti()
	{
		var x=0;
		if(Browser==1) x=InsFFZCodei(1,"[linkinterno][url]","[/url]","[/link]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`indirizzo per il link: ","http://");
			if(a==null) { Fuocoi(); return; }
			var b=window.prompt("Inserire la descrizione del link: "+a,"");
			if(b==null) { Fuocoi(); return; }
			if(a.search(/^www\./g)!=-1)  a="http://"+a;
			if(Browser==1)			x=InsFFZCodei(2,"[linkinterno][url]"+a+"[/url]"+b+"[/link]");
			if(x==1 || Browser!=1)	document.Post.contenuting.value=document.Post.contenuting.value+"[linkinterno][url]"+a+"[/url]"+b+"[/link]";
		}
		Fuocoi();
	}
	
	function InsLinkesti()
	{
		var x=0;
		if(Browser==1) x=InsFFZCodei(1,"[linkesterno][url]","[/url]","[/link]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`indirizzo per il link: ","http://");
			if(a==null) { Fuocoi(); return; }
			var b=window.prompt("Inserire la descrizione del link: "+a,"");
			if(b==null) { Fuocoi(); return; }
			if(a.search(/^www\./g)!=-1)  a="http://"+a;
			if(Browser==1)			x=InsFFZCodei(2,"[linkesterno][url]"+a+"[/url]"+b+"[/link]");
			if(x==1 || Browser!=1)	document.Post.contenuting.value=document.Post.contenuting.value+"[linkesterno][url]"+a+"[/url]"+b+"[/link]";
		}
		Fuocoi();
	}	
	
	function InsLinkpi()
	{
		var x=0;
		if(Browser==1) x=InsFFZCodei(1,"[linkpagina][id]","[/id]","[/linkpagina]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`id della pagina per il link: ","");
			if(a==null) { Fuocoi(); return; }
			var b=window.prompt("Inserire la descrizione del link: "+a,"");
			if(b==null) { Fuocoi(); return; }
			if(Browser==1)			x=InsFFZCodei(2,"[linkpagina][id]"+a+"[/id]"+b+"[/linkpagina]");
			if(x==1 || Browser!=1)	document.Post.contenuting.value=document.Post.contenuting.value+"[linkpagina][id]"+a+"[/id]"+b+"[/linkpagina]";
		}
		Fuocoi();
	}	
	
	function InsLinkni()
	{
		var x=0;
		if(Browser==1) x=InsFFZCodei(1,"[linknotizia][id]","[/id]","[/linknotizia]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire l`id della notizia per il link: ","");
			if(a==null) { Fuocoi(); return; }
			var b=window.prompt("Inserire la descrizione del link: "+a,"");
			if(b==null) { Fuocoi(); return; }
			if(Browser==1)			x=InsFFZCodei(2,"[linknotizia][id]"+a+"[/id]"+b+"[/linknotizia]");
			if(x==1 || Browser!=1)	document.Post.contenuting.value=document.Post.contenuting.value+"[linknotizia][id]"+a+"[/id]"+b+"[/linknotizia]";
		}
		Fuocoi();
	}	

	function Insdowni()
	{
		var x=0;
		if(Browser==1) x=InsFFZCodei(1,"[download][file]","[/file]","[/download]");
		if(x!=0 || Browser!=1) {
			var a=window.prompt("Inserire in nome completo del file", "");
			if(a==null) { Fuocoi(); return; }
			var b=window.prompt("Inserire la descrizione del download: "+a,"")
			if(b==null) { Fuocoi(); return; }
			if(Browser==1)			x=InsFFZCodei(2,"[download][file]"+a+"[/file]"+b+"[/download]");
			if(x==1 || Browser!=1)	document.Post.contenuting.value=document.Post.contenuting.value+"[download][file]"+a+"[/file]"+b+"[/download]";
		}
		Fuocoi();
	}










