/********************************************************************/
/* FLASH 															*/
/********************************************************************/
$(document).ready(function(){
 	$(document).pngFix();
	/* accordion blocci APERTI */
	$(".accord").click(function () { 
		var tip= $(this).attr("id");
		if($(this).hasClass("on")){
			$(this).removeClass("on");
			$(this).addClass("off");
		 	$("#box-"+tip).slideUp("slow");
		}
      	else{
			$(this).removeClass("off");
			$(this).addClass("on");
			$("#box-"+tip).slideDown("slow");
		}
	});
	
	/* FORM DI REGISTRAZIONE NUOVO UTENTE AREA RISERVATA */
	$("#inviasurv").click(function () {
				
		if (document.getElementById("consento").checked == false){
			alert("Per proseguire č necessario acconsentire al trattamento dei dati personali");
		}
		else {
			var ischeck = '';								 
			ischeck=$("#newsletter:checked").length;
			if(ischeck == '1'){
				$("#confnews").attr("value","Si");
				$("#insertuser").submit();
			}
			else{
				$("#confnews").attr("value","No");
				$("#insertuser").submit();
				
			}		
		}
	});
	
	/* FORM DI CONTROLLO INVIA COMMENTO SENZA TITLE E TESTO */
	$("#inviacomment").click(function () {
		var titolo='';			
		titolo = $("#title-comment").attr("value").length;
		var testo='';
		testo = $("#text-message").val().length;
		var strvuota='';
		if(titolo == '1'){
			alert("ATTENZIONE il campo titolo commento non puņ essere vuoto");
		}
		else{
			if(testo == '1'){
				alert("ATTENZIONE inserire un commento");
			}
			else{
				$("#commentform").submit();
			}
		}			
	});
	
 });
	
function chiudiBlocchi(){
	/* accordion blocci CHIUSI */
	$(".accord").each(function (i){
		var tip= $(this).attr("id");
		if($(this).hasClass("apri")){
			$("#box-"+tip).show(); 
		}
		else{
			if($(this).hasClass("on")){
				$(this).removeClass("on");
				$(this).addClass("off");
				$("#box-"+tip).hide();
			}
		}	
	});
}
	
/* video player */
function videoPlayer(linkurl,w,h,auto_play,idiv,img) {
	var flashvars = {
		videoUrl: linkurl,
		autoPlay: auto_play,
		videoImg: img
	};
	var params = {
		allowScriptAccess: 'sameDomain',
		allowFullScreen: 'true',
		scale: 'exactfit',
		wmode: 'transparent'
	};
	var attributes = {
		id: idiv,
		name: idiv
	};
	
	swfobject.embedSWF(movie_dir+'/video-player.swf', idiv, w, h, '9.0.0', false, flashvars, params, attributes);
}


