function Chat() {
	var width = screen.width;

	if(width==800) {
		window.open('/amici/chat/?res=800','chat','width=780,height=530,left=20,top=20,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	} else {
		window.open('/amici/chat/','chat','width=1004,height=698,left=20,top=20,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	}
	return false;
}

function Radio() {
	window.open('http://www.105.net/Player04/player.htm','player','width=450,height=300,left=20,top=20,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
}

function openWin( windowURL, windowName, windowFeatures ) { 
	return window.open( windowURL, windowName, windowFeatures ) ; 
} 

function PlayerAudio(txt) {
	var url="http://www.105.net/Musica/playeraudio.htm?audio=";
	window.open(url+txt,'PlayerAudio','width=310,height=118');
}
function webradio(canale) {
	var indirizzo='http://www.105.net/webradio/scegliplayer.php?canale=' + canale;			 
	window.open(indirizzo,'Radio','width=700, height=500');	

}
var mymood="";
function fraseON(valore){
	//mymood=valore;
	document.getElementById('frase').value="";	
	document.getElementById('sbmt').style.display='block';	
}
function fraseOFF(valore){
	document.getElementById('frase').value=mymood;
	//document.getElementById('sbmt').style.display='none';	
}
function valida(obj){
	if(obj.frase.value==""){
	alert ("attenzione");	
	return false;
	}else{
	return true;	
	}
}



/*********MOOOD **/

function opencomment(user,id,nome,val){
if(val=="front"){
document.getElementById("commentafront").style.display="block";	
}else{
document.getElementById("commenta"+val).style.display="block";	
}

titolo=document.getElementById("titcomm");
titolo.innerHTML="Invia un commento a "+nome+":";

html=document.getElementById("hidden");
html.innerHTML="<input type=\"hidden\" name=\"uuser\" value=\""+user+"\" />\n" +
"<input type=\"hidden\" name=\"idd\" value=\""+id+"\" />\n";
}



///AJAX BASIC X MOOD
function ajaxFunction(urlQuery,elmnt,tipo){
	var xmlHttp;
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){
		// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			document.getElementById(elmnt).style.display="block";
			document.getElementById(elmnt).innerHTML=xmlHttp.responseText;
			//alert(xmlHttp.responseText)
		}
		
		
		
		
	}
	  xmlHttp.open("GET",urlQuery,true);
	  xmlHttp.send(null);
}


function chiudi(val){
	document.getElementById(val).style.display="none";
}
 



function openComment(cid) {
	
	mydiv = findElementById("div_" + cid);
	myfield = findElementById("field_" + cid);
	
	mydiv.style.display="";
	myfield.focus();
}

findElementById = function (id) {
	return ( document.all+"" != "undefined" ? document.all[id] : document.getElementById(id) );
}

var newsrollLastId = 0;
var newsrollTimer = null;
var newsrollStartPath = "";
function initNewsrollComponent( sp ) {
	
	if ( newsrollTimer!=null ) return;
	newsrollStartPath = sp;
	// inserisce
	newsrollTimer = setInterval ("aggiornaNewsroll()", 5000);
	aggiornaNewsroll();
}

function aggiornaNewsroll(quanti) {
	performJsonRequest( newsrollStartPath + "servizi/newsroll.php?fr=" + newsrollLastId );
	//alert(quanti);
}

var querycount=0;
function performJsonRequest( r ) {
	headElement = document.getElementsByTagName("head").item(0); 
	var script = document.createElement("script"); 
	script.setAttribute("type", "text/javascript"); 
	script.setAttribute("src", r+"&cou="+this.querycount++ ); 
	headElement.appendChild(script); 
}

function newsrollCascade( content, lastid ) {
	/*alert(quanti);*/
	for(k=quanti;k>0;k--){
		if(k!=1){
		document.getElementById('newsroll_slot_'+k).innerHTML=document.getElementById('newsroll_slot_'+(k-1)).innerHTML;
		}else{
		document.getElementById('newsroll_slot_'+k).innerHTML=content;	
		}
	}
	/*document.getElementById('newsroll_slot_10').innerHTML=document.getElementById('newsroll_slot_9').innerHTML;
	document.getElementById('newsroll_slot_9').innerHTML=document.getElementById('newsroll_slot_8').innerHTML;
	document.getElementById('newsroll_slot_8').innerHTML=document.getElementById('newsroll_slot_7').innerHTML;
	document.getElementById('newsroll_slot_7').innerHTML=document.getElementById('newsroll_slot_6').innerHTML;
	document.getElementById('newsroll_slot_6').innerHTML=document.getElementById('newsroll_slot_5').innerHTML;
	document.getElementById('newsroll_slot_5').innerHTML=document.getElementById('newsroll_slot_4').innerHTML;
	document.getElementById('newsroll_slot_4').innerHTML=document.getElementById('newsroll_slot_3').innerHTML;
	document.getElementById('newsroll_slot_3').innerHTML=document.getElementById('newsroll_slot_2').innerHTML;
	document.getElementById('newsroll_slot_2').innerHTML=document.getElementById('newsroll_slot_1').innerHTML;
	document.getElementById('newsroll_slot_1').innerHTML=content;	*/
	newsrollLastId = lastid;
	
}
/* Aggiornamenti di stato live */
var statusUpdateLastId = 0;
var statusUpdateTimer = null;
var statusUpdateStartPath = "";

function initStatusUpdateComponent( sp ) {

	if ( statusUpdateTimer!=null ) return;
	statusUpdateStartPath = sp;
	// inserisce
	statusUpdateTimer = setInterval ("aggiornaStatusUpdate()", 5000);
	aggiornaStatusUpdate();
}

var querycountSU=0;
function performJsonRequestSU( r ) {
	headElement = document.getElementsByTagName("head").item(0); 
	var script = document.createElement("script"); 
	script.setAttribute("type", "text/javascript"); 
	script.setAttribute("src", r+"&cou="+this.querycountSU++ ); 
	headElement.appendChild(script); 
}

function aggiornaStatusUpdate(StatusUpdateNumber) {
	performJsonRequestSU( statusUpdateStartPath + "servizi/statusupdate.php?fr=" + statusUpdateLastId );
}



function statusUpdateCascade( content, lastid ) {

	for(k=StatusUpdateNumber;k>0;k--){
		if(k!=1){
		document.getElementById('statusupdate_slot_'+k).innerHTML=document.getElementById('statusupdate_slot_'+(k-1)).innerHTML;
		}else{
		document.getElementById('statusupdate_slot_'+k).innerHTML=content;	
		}
		statusUpdateLastId = lastid;
	}
}





