function TNMSLogin() {
	var WinAdmin;
	
	WinWidth = screen.availWidth;
	WinHeight = screen.availHeight;
	fullscreen = "no";
	
    WinAdmin = window.open("admin/access.php", "WinAdmin", "top=0, left=0, width="+ WinWidth +", height="+ WinHeight + ", fullscreen=" + fullscreen + ", status=yes, toolbar=no, menubar=no, location=yes, resizable=yes, scrollbars=yes", false);
	WinAdmin.focus();
}

function inithome_______() {
	loadmynews('','','','');
	loadmynotes();
	
	//setCookieMySearch("tnmsNotes","");
}
function viewpopup(){

	Height=document.body.clientHeight;
	Width=document.body.clientWidth;
	//alert (Width + " : "+ Height);

	if (popBanner=document.getElementById("POPUPBANNER") ){
	
		popBanner.style.width="600px";
		popBanner.style.left=(Width/2-300)+"px";
		popBanner.style.display='inline';
		
		//OpacityDiv("container",40);
		//OpacityDiv("POPUPBANNER",100);
	}


}
function OpacityDiv(idDiv,value){

		document.getElementById(idDiv).style.opacity=(value/100);
		document.getElementById(idDiv).style.MozOpacity = (value/100);
		document.getElementById(idDiv).style.KhtmlOpacity = (value/100);
		document.getElementById(idDiv).style.filter = "alpha(opacity=" + value + ")";		

}

function addNewsatNotes(IDNEWS){
	/**/
	readtnmsNotes=readCookie("tnmsNotes");
	strID="id"+IDNEWS+"n";
	if (readtnmsNotes.search(strID)>-1){
		ResetIdNewsatNotes(IDNEWS);
	} else{
		//if (readtnmsNotes!="") readtnmsNotes=readtnmsNotes.replace(" ",","); 
		setCookieMySearch("tnmsNotes",readtnmsNotes + "id" + IDNEWS + "n");
		document.getElementById("star"+IDNEWS).src="images/icone/star.png"
		//document.Navigator.ListIdNotes.value=document.Navigator.ListIdNotes.value + IDNEWS +",";
		ListIdNotes="";//document.Navigator.ListIdNotes.value;
		loadmynotes();	
	}
	
}
function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
 
  return [ scrOfX, scrOfY ];
}
function maketooltip(thumbNameP,NewsId,val,e){
	var IE = document.all?true:false
	if (!IE) document.captureEvents(Event.MOUSEMOVE)

	myScroll=getScrollXY();

	if (IE) { // grab the x-y pos.s if browser is IE
	tempX = event.clientX + myScroll[0];
	tempY = event.clientY + myScroll[1];
	} else {  // grab the x-y pos.s if browser is NS
	tempX = e.pageX
	tempY = e.pageY
	} 

	if (val){
		document.getElementById("tooltip").style.display="inline";
		
	} else {
		
		document.getElementById("tooltip").style.display="none";
	} 
	document.getElementById("tooltip").style.top=tempY-10;
	document.getElementById("tooltip").style.left=tempX+10;
	document.getElementById("tooltip").innerHTML="<img src='"+ thumbNameP +"'>";
}
function ShowPDFinDIV(AttachHomeNews,id,e){
	if (document.getElementById(id)){
	
	} else {
		var IE = document.all?true:false
		if (!IE) document.captureEvents(Event.MOUSEMOVE)
	
		myScroll=getScrollXY();

		if (IE) { // grab the x-y pos.s if browser is IE
		tempX = event.clientX + myScroll[0];
		tempY = event.clientY + myScroll[1];
		} else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX
		tempY = e.pageY
		} 


		var box = document.getElementById('BodyGen');
		today = new Date()
		//id=today.getHours()+today.getMinutes()+today.getSeconds();

		var a = document.createElement('div');
		box.appendChild(a);


		a.setAttribute("style", "position:absolute;font-size:32px;height:600px;width:500px;border:1px solid #0000ff;left:"+(tempX+30)+"px;top:"+(tempY-300)+"px;");	
		a.setAttribute("id", "pdf"+id);
		a.style.cssText = "position:absolute;font-size:32px;height:650px;width:550px;background:#ffffff;border:10px solid #7C99E2;left:"+(tempX+30)+"px;top:"+(tempY-300)+"px;";

		a.innerHTML = "<a href=javascript:closePDFinDIV('pdf"+id+"');>news</a><iframe src='"+AttachHomeNews+"' width='500px' height='600px'></iframe>";
		//mywinDiv = document.createElement("div");
		//x=document.getElementsByTagName("DIV")[0];
		//x.appendChild(mywinDiv);
		//mywinDiv.setAttribute("style", "position:absolute;font-size:32px;height:600px;width:500px;border:1px solid #0000ff;left;100px;top:100px;");	
	}
	
}
function closePDFinDIV(id){
	document.getElementById(id).style.display="none";
}

function ResetNewsatNotes(){

	readtnmsNotes=readCookie("tnmsNotes");
	//alert(readtnmsNotes);
	arraytnmsNotes=readtnmsNotes.split("n");
	arrayreadtnmsNotes = readtnmsNotes.split("n");
	arrayreadtnmsNotesCount = arrayreadtnmsNotes.length;
	for (n = 0; n < (arrayreadtnmsNotesCount-1); n++) {
		myIdNewsSTR=arrayreadtnmsNotes[n];
		myIdNews=myIdNewsSTR.replace("id","");
		if (document.getElementById("star"+myIdNews)){
			document.getElementById("star"+myIdNews).src="images/icone/star_grey.png";
		}
	}

	setCookieMySearch("tnmsNotes","");
	loadmynotes("");
}
function ResetIdNewsatNotes(NewsId){
	readtnmsNotes=readCookie("tnmsNotes");
	readtnmsNotes=readtnmsNotes.replace("id"+NewsId+"n","");
	setCookieMySearch("tnmsNotes",readtnmsNotes);
	if (document.getElementById("star"+NewsId)) document.getElementById("star"+NewsId).src="images/icone/star_grey.png"
	loadmynotes();
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return "";
}


function openDiv(pag,XSize,YSize){
	//opacity=100;
/*	
	document.getElementById("Body").style.display="inline";
	document.getElementById("BodyGen").style.opacity=0.45;
	document.getElementById("BodyGen").style.MozOpacity = 0.45;
	document.getElementById("BodyGen").style.KhtmlOpacity = 0.45;
	document.getElementById("BodyGen").style.filter = "alpha(opacity=45)";
	

	if (XSize==0) XSize=55;
	if (YSize==0) YSize=65;	

	var altezza = window.screen.height;
    var larghezza = window.screen.width;
	//alert(larghezza);
	if (larghezza<1280) {
		XSize=XSize+10;
		YSize=YSize+10;
	}
	
	
	marginTop=10;
	document.getElementById("Body").style.width=XSize+"%";
	document.getElementById("Body").style.marginTop=marginTop+"%";


	marginLeft=(100-XSize)/2;
	document.getElementById("Body").style.marginLeft=marginLeft+"%";
	document.getElementById("Body").style.height=YSize+"%";
*/
	//window.Body.focus();
	var oXmlHttp = zXmlHttp.createRequest();
	
	//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
	document.getElementById("Body").innerHTML="<p align='center' height='100%'><br><br><br><br><br><br><img src='images/loading.gif'></p>";
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
			//alert("Got response.");
			document.getElementById("Body").innerHTML=oXmlHttp.responseText;
		}
	}
	oXmlHttp.open("GET", pag+ "?rand=" + Math.floor(Math.random() * 1000000), true);
	
	oXmlHttp.send('');	
	
}

function openSpace(pag,TagName,XSize,YSize){
	if (document.getElementById(TagName).style.display=="inline"){
		document.getElementById(TagName).style.display="none";
		
	} else {
		
		document.getElementById(TagName).style.display="inline";
		
		
	}
	/**/
	var oXmlHttp = zXmlHttp.createRequest();
	
	//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
	document.getElementById(TagName).innerHTML="<p align='center' height='100%'><br><br><br><br><br><br><img src='images/loading.gif'></p>";
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
			//alert("Got response.");
			document.getElementById(TagName).innerHTML=oXmlHttp.responseText;
		}
	}
	oXmlHttp.open("GET", pag+ "?rand=" + Math.floor(Math.random() * 1000000), true);
	
	oXmlHttp.send('null');	
	
}
function register(){
	openSpace('utility/iscrizione.php','FormIscrizione',60,80);
}

function pagesite(pag,Capitolo,Paragrafo){

	var oXmlHttp = zXmlHttp.createRequest();
	document.getElementById("Body").innerHTML="<p align='center' height='100%'><br><br><br><br><br><br><img src='images/loading.gif'></p>";
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
			//alert("Got response.");
			document.getElementById("Body").innerHTML=oXmlHttp.responseText;
		}
	}
	oXmlHttp.open("GET", pag+ "?Capitolo="+ Capitolo +"&Paragrafo="+Paragrafo+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	oXmlHttp.send('null');	

	var oXmlHttp2 = zXmlHttp.createRequest();
	document.getElementById("Paragrafo").innerHTML="<p align='center' height='100%'><br><br><br><br><br><br><img src='images/loading.gif'></p>";
	oXmlHttp2.onreadystatechange = function () {
		if (oXmlHttp2.readyState == 4 && (oXmlHttp2.status == 200 || oXmlHttp2.status == 304)) {
			//alert("Got response.");
			document.getElementById("Paragrafo").innerHTML=oXmlHttp2.responseText;
		}
	}
	oXmlHttp2.open("GET", "menu/menu-tnms.php?Capitolo="+ Capitolo +"&Paragrafo="+Paragrafo+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	oXmlHttp2.send('null');	

}


function loadmenu(Capitolo,Paragrafo){

	var oXmlHttp = zXmlHttp.createRequest();
	document.getElementById("Paragrafo").innerHTML="<p align='center' height='100%'><br><br><br><br><br><br><img src='images/loading.gif'></p>";
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
			//alert("Got response.");
			document.getElementById("Paragrafo").innerHTML=oXmlHttp.responseText;
		}
	}
	oXmlHttp.open("GET", "menu/menu-tnms.php?Capitolo="+ Capitolo +"&Paragrafo="+Paragrafo+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	oXmlHttp.send('null');	


}


function openDivCom(idComm){
	if (document.getElementById("VievComm"+idComm).style.display=="inline"){
		document.getElementById("VievComm"+idComm).style.display="none";
	} else {
		document.getElementById("VievComm"+idComm).style.display="inline";
	}

}


function openCloseDiv(TagName){
	if (document.getElementById(TagName).style.display=="inline"){
		document.getElementById(TagName).style.display="none";
	} else {
		document.getElementById(TagName).style.display="inline";
	}

}

function LoadlistUserByGroup(IdGroup){
	sessName=document.Navigator2.sessName.value;
	
	if (document.getElementById("listUserByGroup"+IdGroup).style.display=="inline"){
		document.getElementById("listUserByGroup"+IdGroup).style.display="none";
		document.getElementById("cell"+IdGroup).style.background="#ffffff";
	} else {
		document.getElementById("listUserByGroup"+IdGroup).style.display="inline";
		document.getElementById("cell"+IdGroup).style.background="#ffff00";
		var oXmlHttp = zXmlHttp.createRequest();
		oXmlHttp.open("GET", "board/user/getlistbygroup.php?IdGroup="+IdGroup+"&sessName="+sessName+"&rand=" + Math.floor(Math.random() * 1000000), true);
		
		//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
		document.getElementById("listUserByGroup"+IdGroup).innerHTML="<p align='center' height='100%'><img src='images/loading.gif'></p>";
		oXmlHttp.onreadystatechange = function () {
			if (oXmlHttp.readyState == 4) {
				//alert("Got response.");
				document.getElementById("listUserByGroup"+IdGroup).innerHTML=oXmlHttp.responseText;
			}
		}
		
		oXmlHttp.send(null);	


	}

	
	
}


function ViewBtnIscr(){
//alert(document.iscrizione.privacy.value);
	if (document.getElementById("BTNRECUSR").style.display=="none"){
		document.getElementById("BTNRECUSR").style.display="inline";
	} else {
		document.getElementById("BTNRECUSR").style.display="none";
	}
}

function AddComment(NewsId,edizione,sessName){
		WindowComment=window.open('utility/addcomment.php?NewsId='+NewsId+'&edizione='+edizione+'&sessName='+sessName, 'WinComment', 'width=500,height=400,scrollbars=yes,resizable=no,location=no,menubar=no,status=no');
}


function basename(path){
    var filename = path.split('/');
    if (filename.length == 1) {
        var filename = path.split("\\");    
    }
    filename = filename[filename.length-1];
    return filename;
}

function AddNameAttach(){
	NameAttach=document.formAttach.NameAttach.value;
	path=document.formAttach.attach.value;
	namefile=basename(path);
	if (NameAttach.length<2){
		document.formAttach.NameAttach.value=namefile;
	}
}


function DelAttach(idAttach,action){
	document.getElementById("ImgAt"+idAttach).style.opacity=0.1;
	document.getElementById("ImgAt"+idAttach).style.MozOpacity = 0.1;
	document.getElementById("ImgAt"+idAttach).style.KhtmlOpacity = 0.1;
	document.getElementById("ImgAt"+idAttach).style.filter = "alpha(opacity=10)";
	
	var oXmlHttp = zXmlHttp.createRequest();
	
	//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
	document.getElementById("MsgConf").innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
		//document.getElementById("resAttach").innerHTML=oXmlHttp.responseText;
		document.getElementById("MsgConf").innerHTML=oXmlHttp.responseText;
		tempvar=document.getElementById("MsgConf").innerHTML;
		//alert(tempvar.lastIndexOf("DEL OK"));
			if (tempvar.lastIndexOf("DEL OK")>-1){
				document.getElementById("ImgAt"+idAttach).style.height=0;
				document.getElementById("ImgAt"+idAttach).style.width=0;
				Temp=document.newsletter.IdAttach.value;
				document.newsletter.IdAttach.value= Temp.replace("id_"+idAttach+",", "");
				document.getElementById("MsgConf").innerHTML="";				
			} 
		}
	}
	oXmlHttp.open("GET", "board/newsletter/delattach.php?idattach="+idAttach+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	
	oXmlHttp.send('null');		
}

function CopyAttach(imgAttach){
	clipboardData.setData("text", imgAttach);
	//window.clipboardData.getData(imgAttach);
	//document.newsletter.firstAttach.value=imgAttach;
	//alert(imgAttach);
}

function AttachHome(imgAttach,idAttach){
	document.newsletter.firstAttach.value=imgAttach;
	//for (){
	idAttachSel=document.newsletter.idAttachSel.value;
	if (document.getElementById("ImgAt"+idAttachSel)){
		document.getElementById("ImgAt"+idAttachSel).style.borderWidth=1;
		document.getElementById("ImgAt"+idAttachSel).style.borderColor="#000000"; 		
	}	
	document.newsletter.idAttachSel.value=idAttach;
	document.getElementById("ImgAt"+idAttach).style.borderWidth=3;
	document.getElementById("ImgAt"+idAttach).style.borderColor="#ff0000"; 
	document.getElementById("ImgAt"+idAttach).style.opacity=1;
	document.getElementById("ImgAt"+idAttach).style.MozOpacity = 1;
	document.getElementById("ImgAt"+idAttach).style.KhtmlOpacity = 1;
	document.getElementById("ImgAt"+idAttach).style.filter = "alpha(opacity=100)";
	document.getElementById("MsgConf").innerHTML="";

	//}
}

function removeAttachHome(){
	idAttachSel=document.newsletter.idAttachSel.value;
	if (document.getElementById("ImgAt"+idAttachSel)){
		document.getElementById("ImgAt"+idAttachSel).style.borderWidth=1;
		document.getElementById("ImgAt"+idAttachSel).style.borderColor="#000000"; 		
	}
	if (document.newsletter.firstAttach.value!=""){
		document.newsletter.temp.value=document.newsletter.firstAttach.value;
	}
	document.newsletter.firstAttach.value="";

}	
function ripristinaAttach(){
	idAttachSel=document.newsletter.idAttachSel.value;
	if (document.getElementById("ImgAt"+idAttachSel)){
		document.getElementById("ImgAt"+idAttachSel).style.borderWidth=3;
		document.getElementById("ImgAt"+idAttachSel).style.borderColor="#ff0000"; 		
	}


	if (document.newsletter.firstAttach.value==""){
		document.newsletter.firstAttach.value=document.newsletter.temp.value;
	}
}

function DelDownload(idDownload,action){
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "deldownload.php?idDownload="+idDownload+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("DelDownload"+idDownload).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("DelDownload"+idDownload).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}


function Cancel(idAttach){
	document.getElementById("ImgAt"+idAttach).style.opacity=1;
	document.getElementById("ImgAt"+idAttach).style.MozOpacity = 1;
	document.getElementById("ImgAt"+idAttach).style.KhtmlOpacity = 1;
	document.getElementById("ImgAt"+idAttach).style.filter = "alpha(opacity=100)";
	document.getElementById("MsgConf").innerHTML="";
}
function closeDiv(){
	//opacity=100;
	document.getElementById("Body").innerHTML="";
	document.getElementById("Body").style.display="none";
	document.getElementById("BodyGen").style.opacity=1;
	document.getElementById("BodyGen").style.MozOpacity = 1;
	document.getElementById("BodyGen").style.KhtmlOpacity = 1;
	document.getElementById("BodyGen").style.filter = "alpha(opacity=100)";
}

function openNews(idNews){
	document.getElementById("Body").style.display="inline";
	document.getElementById("BodyGen").style.opacity=0.1;
	document.getElementById("BodyGen").style.MozOpacity = 0.1;
	document.getElementById("BodyGen").style.KhtmlOpacity = 0.1;
	document.getElementById("BodyGen").style.filter = "alpha(opacity=10)";

		var oXmlHttp = zXmlHttp.createRequest();
		
		oXmlHttp.open("GET", "viewnews.php?idNews="+idNews+"&rand=" + Math.floor(Math.random() * 1000000), true);
		
		//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
		
		oXmlHttp.onreadystatechange = function () {
		    if (oXmlHttp.readyState == 4) {
		        //alert("Got response.");
				document.getElementById("Body").innerHTML=oXmlHttp.responseText;
		    }
		}
		
		oXmlHttp.send();	
	
}

function RecUser(pag,TagName){
	//opacity=100;
	Nome=document.iscrizione.Nome.value;
	Cognome=document.iscrizione.Cognome.value;
	Sesso=document.iscrizione.Sesso.value;
	Educational=document.iscrizione.Educational.value;
	Ente=document.iscrizione.Ente.value;
	City=document.iscrizione.City.value;
	Email=document.iscrizione.Email.value;
	JobTitle=document.iscrizione.JobTitle.value;
	Telefono=document.iscrizione.Telefono.value;
	Member=document.iscrizione.Member.checked;
	
	if (document.iscrizione.Member.checked==true){
		Member=1;
	} else {
		Member=0;
	}
	Club=document.iscrizione.Club.value;
	Circoscrizione=document.iscrizione.Circoscrizione.value;
	Distretto=document.iscrizione.Distretto.value;
	Carica=document.iscrizione.Carica.value;
	/*
	document.getElementById("Body").style.display="inline";
	document.getElementById("BodyGen").style.opacity=0.1;
	document.getElementById("BodyGen").style.MozOpacity = 0.1;
	document.getElementById("BodyGen").style.KhtmlOpacity = 0.1;
	document.getElementById("BodyGen").style.filter = "alpha(opacity=10)";
	*/
	document.getElementById(TagName).innerHTML="<img src='images/loading.gif'>";
	var oXmlHttp = zXmlHttp.createRequest();
	
	oXmlHttp.open("GET", pag+ "?Nome="+Nome+"&Cognome="+Cognome+"&Sesso="+Sesso+"&Educational="+Educational+"&Ente="+Ente+"&City="+City+"&Email="+Email+"&JobTitle="+JobTitle+"&Telefono="+Telefono+"&Member="+Member+"&Club="+Club+"&Circoscrizione="+Circoscrizione+"&Distretto="+Distretto+"&Carica="+Carica+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
	
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4) {
			//alert("Got response.");
			document.getElementById(TagName).innerHTML=oXmlHttp.responseText;
		}
	}
	
	oXmlHttp.send('null');	
	
}


function RecNewsAlert(){
	//opacity=100;
	keywordRecNewsAlert=document.FormRecNewsAlert.keywordRecNewsAlert.value;
	emailRecNewsAlert=document.FormRecNewsAlert.emailRecNewsAlert.value;

	document.getElementById("MsgRecNewsAlert").innerHTML="<img src='images/loading.gif'>";
	var oXmlHttp = zXmlHttp.createRequest();
	
	oXmlHttp.open("GET", "utility/recnewsalert.php?keywordRecNewsAlert="+keywordRecNewsAlert+"&emailRecNewsAlert="+emailRecNewsAlert+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
	
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4) {
			//alert("Got response.");
			
			document.getElementById("MsgRecNewsAlert").innerHTML=oXmlHttp.responseText;
			//openDiv('utility/iscrizione.php',60,80)
			
		}
	}
	
	oXmlHttp.send('null');	
	
}

function SearchClubs(){
		SearchClub=document.iscrizione.SearchClub.value;
		if (SearchClub == "") {
			document.iscrizione.Club.value=0;
			document.iscrizione.Circoscrizione.value=0;
		}
		var oXmlHttp = zXmlHttp.createRequest();
		oXmlHttp.open("GET", "searchclub.php?SearchClub="+SearchClub+"&action=0&rand=" + Math.floor(Math.random() * 1000000), true);
		//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
		oXmlHttp.onreadystatechange = function () {
		    if (oXmlHttp.readyState == 4) {
		        //alert("Got response.");
				document.getElementById("CircSel").innerHTML=oXmlHttp.responseText;
		    }
		}
		
		oXmlHttp.send();	
	
}

function SelectZone(idClub){
		
		var oXmlHttp = zXmlHttp.createRequest();
		oXmlHttp.open("GET", "searchclub.php?idClub="+idClub+"&action=1&rand=" + Math.floor(Math.random() * 1000000), true);
		//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
		oXmlHttp.onreadystatechange = function () {
		    if (oXmlHttp.readyState == 4) {
		        //alert("Got response.");
				elemento=oXmlHttp.responseText;
				x=elemento.split(";");
				id = x[0];
				ClubName = x[1];
				document.iscrizione.Circoscrizione.value=id*1;
				document.iscrizione.Club.value=idClub;
				document.iscrizione.SearchClub.value=ClubName;
				document.iscrizione.Distretto.value="108L";
				//document.getElementById("myClub").innerHTML="Club: " + Club;
		    }
		}
		
		oXmlHttp.send();	
	
}
function SelectDistretto(CodDistretto){
	if (CodDistretto != "108L" ) {
		//alert("Got response.");
		//document.getElementById("CircSel").innerHTML=" Info Club ";
		document.iscrizione.ClubSuggest.value=0;
		document.iscrizione.Club.value=0;
		document.iscrizione.SearchClub.value="";
		document.iscrizione.Circoscrizione.value=0;
	} else {
		document.iscrizione.SearchClub.value="";
		SearchClubs();
		document.iscrizione.Distretto.value="108L";
	}
}


function controlFormRec() {
	//alert("dateconf: " + dateconf);
	Nome=document.iscrizione.Nome.value;
	Cognome=document.iscrizione.Cognome.value;
	Sesso=document.iscrizione.Sesso.value;
	Educational=document.iscrizione.Educational.value;
	City=document.iscrizione.City.value;
	Email=document.iscrizione.Email.value;
	Email2=document.iscrizione.Email2.value;
	JobTitle=document.iscrizione.JobTitle.value;
	Telefono=document.iscrizione.Telefono.value;
	Member=document.iscrizione.Member.value;
	Club=document.iscrizione.Club.value;
	Circoscrizione=document.iscrizione.Circoscrizione.value;
	if (document.iscrizione.privacy.checked==true){
		privacy=1;
	} else {
		privacy=0;
	}	
	//alert(name);
	
	if (Nome == "") {
		alert("Inserisci Nome.");
		document.iscrizione.Nome.focus();
		return false;
	}
	if (Cognome == "") {
		alert("Inserisci Cognome.");
		document.iscrizione.Cognome.focus();
		return false;
	}	
	if (Email == "") {
		alert("Inserisci Email.");
		document.iscrizione.Email.focus();
		return false;
	}
	if (Email != Email2) {
		alert("Controlla Email");
		document.iscrizione.Email.focus();
		return false;
	}	
	if (Telefono == "") {
		alert("Inserisci Telefono");
		document.iscrizione.Email.focus();
		return false;
	}
	if (privacy == 0) {
		alert("Confermare l'autorizzazione al trattamento dei dati personali");
		document.iscrizione.privacy.checked=true;
		return false;
	}		
	return true;
	
}

function controlFormEditor() {
	//alert("dateconf: " + dateconf);
	Argomento=document.newsletter.Argomento.value;
	title=document.newsletter.title.value;
	abstract=document.newsletter.abstract.value;
	//alert(name);
	
	if (Argomento == "0") {
		alert("Inserisci Argomento.");
		document.newsletter.Argomento.focus();
		return false;
	}
	if (title == "") {
		alert("Inserisci Titolo della news.");
		document.newsletter.title.focus();
		return false;
	}
	if (abstract == "") {
		alert("Inserisci Abstract della news.");
		document.newsletter.abstract.focus();
		return false;
	}	
	return true;
	
}
function ctrlFormDownload() {
	//alert("dateconf: " + dateconf);
	areadownload=document.formAttach.areadownload.value;
	NameAttach=document.formAttach.NameAttach.value;
	attach=document.formAttach.attach.value;
	//alert(name);
	
	if (areadownload == 0) {
		alert("Seleziona Area Download");
		document.formAttach.areadownload.focus();
		return false;
	}
	if (NameAttach == "") {
		alert("Inserisci Nome Attach.");
		document.formAttach.NameAttach.focus();
		return false;
	}	
	if (attach == "") {
		alert("Scegli File da Caricare");
		document.formAttach.attach.focus();
		return false;
	}	
	return true;
	
}

function SendAttach(pag){
	//opacity=100;
	attach=document.formAttach.attach.value;
	
	var oXmlHttp = zXmlHttp.createRequest();
	
	oXmlHttp.open("POST", pag+ "?attach="+attach+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
	
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4) {
			//alert("Got response.");
			document.getElementById("AllegatiDiv").innerHTML=oXmlHttp.responseText;
		}
	}
	alert(oXmlHttp.responseText);
	oXmlHttp.send();	
	
}

function SelectEdition(){
	if (document.getElementById("OldEdition").style.display=="inline"){
		document.getElementById("OldEdition").style.display="none";
	} else {
		document.getElementById("OldEdition").style.display="inline";
	}
}

function SelectDiv(TagName){
	if (document.getElementById(TagName).style.display=="inline"){
		document.getElementById(TagName).style.display="none";
		//OpacityDiv("BodyGen",100);
	} else {
		//OpacityDiv("BodyGen",100);
		document.getElementById(TagName).style.display="inline";
		
		
	}
}

function SendOneMail(IdNews,action) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/newsletter/sendonemail.php?IdNews="+IdNews+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("Send"+IdNews).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("Send"+IdNews).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}

function MailAtFriend_old(IdNews,action) {
	/*
	document.getElementById("Body").style.display="inline";
	document.getElementById("BodyGen").style.opacity=0.45;
	document.getElementById("BodyGen").style.MozOpacity = 0.45;
	document.getElementById("BodyGen").style.KhtmlOpacity = 0.45;
	document.getElementById("BodyGen").style.filter = "alpha(opacity=45)";
	

	XSize=40;
	YSize=45;	

	var altezza = window.screen.height;
    var larghezza = window.screen.width;
	//alert(larghezza);
	if (larghezza<1280) {
		XSize=XSize+10;
		YSize=YSize+10;
	}
	//window.focus();
	Body.focus();
	
	marginTop=10;
	document.getElementById("Body").style.width=XSize+"%";
	document.getElementById("Body").style.marginTop=marginTop+"%";
	*/
	mailfriend="";
	yourmail="";
	if (action==1) {
		mailfriend=document.formfriend.mailfriend.value;
		yourmail=document.formfriend.yourmail.value;
	}
	//marginLeft=(100-XSize)/2;
	//document.getElementById("Body").style.marginLeft=marginLeft+"%";
	//document.getElementById("Body").style.height=YSize+"%";

	var oXmlHttp = zXmlHttp.createRequest();
	document.getElementById("ListAttach"+IdNews).style.display="inline";
	document.getElementById("ListAttach"+IdNews).style.border="1px dashed #666666";
	document.getElementById("ListAttach"+IdNews).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
	        //alert("Got response.");
			document.getElementById("ListAttach"+IdNews).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.open("get", "mail_friend.php?IdNews="+IdNews+"&action="+action+"&mailfriend="+mailfriend+"&yourmail="+yourmail+"&rand=" + Math.floor(Math.random() * 1000000), true);
	oXmlHttp.send('null');
	
}
function MailAtFriend(IdNews,action) {
	
	mailfriend="";
	yourmail="";
	if (action==1) {
		mailfriend=document.formfriend.mailfriend.value;
		yourmail=document.formfriend.yourmail.value;
	}

	var oXmlHttp = zXmlHttp.createRequest();
	document.getElementById("AdvSearch").style.display="inline";
	document.getElementById("AdvSearch").style.border="1px dashed #666666";
	document.getElementById("AdvSearch").innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
	        //alert("Got response.");
			document.getElementById("AdvSearch").innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.open("get", "services/mail_friend.php?IdNews="+IdNews+"&action="+action+"&mailfriend="+mailfriend+"&yourmail="+yourmail+"&rand=" + Math.floor(Math.random() * 1000000), true);
	oXmlHttp.send('null');
	
}
function SendMail(action,EditionToSend) {

	//////////////////////////////////////////////
	//  LEGGE SELECT MULTIPLA PER SCELTA GRUPPI DI LAVORO
	ArrayGroup = new Array();
	chks=document.forms['SelGroupNews'].elements['Group[]'];
	//document.forms['SelGroupNews'].elements['Group[]'].options[1].selected
	var j=0;
	for (var i=0;i<chks.length;i++){
		if ( document.forms['SelGroupNews'].elements['Group[]'].options[i].selected ){
			ArrayGroup[j]=document.forms['SelGroupNews'].elements['Group[]'].options[i].value;
			j++;
		}
	}
	GroupNews=ArrayGroup.join(','); 

	//alert(GroupNews);
	///////////////////////////////////////////////
	
	postscriptum=document.form_ps.postscriptum.value;
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/newsletter/sendnewsletter.php?EditionToSend="+EditionToSend+"&action="+action+"&GroupNews="+GroupNews+"&postscriptum=" + postscriptum + "&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("MsgTesta").innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("MsgTesta").innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
	if (action==0){
		setTimeout("document.Navigator.submit();",1000);
	}
}

function PublicNews(IdNews,Public) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/newsletter/publicnews.php?IdNews="+IdNews+"&Public="+Public+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("Block"+IdNews).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("Block"+IdNews).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}
function statusNews(IdNews,myLevel,action) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/newsletter/statusnews.php?IdNews="+IdNews+"&myLevel="+myLevel+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("Block"+IdNews).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("Block"+IdNews).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}

function EnableGroup(IdGroup,Public) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/user/enablegroup.php?IdGroup="+IdGroup+"&Public="+Public+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("Block"+IdGroup).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("Block"+IdGroup).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}

function DelNews(IdNews,action) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/newsletter/delnews.php?IdNews="+IdNews+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("DelNews"+IdNews).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("DelNews"+IdNews).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}

function DelGroup(IdGroup,action) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/user/delgroup.php?IdGroup="+IdGroup+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("DelGroup"+IdGroup).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("DelGroup"+IdGroup).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}

function ModifyGroup(IdGroup,NameGroup,action) {
	//NameGroup=document.ModifyGroup.NameGroup.value;
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/user/modifygroup.php?IdGroup="+IdGroup+"&NameGroup="+NameGroup+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("ModifyGroup"+IdGroup).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("ModifyGroup"+IdGroup).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}

function PublicComm(IdComm,Autorize) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/commenti/publiccomm.php?IdComm="+IdComm+"&Autorize="+Autorize+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("Block"+IdComm).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("Block"+IdComm).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}

function DelComm(IdComm,action) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/commenti/delcomm.php?IdComm="+IdComm+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("DelComm"+IdComm).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("DelComm"+IdComm).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}

function SelectRights(IdUser,myRights,action) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/user/selectrights.php?IdUser="+IdUser+"&myRights="+myRights+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("SelectRights"+IdUser).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("SelectRights"+IdUser).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}

function DelUser(IdUser,action) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/user/deluser.php?IdUser="+IdUser+"&action="+action+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("DelUser"+IdUser).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("DelUser"+IdUser).innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}


function sendpwd(){
	
	email=document.HelpUser.youremail.value;
	/*
	document.getElementById("Body").style.display="inline";
	document.getElementById("BodyGen").style.opacity=0.1;
	document.getElementById("BodyGen").style.MozOpacity = 0.1;
	document.getElementById("BodyGen").style.KhtmlOpacity = 0.1;
	document.getElementById("BodyGen").style.filter = "alpha(opacity=10)";
	*/
	var oXmlHttp = zXmlHttp.createRequest();
	
	oXmlHttp.open("GET", "services/sendpwd.php?email="+email+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
	document.getElementById("MsgAdmin").innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4) {
			//alert("Got response.");
			document.getElementById("MsgAdmin").innerHTML=oXmlHttp.responseText;
		}
	}
	
	oXmlHttp.send('null');	
	
}

function DeleteEmail(){
	
	email=document.HelpUser.youremail.value;
	/*
	document.getElementById("Body").style.display="inline";
	document.getElementById("BodyGen").style.opacity=0.1;
	document.getElementById("BodyGen").style.MozOpacity = 0.1;
	document.getElementById("BodyGen").style.KhtmlOpacity = 0.1;
	document.getElementById("BodyGen").style.filter = "alpha(opacity=10)";
	*/
	var oXmlHttp = zXmlHttp.createRequest();
	
	oXmlHttp.open("GET", "services/deleteemail.php?email="+email+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
	document.getElementById("MsgAdmin").innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4) {
			//alert("Got response.");
			document.getElementById("MsgAdmin").innerHTML=oXmlHttp.responseText;
		}
	}
	
	oXmlHttp.send('null');	
	
}


function openListAttach(idNews) {
		document.getElementById("ListAttach"+idNews).style.display="inline";
}
function closeListAttach(idNews) {
		document.getElementById("ListAttach"+idNews).style.display="none";
}


function openListDownload(area,Rights,SESSID){
	document.Navigator.areadownload.value=area;
	//alert(area);
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("GET", "listdownload.php?areadownload="+area+"&Rights="+Rights+"&SESSID="+SESSID+"&rand=" + Math.floor(Math.random() * 1000000), true);
	
	//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
	document.getElementById("listDownload").innerHTML="<p align='center' height='100%'><img src='images/loading.gif'></p>";
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
			//alert("Got response.");
			document.getElementById("listDownload").innerHTML=oXmlHttp.responseText;
		}
	}
	
	oXmlHttp.send(null);	
	
}
function openPreview(attachHome,id){
	if (attachHome==""){
		document.getElementById("icon"+id).innerHTML="";
	} else {
		var oXmlHttp = zXmlHttp.createRequest();
		pag="video_preview.php";
		oXmlHttp.open("GET", pag+ "?attachHome=" + attachHome + "&id=" + id + "&rand=" + Math.floor(Math.random() * 1000000), true);
		
		//oXmlHttp.setRequestHeader("Content-Type", "text/plain; charset=latin-iso8859-1");
		document.getElementById("icon"+id).innerHTML="<p align='center' height='100%'><br><br><br><br><br><br><img src='images/loading.gif'></p>";
		oXmlHttp.onreadystatechange = function () {
			if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
				//alert("Got response.");
				document.getElementById("icon"+id).innerHTML=oXmlHttp.responseText;
			}
		}
		
		oXmlHttp.send(null);	
	} 
}

function JoinReaderGroup(IdUser,IdGroup,Autorize) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/user/joinreadergroup.php?IdUser="+IdUser+"&IdGroup="+IdGroup+"&Autorize="+Autorize+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("Check_"+IdGroup+"_"+IdUser).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
	        //alert("Got response.");
			document.getElementById("Check_"+IdGroup+"_"+IdUser).innerHTML=oXmlHttp.responseText;
			//document.newsletter.queryGroup.value="INSERT INTO  Readers_Groups (idReader,idGroup) VALUES ";
	    }
	}
	oXmlHttp.send(null);
}

function groups_has_Autho(idAutho,IdGroup,Autorize) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/user/groups_has_Autho.php?idAutho="+idAutho+"&IdGroup="+IdGroup+"&Autorize="+Autorize+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("Check"+idAutho+"_"+IdGroup).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
	        //alert("Got response.");
			document.getElementById("Check"+idAutho+"_"+IdGroup).innerHTML=oXmlHttp.responseText;
			//document.newsletter.queryGroup.value="INSERT INTO  Readers_Groups (idReader,idGroup) VALUES ";
	    }
	}
	oXmlHttp.send(null);
}
function user_has_Autho(idAutho,IdUser,Autorize) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/user/user_has_Autho.php?idAutho="+idAutho+"&IdUser="+IdUser+"&Autorize="+Autorize+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("Check"+idAutho+"_"+IdUser).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
	        //alert("Got response.");
			document.getElementById("Check"+idAutho+"_"+IdUser).innerHTML=oXmlHttp.responseText;
			//document.newsletter.queryGroup.value="INSERT INTO  Readers_Groups (idReader,idGroup) VALUES ";
	    }
	}
	oXmlHttp.send(null);
}

function JoinReaderArgo(IdUser,IdArgo,Autorize) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "utility/joinreaderargo.php?IdUser="+IdUser+"&IdArgo="+IdArgo+"&Autorize="+Autorize+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("Check"+IdArgo).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
	        //alert("Got response.");
			document.getElementById("Check"+IdArgo).innerHTML=oXmlHttp.responseText;
			//document.newsletter.queryGroup.value="INSERT INTO  Readers_Groups (idReader,idGroup) VALUES ";
	    }
	}
	oXmlHttp.send(null);
}

/*   trasf admin.css
function getArtCorr(edition,flag){
	document.getElementById("ArtCorre").style.display="inline";
	document.getElementById("headerArtC").style.display="inline";
	if (flag==1){
		Search=document.advsearch.Search.value;
		alert(Search);
	}
	var listIdCorr=document.newsletter.listIdCorr.value;
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/newsletter/getlistart.php?edition="+edition+"&listIdCorr="+listIdCorr+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("ArtCorre").innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
	        //alert("Got response.");
			document.getElementById("ArtCorre").innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);
}*/
function getArtCorrFromSearch(edition){
	document.getElementById("ArtCorre").style.display="inline";
	document.getElementById("headerArtC").style.display="inline";
	Search=document.advsearch.Search.value;
	SearchOr=document.advsearch.SearchOr.value;
	SearchPhr=document.advsearch.SearchPhr.value;
	SearchNot=document.advsearch.SearchNot.value;
	DateFrom=document.advsearch.DateFrom.value;
	DateTo=document.advsearch.DateTo.value;
	
	var listIdCorr=document.newsletter.listIdCorr.value;
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "board/newsletter/getlistart.php?edition="+edition+"&listIdCorr="+listIdCorr+"&Search="+Search+"&SearchOr="+SearchOr+"&SearchPhr="+SearchPhr+"&SearchNot="+SearchNot+"&DateFrom="+DateFrom+"&DateTo="+DateTo+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("ArtCorre").innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("ArtCorre").innerHTML=oXmlHttp.responseText;
	    }
	}
	oXmlHttp.send(null);	
}
function addIdCorr(IdNews){		
	var strIdCorr='id:' + IdNews + ',';
	Title=document.getElementById("titleId"+IdNews).innerHTML;
	document.newsletter.listIdCorr.value=document.newsletter.listIdCorr.value.replace(strIdCorr,"");
	document.getElementById("titleNewsCorr").innerHTML=document.getElementById("titleNewsCorr").innerHTML.replace("- "+Title,"");
	//alert(document.getElementById("selId"+IdNews).style.color);
	if (document.getElementById("selId"+IdNews).innerHTML=="[v]"){
		document.getElementById("selId"+IdNews).style.color="#444444";
		document.getElementById("selId"+IdNews).innerHTML="[s]";
		document.getElementById("titleId"+IdNews).style.border="0px";
		document.getElementById("titleId"+IdNews).style.borderColor="#ffffff";
	} else {
		document.getElementById("selId"+IdNews).style.color="#FF0000";
		document.getElementById("titleId"+IdNews).style.border="1px solid #ff0000";
		document.getElementById("selId"+IdNews).innerHTML="[v]";
		document.newsletter.listIdCorr.value=document.newsletter.listIdCorr.value + strIdCorr;
		document.getElementById("titleNewsCorr").innerHTML=document.getElementById("titleNewsCorr").innerHTML + "<p style='margin:0px;padding:0px;color:#444;'>- " + Title + "</p>";
	}
	//document.newsletter.listIdCorr.value=document.newsletter.listIdCorr.value + 'id:' + IdNews + ',';

}


function GoPrint()
{
	var a = window.open('','','width=700,height=600,scrollbars=yes');
	a.document.open("text/html");
	a.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//IT" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n');
	a.document.write('<html xmlns="http://www.w3.org/1999/xhtml" lang="it">\n');
	a.document.write("<head>");
	//a.document.write("<link href='web/templates/standard/style.css' rel='stylesheet' type='text/css'>\n");
	//a.document.write("<link href='web/templates/standard/tnmscss.php' rel='stylesheet' type='text/css'>\n");	

	a.document.write("<link rel='STYLESHEET' type='text/css' href='web/templates/standard/css/tnmscss.php'");
	a.document.write("<link rel='STYLESHEET' type='text/css' href='web/templates/standard/css/fastlink.php'>");



	a.document.write("</head>");
	a.document.write("<body style='background:#ffffff;margin:10px;'>");
	//a.document.write("<hr size='1' color='#003399' width='100%'>");	
	//Title="<div><h3><font color='#ff0000'>"+document.exporttxt.Title.value+"</font></h3></div>";
	var data = new Date();
	var Hh, Mm;
	Hh = data.getHours();
	Mm = data.getMinutes();
	if (Mm<10) Mm="0"+Mm;

	var gg, mm, aaaa;
	gg = data.getDate();
	mm = data.getMonth() + 1;
	aaaa = data.getYear();
	if (mm<10) mm="0"+mm; 
	myData="" + gg + "/" + mm + "/" + aaaa + "  " + Hh + ":" + Mm;
	//ToolBar=document.getElementById("toolbartext").innerHTML;
	
	//HDiv1=document.getElementById("boxCaption").style.height;
	//HDiv2=document.getElementById("boxCaption").style.height;
	//alert(HDiv);
	TextIni=document.getElementById('div_article').innerHTML;
	//Text=TextIni.replace(ToolBar,Title);
	//Text=Text.replace("contentTextCaption",Title);
	HeaderP="<div style='height:70px;border-bottom:0px dashed #ccc;'>";
	HeaderP+="<img src='web/images/logo.jpg' align='left'>";
	//HeaderP+="<h3><?=K_NAME_NEWSLETTER?></h3>";
	HeaderP+="";
	HeaderP+="</div>";
	HeaderP+="<div style='clear:both;height:20px;text-align:right;border-bottom:1px dashed #ccc;'><i>" + myData + "</i></div>";
	
	HeaderP+="";
	
	FooterP="<div align=center style='margin-top:10px;font-family:Verdana;font-size:11px;color:#444;'>Questo notizia è stata creata con T-NMS<br/>Telpress News Managment System</div>";

	
	
	a.document.write("<div style='text-align:left;' id='div_article' >" + HeaderP + "<div id='Body'>" + TextIni + "</div>" + FooterP + "</div>");
	
	a.document.write("</body></html>");
	a.document.close();
	a.print();
}


function changeBtnSearch(){
	if (document.advsearch.searchwhere.checked==true){
		document.getElementById('Submitbtn').value='Ricerca nel Sito';
	} else {
		document.getElementById('Submitbtn').value='Ricerca Newsletter';
	}	
	
	
}


function SearchAuthor(){
		Autore=document.advsearch.Autore.value;
		document.getElementById("ListAuthor").style.display='inline';
		document.getElementById("closeListAutori").style.display='inline';
		
		/**/
		var oXmlHttp = zXmlHttp.createRequest();
		oXmlHttp.open("GET", "includes/searchauthor.php?Autore="+Autore+"&action=0&rand=" + Math.floor(Math.random() * 1000000), true);
		document.getElementById("ListAuthor").innerHTML="<img src='images/loading.gif'>";
		oXmlHttp.onreadystatechange = function () {
			if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
				document.getElementById("ListAuthor").innerHTML=oXmlHttp.responseText;
		    }
		}
		
		oXmlHttp.send(null);	
		
	
}

function copyAuthor(id){
	document.advsearch.Autore.value=document.getElementById("idListAuthor_"+id).innerHTML;
	setTimeout("document.getElementById('ListAuthor').style.display='none'",500);
}

function setDateinForm(datein,dateout,id){
	document.advsearch.DateFrom.value=datein;
	document.advsearch.DateTo.value=dateout;
	for (i=1;i<6;i++){
		document.getElementById("LapTime"+i).style.backgroundColor="#EEF7FC";
	}
	document.getElementById("LapTime"+id).style.backgroundColor="#ffeeaa";
}

function searchartcorrelati(IdNews){
		var oXmlHttp = zXmlHttp.createRequest();
		oXmlHttp.open("GET", "includes/searchartcorrelati.php?IdNews="+IdNews+"&rand=" + Math.floor(Math.random() * 1000000), true);
		document.getElementById("keyword").innerHTML="<div style='float:left;'><dl><dt>Ricerca articoli correlati</dt><dd><span><em style='left:300px'></em></span></dd></dl></div>";
		oXmlHttp.onreadystatechange = function () {
			if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
				document.getElementById("keyword").innerHTML=oXmlHttp.responseText;
		    }
		}
		oXmlHttp.send(null);	
}

function loadmynews(COOKIESEARCH,COOKIESEARCHOR,COOKIESEARCHPHR,COOKIESEARCHNOT){
	if (document.getElementById("loadmynews")){
		if (COOKIESEARCH!="" || COOKIESEARCHOR!="" || COOKIESEARCHPHR!="" || COOKIESEARCHNOT!=""){
			var oXmlHttp = zXmlHttp.createRequest();
			oXmlHttp.open("GET", "includes/searchmyarticoli.php?COOKIESEARCH="+COOKIESEARCH+"&COOKIESEARCHOR="+COOKIESEARCHOR+"&COOKIESEARCHPHR="+COOKIESEARCHPHR+"&COOKIESEARCHNOT="+COOKIESEARCHNOT+"&rand=" + Math.floor(Math.random() * 1000000), true);
			//document.getElementById("loadmynews").innerHTML="<div style='float:left;'><dl><dt>Ricerca articoli correlati</dt><dd><span><em style='left:300px'></em></span></dd></dl></div>";
			oXmlHttp.onreadystatechange = function () {
				if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
					document.getElementById("loadmynews").innerHTML=oXmlHttp.responseText;
			    }
			}
			oXmlHttp.send(null);
		}
	}		
		//setTimeout("loadlastnews("+myprofile+")",10000);
}

function loadmynotes(){
	if (document.getElementById("loadmynotes")){
		var oXmlHttp = zXmlHttp.createRequest();
		oXmlHttp.open("GET", "includes/searchmynotes.php?rand=" + Math.floor(Math.random() * 1000000), true);
		//document.getElementById("loadmynotes").innerHTML="<div style='float:left;'><dl><dt>Carica appunti</dt><dd><span><em style='left:300px'></em></span></dd></dl></div>";
		oXmlHttp.onreadystatechange = function () {
			if (oXmlHttp.readyState == 4 && (oXmlHttp.status == 200 || oXmlHttp.status == 304)) {
				document.getElementById("loadmynotes").innerHTML=oXmlHttp.responseText;
		    }
		}
		oXmlHttp.send(null);
	}
}

//     user profile
function setCookieMySearch(sNome,sValore) {
	iGiorni=360;
	//sNome="telpress";
	//sValore=document.useroption.mykeyinsite.value;
	var dtOggi = new Date()
	var dtExpires = new Date()
	dtExpires.setTime
	(dtOggi.getTime() + 24 * iGiorni * 3600000)
	document.cookie = sNome + "=" + escape(sValore) + "; expires=" + dtExpires.toGMTString();
}
function setCookie(sNome,sValore,mytime) {
	var dtOggi = new Date()
	var dtExpires = new Date()
	dtExpires.setTime
	(dtOggi.getTime() + mytime*1000)
	document.cookie = sNome + "=" + escape(sValore) + "; expires=" + dtExpires.toGMTString();
}
function saveMyProfile(){
	
	tnmstitletext=document.useroption.tnmstitletext.value;
	tnmstitlefont=document.useroption.tnmstitlefont.value;
	tnmshits=document.useroption.tnmshits.value;
	
	if (document.useroption.tnmsformatSTM.checked==true){
		setCookieMySearch("tnmsformatSTM","1");
	} else {
		setCookieMySearch("tnmsformatSTM","0");
	}
	if (document.useroption.tnmsformatTV.checked==true){
		setCookieMySearch("tnmsformatTV","1");
	} else {
		setCookieMySearch("tnmsformatTV","0");
	}
	if (document.useroption.tnmsformatAUD.checked==true){
		setCookieMySearch("tnmsformatAUD","1");
	} else {
		setCookieMySearch("tnmsformatAUD","0");
	}
	if (document.useroption.tnmsabstract.checked==true){
		setCookieMySearch("tnmsabstract","1");
	} else {
		setCookieMySearch("tnmsabstract","0");
	}

	setCookieMySearch("tnmshits",tnmshits);
	setCookieMySearch("tnmstitlefont",tnmstitlefont);
	setCookieMySearch("tnmstitletext",tnmstitletext);
}
function savemySearch(){
	tnmskeyAnd=document.advsearch.Search.value;
	tnmskeyOr=document.advsearch.SearchOr.value;
	tnmskeyPhr=document.advsearch.SearchPhr.value;
	tnmskeyNot=document.advsearch.SearchNot.value;
	
	setCookieMySearch("tnmskeyAnd",tnmskeyAnd);
	setCookieMySearch("tnmskeyOr",tnmskeyOr);
	setCookieMySearch("tnmskeyPhr",tnmskeyPhr);
	setCookieMySearch("tnmskeyNot",tnmskeyNot);
}
//     fine  user profile

function goPage(section,id){
	document.goPage.Section.value=section;
	document.goPage.Id.value=id;
	document.goPage.submit();

}

function bigText(val){
	//value = document.getElementById("newsDiv").style.fontSize;
	//value.replace("px","");
	document.getElementById("newsDiv").style.fontSize=val+"px";
}
function preText(){
	if (myBody=document.getElementById("BodyNews")){
		myBody.innerHTML="<pre>" + myBody.innerHTML + "</pre>";
	
	}
	
	
}
function showText(){
	if (myBody=document.getElementById("BodyNews")){
		if (myBody.style.display=="none"){
			myBody.style.display="inline";
			if (myattachDiv=document.getElementById("attachDiv")){
				myattachDiv.style.display="none";
			}	
		} else {
			myBody.style.display="none";
			if (myattachDiv=document.getElementById("attachDiv")){
				myattachDiv.style.display="inline";
			}		
		}
	}	
	
}


function changeTarget(idTarget){
	document.Navigator.idTarget.value=idTarget;
	document.Navigator.IdNews.value=0;
	document.Navigator.arrayStart.value=0;
	document.Navigator.Argomento.value='';
	document.Navigator.submit();

}
function changeTarget_Argo(idTarget,Argo){
	document.Navigator.idTarget.value=idTarget;
	document.Navigator.IdNews.value=0;
	document.Navigator.arrayStart.value=0;
	document.Navigator.Argomento.value=Argo;
	document.Navigator.submit();

}