function openwindow2(filerec) {
	 window.open (filerec,"InfoPhp","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no");}

var col_nw = "#ffffff";	//colore sfondo
function thumbBak(Pmaxi,Img) { document.write('<a href="javascript:MaxiBak(\''+Pmaxi+'/'+Img+'\')"><img src="'+Pmaxi+'/thumbs/'+Img+'" align="left" hspace="10" vspace="5" ALT="Immagine associata al messaggio"></a>');}
function MaxiBak(Fmaxi) {
	i1 = new Image;
	i1.src = Fmaxi;
	Fhtml = '<HTML>\n<HEAD>\n<TITLE>Foto</TITLE>\n<LINK REL="shortcut icon" HREF="'+window.location.protocol+'//www.'+window.location.hostname+'/favicon.ico" TYPE="image/x-icon">\n</HEAD>\n<BODY >\n<CENTER><a href="javascript:self.close()"><IMG SRC="'+Fmaxi+'" BORDER=0 NAME=foto onLoad="window.resizeTo(document.foto.width+50,document.foto.height+80)" alt=""></a></CENTER>\n</BODY>\n</HTML>';

	features = "toolbar=0, location=0, directories=0, menuBar=0, scrollbars=1, resizable=1, top=10, left=10";

	NW = window.open('','_blank',features);
	NW.document.open();

	NW.document.write(Fhtml);
	NW.document.close()
}

function thumb3(Pmaxi,Img) {
	 document.write('<A HREF="javascript:Maxi(\''+Pmaxi+'/'+Img+'\')"><IMG SRC="'+Pmaxi+'/thumbs/'+Img+'" HSPACE=0 VSPACE=0  ALT="Clicca qui per ingrandire la foto"></A>');}

function thumb(Fmaxi,Frid) {
	 document.write('<A HREF="javascript:Maxi(\''+Fmaxi+'\')"><IMG SRC="'+Frid+'" HSPACE=0 VSPACE=0  ALT="Clicca qui per ingrandire la foto"></A>');}

function Maxi(Fmaxi) {
	i1 = new Image;
	i1.src = Fmaxi;

//	Fhtml = '<HTML>\n<HEAD>\n<TITLE>Foto</TITLE>\n<LINK REL="shortcut icon" HREF="'+window.location.protocol+'//'+window.location.hostname+'/vernole-comunedi/img/favicon.ico" TYPE="image/x-icon">\n</HEAD>\n<BODY >\n<CENTER><a href="javascript:self.close()"><IMG SRC="'+Fmaxi+'" BORDER=0 NAME=foto onLoad="window.resizeTo(document.foto.width+50,document.foto.height+80)" alt=""></a></CENTER>\n</BODY>\n</HTML>';
	Fhtml = '<HTML>\n<HEAD>\n<TITLE>Foto</TITLE>\n<LINK REL="shortcut icon" HREF="'+window.location.protocol+'//www.'+window.location.hostname+'/img/favicon.ico" TYPE="image/x-icon">\n</HEAD>\n<BODY >\n<CENTER><a href="javascript:self.close()"><IMG SRC="'+Fmaxi+'" BORDER=0 NAME=foto onLoad="window.resizeTo(document.foto.width+50,document.foto.height+80)" alt=""></a></CENTER>\n</BODY>\n</HTML>';
	features = "toolbar=0, location=0, directories=0, menuBar=0, scrollbars=1, resizable=1, top=10, left=10";

	NW = window.open('','_blank',features);
	NW.document.open();

	NW.document.write(Fhtml);
	NW.document.close()
}


function formatText(el,tag){
	var selectedText = document.selection?document.selection.createRange().text:el.value.substring(el.selectionStart,el.selectionEnd);

	if(selectedText!=''){
		switch (tag){
			case 'a':
			        var newText='<a href=\"http://'+selectedText+'\">'+selectedText+'</a>'; 
			break;

			case 'b':
			        var newText='<span class=\"grassetto\">'+selectedText+'</span>'; 
			break;

			case 'i':
			        var newText='<'+tag+'>'+selectedText+'</'+tag+'>';
			break

			case 'u':
			        var newText='<'+tag+'>'+selectedText+'</'+tag+'>'; 
			break;

			case 'r':
			        var newText='<span class=\"rosso\">'+selectedText+'</span>'; 
			break;

			case 't':
			        var newText='<!-- Allineati e centrati -->\n<table border=\"0\" width=\"90%\" align=\"center\"><tr><td align=\"center\">\n<!-- testo a sinistra -->\n'+selectedText+'\n</td><td align=\"center\">\n<!-- testo a destra -->\n'+selectedText+'\n</td></tr></table>';
			break;

			case 'sx':
			        var newText='<div class=\"txsinistra\">'+selectedText+'</div>';
			break;

			case 'c':
			        var newText='<div class=\"center\">'+selectedText+'</div>'; 
			break;

			case 'dx':
			        var newText='<div class=\"txdestra\">'+selectedText+'</div>'; 
			break;

			case 'j':
			        var newText='<div class=\"txjust\">'+selectedText+'</div>'; 
			break;

		}
		el.value=el.value.replace(selectedText,newText)
	}
}

// protocol//host:port/pathname#hash?search.
function ricaricaG(n0pzione) {
	var link=window.location.protocol+'//'+window.location.hostname+'/index.php?ModificaGr='+n0pzione; 
//	var link='http://localhost/vernole-comunedi/index.php?ModificaGr='+n0pzione; 
	window.open(link,'_self','');
}

function ricaricaA(n0pzione) {
		if(n0pzione!=''){
		var link= window.location.protocol+'//'+window.location.hostname+'/pagine.php?m0d=Riservato&area='+n0pzione;  
//		var link='http://localhost/vernole-comunedi/pagine.php?m0d=Riservato&area='+n0pzione;  
		window.open(link,'_self','');
	}

}


function MM_preloadImages() {	 //v3.0
var d=document;
if(d.images){
if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){
d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() {	 //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() {  //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){
document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

