


/* POP LOGIN */

$(document).ready(function(){

$(".pop").click(function () {
  $("#pop-login").show("normal");
});


$("#chiudi").click(function () {
  $("#pop-login").hide("fast");
});

}); 
/*FINE POP LOGIN*/


/* CAROSELLO */
var times=0;
var t;
function timedCount(val){
	if(times<8){
		clearTimeout(t);
		carosello(val);	
		times=times+1;
	}else{
		times=0;
	}
}

function carosello(val){
	clearTimeout(t);
	box=document.getElementById('striscia');
	totBox=box.getElementsByTagName('img').length;
	//alert(val);
	for(i=0;i<totBox;i++){
		document.getElementById("s"+i).style.display="none";
		document.getElementById("c"+i).style.background="#000";
		document.getElementById('str'+i).style.display="none";
	}
	document.getElementById("s"+val).style.display="block";
	//valore=-(val*333)-75;
	//document.getElementById('striscia').style.marginTop=valore+'px';
	document.getElementById('striscia').style.display="none";
	document.getElementById('c'+val).style.background="#FFF";
	document.getElementById('str'+val).style.display="block";
	$("#striscia").fadeIn("normal");
	if(val<(totBox-1)){
		val++;
	}else{
		val=0;
	}
	t=setTimeout("timedCount("+val+")",7000);
}
/*FINE CAROSELLO*/






/*FACCE DA 105*/
$(document).ready(function(){
$("#facce105 ul li").hover(function() {
	$(this).find("div").stop()
	.animate({top: "-10", opacity:1}, "fast")
	.css("display","block")

}, function() {
	$(this).find("div").stop()
	.animate({top: "0", opacity: 0}, "fast")
});

});
/*FINE FACCE DA 105*/




/*WEBRADIO apri-chiudi*/
$("#apri-radio").click(function() {
	$("#webradio").find(".listaradio").stop()
	.animate({top: "5", opacity:1}, "fast")
	.css("display","block")
	$("#webradio").find("#apri-radio").stop()
	.css("display","none")
	$("#webradio").find("#chiudi-radio").stop()
	.css("display","block")
});
$("#chiudi-radio").click(function() {
	$("#webradio").find(".listaradio").stop()
	.animate({top: "-5", opacity:0}, "fast")
	.css("display","none")
	$("#webradio").find("#apri-radio").stop()
	.css("display","block")
	$("#webradio").find("#chiudi-radio").stop()
	.css("display","none")
});
/* FINE WEBRADIO apri-chiudi*/


/*QUICK ROLLOVER*/
function showQN(id,num,tot){
for(i=0;i<tot;i++){
	document.getElementById(id+i).style.display="none";
}
	document.getElementById(id+num).style.display="block";
	$("#"+id+num).fadeIn("normal");
}















/*POPUP PLAYER WEBRADIO*/
function apriWebradio(canale){
	//alert(canale);
	window.open('popup.php?ch='+canale,'webradio','width=930,height=270');
}





function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



/* GALLERY HOMEPAGE */
galleryVisualizzata=0;
function nascondiTutto(){
	//alert(galleryVisualizzata);
	if(galleryVisualizzata>14){
		galleryVisualizzata=0;
	}else if(galleryVisualizzata<0){
		galleryVisualizzata=14;
	}
	
	for(i=0;i<15;i++){
		document.getElementById("foto"+i).style.display="none";	
		document.getElementById("descrizionefoto"+i).style.display="none";	
	}
	document.getElementById("foto"+galleryVisualizzata).style.display="block";	
	document.getElementById("descrizionefoto"+galleryVisualizzata).style.display="block";
}

function avanti(){
	galleryVisualizzata++;
	nascondiTutto();
}
function indietro(){
	galleryVisualizzata--;
	nascondiTutto();
}
//alert(galleryVisualizzata);
/*FINE GALLERY HOMEPAGE*/





/*CARICA POPUP PLAYER AUDIO*/
function PlayerAudio(stream){
	var indirizzo='/sezioni/Player/sceltaplayer.php?url=' + stream;			 
	window.open(indirizzo,'Radio','width=600, height=250');	
}

//Utilizzato nelle photogallery per il modulo "segnala ad 1 amico"
function validaFormPhoto(obj){
	if(obj.t_nome.value=="" ||obj.a_nome.value=="" || obj.t_mail.value=="" || obj.a_mail.value==""){
	document.getElementById('errore').innerHTML = "Attenzione tutti i campi sono obbligatori";	
    
		return false;
		
    } else{
		return true;
    }
		return false;
}


//Condividi con Messenger
function IMStart(AppId) {
		
		var obj;
                try
                {
                    obj=new ActiveXObject("MSNMessenger.P4QuickLaunch");
                }
                catch(e)
                {
                    obj=null;
                }
 
                if(obj!=null)
                {
                obj.LaunchApp(AppId,"");
                }
                else
                {
                    alert("Per utilizzare la funzionalit&agrave; occorre Windows Live Messenger 6.0 o superiore &egrave; Internet Explorer 5.5 o superiore.");
                }
 

    }



/*SELEZIONA TUTTO TEXT AREA*/


<!-- Begin
function copyit(theField) {
	var selectedText = document.selection;
	if (selectedText.type == 'Text') {
		var newRange = selectedText.createRange();
		theField.focus();
		theField.value = newRange.text;
	} else {
		alert('select a text in the page and then press this button');
	}
}
//  End -->





function share (network){
	TITLE=document.getElementsByTagName("title").item(0).innerHTML;
	PERMALINK=document.location;
	EXCERPT="";
	switch(network){
		case "delicious":
		  url = "http://delicious.com/post?url="+PERMALINK+"&amp;title="+TITLE+"&amp;notes="+EXCERPT+"";
		break;
		case "digg":
		  url = "http://digg.com/submit?phase=2&amp;url="+PERMALINK+"&amp;title="+TITLE+"&amp;bodytext="+EXCERPT+"";
		break;
		case "facebook":
		  url = "http://www.facebook.com/share.php?u="+PERMALINK+"&amp;t="+TITLE+"";
		break;
		case "friendfeed":
		  url = "http://www.friendfeed.com/share?title="+TITLE+"&amp;link="+PERMALINK+"";
		break;
		case "linkedin":
		  url = "http://www.linkedin.com/shareArticle?mini=true&amp;url="+PERMALINK+"&amp;title="+TITLE+"&amp;source=BLOGNAME&amp;summary="+EXCERPT+"";
		break;
		case "myspace":
		  url = "http://www.myspace.com/Modules/PostTo/Pages/?u="+PERMALINK+"&amp;t="+TITLE+"";
		break;
		case "reddit":
		  url = "http://reddit.com/submit?url="+PERMALINK+"&amp;title="+TITLE+"";
		break;
		case "segnalo":
		  url = "http://segnalo.alice.it/post.html.php?url="+PERMALINK+"&amp;title="+TITLE+"";
		break;
		case "stumbleupon":
		  url = "http://www.stumbleupon.com/submit?url="+PERMALINK+"&amp;title="+TITLE+"";
		break;
		case "technorati":
		  url = "http://technorati.com/faves?add="+PERMALINK+"";
		break;
		case "tumblr":
		  url = "http://www.tumblr.com/share?v=3&amp;u="+PERMALINK+"&amp;t="+TITLE+"&amp;s="+EXCERPT+"";
		break;
		case "twitter":
		  url = "http://twitter.com/home?status="+TITLE+"%20-%20"+PERMALINK+"";
		break;
		case "wikio":
		  url = "http://www.wikio.it/vote?url="+PERMALINK+"";
		break;
	}
	window.open(url,"_blank");
}



function contalettere(field, count, max) {
	if (field.value.length > max)
	field.value = field.value.substring(0, max);
	else
	count.value = max - field.value.length;
}





