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)";
	document.getElementById("player1").style.display="none";

	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 openDivCom(idComm){
	if (document.getElementById("VievComm"+idComm).style.display=="none"){
		document.getElementById("VievComm"+idComm).style.display="inline";
	} else {
		document.getElementById("VievComm"+idComm).style.display="none";
	}

}


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){
	if (document.getElementById("listUserByGroup"+IdGroup).style.display=="inline"){
		document.getElementById("listUserByGroup"+IdGroup).style.display="none";
		document.getElementById("cell"+IdGroup).style.background="#efefef";
	} 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+"&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();	


	}

	
	
}


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('board/commenti/addcomment.php?NewsId='+NewsId+'&edizione='+edizione+'&sessName='+sessName, 'WinComment', 'width=500,height=400,scrollbars=no,resizable=no,location=no,menubar=yes,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();		
}
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)";
	document.getElementById("player1").style.display="inline";
}

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){
	//opacity=100;
	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;
	JobTitle=document.iscrizione.JobTitle.value;
	Telefono=document.iscrizione.Telefono.value;
	//MemberLions=document.iscrizione.MemberLions.checked;
	if (document.iscrizione.MemberLions.checked==true){
		MemberLions=1;
	} else {
		MemberLions=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)";

	var oXmlHttp = zXmlHttp.createRequest();
	
	oXmlHttp.open("GET", pag+ "?Nome="+Nome+"&Cognome="+Cognome+"&Sesso="+Sesso+"&Educational="+Educational+"&City="+City+"&Email="+Email+"&JobTitle="+JobTitle+"&Telefono="+Telefono+"&MemberLions="+MemberLions+"&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("Body").innerHTML=oXmlHttp.responseText;
		}
	}
	
	oXmlHttp.send();	
	
}


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;
	MemberLions=document.iscrizione.MemberLions.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 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";
	} else {
		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(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="";
	if (action==1) mailfriend=document.formfriend.mailfriend.value;

	marginLeft=(100-XSize)/2;
	document.getElementById("Body").style.marginLeft=marginLeft+"%";
	document.getElementById("Body").style.height=YSize+"%";

	var oXmlHttp = zXmlHttp.createRequest();
	document.getElementById("Body").innerHTML="<img src='images/loading.gif'>";
	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", "mail_friend.php?IdNews="+IdNews+"&action="+action+"&mailfriend="+mailfriend+"&rand=" + Math.floor(Math.random() * 1000000), true);
	oXmlHttp.send('');
	
}

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 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", "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();	
	
}

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", "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();	
	
}


function openListAttach(idNews) {
		document.getElementById("ListAttach"+idNews).style.display="inline";
}
function closeListAttach(idNews) {
		document.getElementById("ListAttach"+idNews).style.display="none";
}


function openListDownload(area){
	document.Navigator.areadownload.value=area;
	//alert(area);
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("GET", "listdownload.php?areadownload="+area+"&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) {
			//alert("Got response.");
			document.getElementById("listDownload").innerHTML=oXmlHttp.responseText;
		}
	}
	
	oXmlHttp.send();	
	
}



function openPreview(attachHome){
	//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)";
	var oXmlHttp = zXmlHttp.createRequest();

	XSize=40;
	YSize=55;	

	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+"%";
	document.getElementById("Body").style.border="1";
	document.getElementById("Body").style.backgroundColor="transparent";
	//window.Body.focus();
	pag="video_preview.php";
	oXmlHttp.open("GET", pag+ "?attachHome=" + attachHome + "&rand=" + Math.floor(Math.random() * 1000000), true);
	
	//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) {
			//alert("Got response.");
			document.getElementById("Body").innerHTML=oXmlHttp.responseText;
		}
	}
	
	oXmlHttp.send();	
	
}

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).innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			document.getElementById("Check"+IdGroup).innerHTML=oXmlHttp.responseText;
			//document.newsletter.queryGroup.value="INSERT INTO  Readers_Groups (idReader,idGroup) VALUES ";
	    }
	}
	oXmlHttp.send(null);
}


function changeVideoDownload(Id) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "changeVideoDownload.php?IdVideo="+Id+"&rand=" + Math.floor(Math.random() * 1000000), true);
	document.getElementById("player1").innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			results = oXmlHttp.responseText;
			res="";
			if (results != "") {
				videoArray = results.split("{endcol}");
				ext=videoArray[1];
				//alert(ext);
				AttachHomeNews=videoArray[0];
				if (ext=="flv"){
					var FO = {	movie:"js/flash_flv_player/flvplayer.swf",width:"300",height:"260",majorversion:"7",build:"0",bgcolor:"#FFFFFF",allowfullscreen:"true",flashvars:"file="+AttachHomeNews };
					UFO.create(	FO, "player1");
					res="";
				}
				if (ext=="wmv"){
					res = "<OBJECT name='video/x-ms-wmv' style='width:300px;height:260px;padding:0px;' align='center' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>";
					res += 	"<PARAM name='URL' VALUE='"+AttachHomeNews+"'>";
					res += 	"	<PARAM name='AllowChangeDisplaySize' value=1>";
					res += 	"	<PARAM NAME='ShowControls' VALUE=1>";
					res += 	"	<param name='clickToPlay' value=1>";
					res += 	"	<PARAM NAME='ShowDisplay' VALUE=0>";
					res += 	"	<PARAM NAME='ShowStatusBar' VALUE=0>";
					res += 	"	<PARAM NAME='AutoStart' VALUE=1>";
					res += 	"	<PARAM NAME='InvokeURLS' Value=0>";
					res += 	"	<PARAM NAME='transparentAtStart' value=0>";
					res += 	"	<PARAM NAME='animationAtStart' value=1>";
					res += 	"	<embed name='video/x-ms-wmv' style='width:300px;height:260px;padding-right:10px;'  type='application/x-mplayer2' src='"+AttachHomeNews+"' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' autosize='1' autostart='0' clicktoplay='0' displaysize='0' enablecontextmenu='1' enablefullscreencontrols='1' enabletracker='0' transparentatstart='0' mute='0' playcount='1' showcontrols='1' showaudiocontrols='1' showdisplay='0' showgotobar='0' showpositioncontrols='1' showstatusbar='0' showtracker='1'>";
					res += 	"</object>";

					//document.getElementById("player1").innerHTML=res;
				}
				//document.getElementById("player1").innerHTML=videoArray[0];
				document.getElementById("player1").innerHTML=res;
				
				strRes = videoArray[2];
				document.getElementById("titleVideo").innerHTML=strRes;
				
				
			}
			
	    }
	}
	oXmlHttp.send(null);
}



function changeVideo(Id) {
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "changeVideo.php?IdVideo="+Id+"&rand=" + Math.floor(Math.random() * 1000000), true);
	if (document.getElementById("player1")) document.getElementById("player1").innerHTML="<img src='images/loading.gif'>";
	oXmlHttp.onreadystatechange = function () {
	    if (oXmlHttp.readyState == 4) {
	        //alert("Got response.");
			results = oXmlHttp.responseText;
			res="";
			//alert(results);
			if (results != "") {
				videoArray = results.split("{endcol}");
				UrlMedia=videoArray[0];
				ext=videoArray[1];
				
				StampMedia=videoArray[3];
				if (ext=="flv"){
					var FO = {	movie:"js/flash_flv_player/flvplayer.swf",width:"300",height:"260",majorversion:"7",build:"0",bgcolor:"#FFFFFF",allowfullscreen:"true",flashvars:"file="+UrlMedia+"&image="+StampMedia };
					UFO.create(	FO, "player1");
					res="";
				}
				if (ext=="wmv"  || ext=="wma" || ext=="mp4" || ext=="mp3" || ext=="mpg" || ext=="avi" || ext=="asf" || ext==""){
					res = "<OBJECT name='video/x-ms-wmv' style='width:300px;height:260px;padding:0px;' align='center' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>";
					res += 	"<PARAM name='URL' VALUE='"+UrlMedia+"'>";
					res += 	"	<PARAM name='AllowChangeDisplaySize' value=1>";
					res += 	"	<PARAM NAME='ShowControls' VALUE=1>";
					res += 	"	<param name='clickToPlay' value=1>";
					res += 	"	<PARAM NAME='ShowDisplay' VALUE=0>";
					res += 	"	<PARAM NAME='ShowStatusBar' VALUE=0>";
					res += 	"	<PARAM NAME='AutoStart' VALUE=1>";
					res += 	"	<PARAM NAME='InvokeURLS' Value=0>";
					res += 	"	<PARAM NAME='transparentAtStart' value=0>";
					res += 	"	<PARAM NAME='animationAtStart' value=1>";
					res += 	"	<embed name='video/x-ms-wmv' style='width:300px;height:260px;padding-right:10px;'  type='application/x-mplayer2' src='"+UrlMedia+"' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' autosize='1' autostart='0' clicktoplay='0' displaysize='0' enablecontextmenu='1' enablefullscreencontrols='1' enabletracker='0' transparentatstart='0' mute='0' playcount='1' showcontrols='1' showaudiocontrols='1' showdisplay='0' showgotobar='0' showpositioncontrols='1' showstatusbar='0' showtracker='1'>";
					res += 	"</object>";

					//document.getElementById("player1").innerHTML=res;
				}
				//document.getElementById("player1").innerHTML=videoArray[0];
				document.getElementById("player1").innerHTML=res;
				
				strRes = videoArray[2];
				document.getElementById("titleVideo").innerHTML=strRes;
				
				
			}
			
	    }
	}
	oXmlHttp.send(null);
}
