
$(document).ready(function(){
	$("#cerca").click(function(){
		if (document.getElementById('cerca').value=="Cerca nel sito"){
			document.getElementById('cerca').value="";
		}					   
	});

var myDimFont=12;

  $("#ingrandisci").click(function(){
		$("#pubblicazione *").css("line-height", "20px");								   
        $("#pubblicazione *").css("font-size", "16px");
		$("#titolo_pubblicazione").css("font-size", "20px");
		$("#elenco_modulo *").css("font-size", "20px");
		$("#nome_modulo").css("font-size", "22px");
		$("#titolo_settore").css("font-size", "36px");
		$("#elenco_risultati *").css("font-size", "20px");
		$("#elenco_settori *").css("font-size", "20px");
    })
    $("#ingrandisci2").click(function(){
        $("#pubblicazione *").css("line-height", "22px");
		$("#pubblicazione *").css("font-size", "18px");
		$("#titolo_pubblicazione").css("font-size", "22px");
		$("#elenco_modulo *").css("font-size", "22px");
		$("#nome_modulo").css("font-size", "24px");
		$("#titolo_settore").css("font-size", "36px");
		$("#elenco_risultati *").css("font-size", "22px");
		$("#elenco_settori *").css("font-size", "22px");
    })
    $("#ingrandisci3").click(function(){
		$("#pubblicazione *").css("line-height", "24px");
        $("#pubblicazione *").css("font-size", "20px");
		$("#titolo_pubblicazione").css("font-size", "24px");
		$("#elenco_modulo *").css("font-size", "24px");
		$("#nome_modulo").css("font-size", "26px");
		$("#titolo_settore").css("font-size", "36px");
		$("#elenco_risultati *").css("font-size", "24px");
		$("#elenco_settori *").css("font-size", "24px");
    })	
$("#aumenta").click(function(){

	if (myDimFont==12) {
       myDimFont=14;
	} else {
		myDimFont=myDimFont+1
	}
        $("*").css("font-size", myDimFont);
    })
						   });

/*
****************************************************************
********************* SCRIPT PER AUTOCOMPLETE ******************
****************************************************************
*/
function findValue(li) {
	if( li == null ) return alert("No match!");

	// if coming from an AJAX call, let's use the CityId as the value
	if( !!li.extra ) var sValue = li.extra[0];

	// otherwise, let's just display the value in the text box
	else var sValue = li.selectValue;	
}

function selectItem(li) {
	findValue(li);
}

function formatItem(row) {
	return row[0] ;
}

function lookupAjax(){
	var oSuggest = $("#CityAjax")[0].autocompleter;

	oSuggest.findValue();

	return false;
}

function lookupLocal(){
	var oSuggest = $("#CityLocal")[0].autocompleter;

	oSuggest.findValue();

	return false;
}
/*
****************************************************************
***************** FINE SCRIPT PER AUTOCOMPLETE *****************
****************************************************************
*/







//JQUERY TOOLTIP
(function(a){a.fn.wTooltip=function(f,r){f=a.extend({content:null,ajax:null,follow:true,auto:true,fadeIn:0,fadeOut:0,appendTip:document.body,degrade:false,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(t,p,o){},callAfter:function(t,p,o){},clickAction:function(p,o){a(p).hide()},delay:0,timeout:0},f||{});if(!f.style&&typeof f.style!="object"){f.style={};f.style.zIndex="1000"}else{f.style=a.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},f.style||{})}if(typeof r=="function"){f.callAfter=r||f.callAfter}f.style.display="none",f.style.position="absolute";var m,l,q,c,k={},b=true,e=false,n=false,s=document.createElement("div"),g=(typeof document.body.style.maxWidth=="undefined")?true:false,j=(typeof a.talk=="function"&&typeof a.listen=="function")?true:false;if(f.id){s.id=f.id}if(f.className){s.className=f.className}f.degrade=(f.degrade&&g)?true:false;for(var d in f.style){s.style[d]=f.style[d]}function i(o){if(o){if(f.degrade){a(s).html(f.content.replace(/<\/?[^>]+>/gi,""))}else{a(s).html(f.content)}}}if(f.ajax){a.get(f.ajax,function(o){if(o){f.content=o}i(f.content)})}function h(p){function t(u){if(m&&!f.content){m=""}}function o(){if(!e&&f.auto){clearInterval(c);if(f.fadeOut){a(s).fadeOut(f.fadeOut,function(){t(p)})}else{t(p);s.style.display="none"}}if(typeof f.callAfter=="function"){f.callAfter(s,p,f)}if(j){f=a.listen(f)}}if(f.timeout>0){q=setTimeout(function(){o()},f.timeout)}else{o()}}a(s).hover(function(){e=true},function(){e=false;h(k)});if(j){f.key=s;f.plugin="wTooltip";f.channel="wayfarer";a.talk(f)}i(f.content&&!f.ajax);a(s).appendTo(f.appendTip);return this.each(function(){a(this).hover(function(){var p=this;clearTimeout(q);if((this.title||this.titleMemKeep)&&!f.degrade&&!f.content){m=this.title||this.titleMemKeep;if(this.title){this.titleMemKeep=this.title;this.title=""}}if(f.content&&f.degrade){this.title=s.innerHTML}function o(){if(typeof f.callBefore=="function"){f.callBefore(s,p,f)}if(j){f=a.listen(f)}var t;if(f.content){if(!f.degrade){t="block"}}else{if(m&&!f.degrade){a(s).html(unescape(m));t="block";m=""}else{t="none"}}if(f.auto){if(t=="block"&&f.fadeIn){a(s).fadeIn(f.fadeIn)}else{s.style.display=t}}}if(f.delay>0){l=setTimeout(function(){o()},f.delay)}else{o()}},function(){clearTimeout(l);var o=this;b=true;if(!f.follow||n||((f.offsetX<0&&(0-f.offsetX<a(s).outerWidth()))&&(f.offsetY>0&&0-f.offsetY<a(s).outerHeight()))){setTimeout(function(){c=setInterval(function(){h(o)},1)},1)}else{h(this)}});a(this).mousemove(function(v){k=this;if(f.follow||b){var y=a(window).scrollTop(),z=a(window).scrollLeft(),w=v.clientY+y+f.offsetY,t=v.clientX+z+f.offsetX,x=a(f.appendTip).outerHeight(),p=a(f.appendTip).innerHeight(),o=a(window).width()+z-a(s).outerWidth(),u=a(window).height()+y-a(s).outerHeight();w=(x>p)?w-(x-p):w;n=(w>u||t>o)?true:false;if(t-z<=0&&f.offsetX<0){t=z}else{if(t>o){t=o}}if(w-y<=0&&f.offsetY<0){w=y}else{if(w>u){w=u}}s.style.top=w+"px";s.style.left=t+"px";b=false}});if(typeof f.clickAction=="function"){a(this).click(function(){f.clickAction(s,this)})}})}})(jQuery);
//FINE TOOLTIP

/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.3
 * Requires jQuery 1.1.3+
 * Docs: http://docs.jquery.com/Plugins/livequery
 */

	function InviaModulo(){
		if ((document.form_header.cerca.value!="Cerca nel sito") && (document.form_header.cerca.value!="")) {
			document.form_header.submit();	
		}
	}


(function($) {
	
$.extend($.fn, {
	livequery: function(type, fn, fn2) {
		var self = this, q;
		
		// Handle different call patterns
		if ($.isFunction(type))
			fn2 = fn, fn = type, type = undefined;
			
		// See if Live Query already exists
		$.each( $.livequery.queries, function(i, query) {
			if ( self.selector == query.selector && self.context == query.context &&
				type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) )
					// Found the query, exit the each loop
					return (q = query) && false;
		});
		
		// Create new Live Query if it wasn't found
		q = q || new $.livequery(this.selector, this.context, type, fn, fn2);
		
		// Make sure it is running
		q.stopped = false;
		
		// Run it immediately for the first time
		q.run();
		
		// Contnue the chain
		return this;
	},
	
	expire: function(type, fn, fn2) {
		var self = this;
		
		// Handle different call patterns
		if ($.isFunction(type))
			fn2 = fn, fn = type, type = undefined;
			
		// Find the Live Query based on arguments and stop it
		$.each( $.livequery.queries, function(i, query) {
			if ( self.selector == query.selector && self.context == query.context && 
				(!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
					$.livequery.stop(query.id);
		});
		
		// Continue the chain
		return this;
	}
});

$.livequery = function(selector, context, type, fn, fn2) {
	this.selector = selector;
	this.context  = context || document;
	this.type     = type;
	this.fn       = fn;
	this.fn2      = fn2;
	this.elements = [];
	this.stopped  = false;
	
	// The id is the index of the Live Query in $.livequery.queries
	this.id = $.livequery.queries.push(this)-1;
	
	// Mark the functions for matching later on
	fn.$lqguid = fn.$lqguid || $.livequery.guid++;
	if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;
	
	// Return the Live Query
	return this;
};



$.livequery.prototype = {
	stop: function() {
		var query = this;
		
		if ( this.type )
			// Unbind all bound events
			this.elements.unbind(this.type, this.fn);
		else if (this.fn2)
			// Call the second function for all matched elements
			this.elements.each(function(i, el) {
				query.fn2.apply(el);
			});
			
		// Clear out matched elements
		this.elements = [];
		
		// Stop the Live Query from running until restarted
		this.stopped = true;
	},
	
	run: function() {
		// Short-circuit if stopped
		if ( this.stopped ) return;
		var query = this;
		
		var oEls = this.elements,
			els  = $(this.selector, this.context),
			nEls = els.not(oEls);
		
		// Set elements to the latest set of matched elements
		this.elements = els;
		
		if (this.type) {
			// Bind events to newly matched elements
			nEls.bind(this.type, this.fn);
			
			// Unbind events to elements no longer matched
			if (oEls.length > 0)
				$.each(oEls, function(i, el) {
					if ( $.inArray(el, els) < 0 )
						$.event.remove(el, query.type, query.fn);
				});
		}
		else {
			// Call the first function for newly matched elements
			nEls.each(function() {
				query.fn.apply(this);
			});
			
			// Call the second function for elements no longer matched
			if ( this.fn2 && oEls.length > 0 )
				$.each(oEls, function(i, el) {
					if ( $.inArray(el, els) < 0 )
						query.fn2.apply(el);
				});
		}
	}
};

$.extend($.livequery, {
	guid: 0,
	queries: [],
	queue: [],
	running: false,
	timeout: null,
	
	checkQueue: function() {
		if ( $.livequery.running && $.livequery.queue.length ) {
			var length = $.livequery.queue.length;
			// Run each Live Query currently in the queue
			while ( length-- )
				$.livequery.queries[ $.livequery.queue.shift() ].run();
		}
	},
	
	pause: function() {
		// Don't run anymore Live Queries until restarted
		$.livequery.running = false;
	},
	
	play: function() {
		// Restart Live Queries
		$.livequery.running = true;
		// Request a run of the Live Queries
		$.livequery.run();
	},
	
	registerPlugin: function() {
		$.each( arguments, function(i,n) {
			// Short-circuit if the method doesn't exist
			if (!$.fn[n]) return;
			
			// Save a reference to the original method
			var old = $.fn[n];
			
			// Create a new method
			$.fn[n] = function() {
				// Call the original method
				var r = old.apply(this, arguments);
				
				// Request a run of the Live Queries
				$.livequery.run();
				
				// Return the original methods result
				return r;
			}
		});
	},
	
	run: function(id) {
		if (id != undefined) {
			// Put the particular Live Query in the queue if it doesn't already exist
			if ( $.inArray(id, $.livequery.queue) < 0 )
				$.livequery.queue.push( id );
		}
		else
			// Put each Live Query in the queue if it doesn't already exist
			$.each( $.livequery.queries, function(id) {
				if ( $.inArray(id, $.livequery.queue) < 0 )
					$.livequery.queue.push( id );
			});
		
		// Clear timeout if it already exists
		if ($.livequery.timeout) clearTimeout($.livequery.timeout);
		// Create a timeout to check the queue and actually run the Live Queries
		$.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
	},
	
	stop: function(id) {
		if (id != undefined)
			// Stop are particular Live Query
			$.livequery.queries[ id ].stop();
		else
			// Stop all Live Queries
			$.each( $.livequery.queries, function(id) {
				$.livequery.queries[ id ].stop();
			});
	}
});


// Register core DOM manipulation methods
$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');

// Run Live Queries when the Document is ready
$(function() { $.livequery.play(); });


// Save a reference to the original init method
var init = $.prototype.init;

// Create a new init method that exposes two new properties: selector and context
$.prototype.init = function(a,c) {
	// Call the original init and save the result
	var r = init.apply(this, arguments);
	
	// Copy over properties if they exist already
	if (a && a.selector)
		r.context = a.context, r.selector = a.selector;
		
	// Set properties
	if ( typeof a == 'string' )
		r.context = c || document, r.selector = a;
	
	// Return the result
	return r;
};

// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
$.prototype.init.prototype = $.prototype;
	
})(jQuery);





function nospam(prefix) {
	var dom='canno' + 'bio';
	var ext='.net';
	document.write('<a href="mai' + 'lto:' + prefix + '@' + dom + ext + '">' + prefix + '@' + dom + ext +'</a>');
}
function nospam_tag(prefix,name) {
	var dom='canno' + 'bio';
	var ext='.net';
	document.write('<a href="mai' + 'lto:' + prefix + '@' + dom + ext + '">' + name +'</a>');
}
// What is $(document).ready ? See: http://flowplayer.org/tools/using.html#document_ready
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


var selectedDateFromCalendar="";

function set_month(ope,mese,anno,tipo) {
	$.post("get_calendar.asp", { ope: ope, mese: mese, anno: anno, tipo: tipo},
   function(data){
	 $("#calendar_box").html(data);	

$('a.dayevent').hover(function() {
	selectedDateFromCalendar=$(this).attr("id");
});

     $('a.null').wTooltip({ 
			content: "Nessun evento per questa data", 
			className: "mytooltipclass"
			//offsetY: 25, 
			//offsetX: -25, 
			//delay: 500,
			//fadeIn: 200 
			//fadeOut: 100
		}); 

 $('a.dayevent').wTooltip({ 
			//content: "Clicca sulla data per<br />visualizzare gli eventi", 
			className: "mytooltipclass",
			content: true, 
			callBefore: function(tooltip) { 
			$.post("tooltip_calendar.asp", { data:selectedDateFromCalendar},
			   function(data){		
				$(tooltip).html(data); 
			   });
			} 	
		});  
	 
	 });
	
}
function set_month_ass(ope,mese,anno,tipo) {
	$.post("get_calendar_associazioni.asp", { ope: ope, mese: mese, anno: anno, tipo: tipo},
   function(data){
	 $("#calendar_box").html(data);	
	 
     $('a.null').wTooltip({ 
			content: "Nessun evento per questa data", 
			className: "tooltipclass"
			//offsetY: 25, 
			//offsetX: -25, 
			//delay: 500,
			//fadeIn: 200 
			//fadeOut: 100
		}); 

 $('a.dayevent').wTooltip({ 
			//content: "Clicca sulla data per<br />visualizzare gli eventi", 
			className: "tooltipclass",
			content: true, 
			callBefore: function(tooltip) { 
			$.post("tooltip_calendar.asp", { data:selectedDateFromCalendar},
			   function(data){		
				$(tooltip).html(data); 
			   });
			} 	
		});  
	 
	 });
}






$(document).ready(function() {

if ($("#ico_mail")) {
$("#ico_mail").attr("href","registrazione.asp");						   

}

//SVUOTA CAMPI FAQ FORM
$("#oggettofaq").live('click',function() {
	$("#oggettofaq").attr("value","");
});
$("#testofaq").live('click',function() {
	$("#testofaq").attr("value","");
});

//prendo l'id (che è la data del giorno) e l'assegno alla variabile globale selectedDateFromCalendar
$('a.dayevent').hover(function() {
	selectedDateFromCalendar=$(this).attr("id");
});


     $('a.null').wTooltip({ 
			content: "Nessun evento per questa data", 
			className: "tooltipclass"
			//offsetY: 25, 
			//offsetX: -25, 
			//delay: 100,
			//fadeIn: 200 
			//fadeOut: 100
		}); 

 $('a.dayevent').wTooltip({ 
			//content: "Clicca sulla data per<br />visualizzare gli eventi", 
			className: "tooltipclass",
			content: true, 
			callBefore: function(tooltip) { 
			$.post("tooltip_calendar.asp", { data:selectedDateFromCalendar},
			   function(data){		
				$(tooltip).html(data); 
			   });
			} 			
			//offsetY: 25, 
			//offsetX: -25, 
			//delay: 100,
			//fadeIn: 100 
			////fadeOut: 100
		}); 

$("a.dayevent").live('click', function() {
		$.post("get_calendar_events.asp", { data: $(this).attr('id')},
		   function(data){
			 $("#get_event").html(data);
		  });
		});



 //FINE GET CALENDAR EVENTS
 
 
// heeeeeeeeeeere we go.
$("#chained").scrollable({hoverClass: 'hover'}).circular().navigator().mousewheel().autoscroll({
	steps: 1,
	interval: 5000		
});	
});
$(document).ready(function() {
 
// heeeeeeeeeeere we go.
$("#chained2").scrollable({hoverClass: 'hover'}).circular().navigator().mousewheel().autoscroll({
	steps: 1,
	interval: 9000		
});	
});
$(document).ready(function() {
 
// heeeeeeeeeeere we go.
$("#chained3").scrollable({hoverClass: 'hover'}).circular().navigator().mousewheel().autoscroll({
	steps: 1,
	interval: 5000		
});	
});

$(function() {      
		   // if the function argument is given to overlay,     
		   // it is assumed to be the onBeforeLoad event listener     
		   $("a[rel]").overlay({         
							   // some expose tweaks suitable for facebox-looking dialogs     
							   expose: {          
							   // you might also consider a "transparent" color for the mask         
							   color: '#fff',          
							   // load mask a little faster         
							   loadSpeed: 200,          
							   // highly transparent         
							   opacity: 0.5     
							   },        
							   effect: 'apple',          
							   onBeforeLoad: function() {              
							   // grab wrapper element inside content             
							   var wrap = this.getContent().find(".contentWrap");              
							   // load the page specified in the trigger             
							   wrap.load(this.getTrigger().attr("href"));         
							   }      
							   }); 
		   });


// execute your scripts when DOM is ready. this is a good habit 

 $(function() {                      
			// initialize scrollable      
			$("div.myscrollable").scrollable({         
										   vertical:true,          
										   size: 1              
										   // use mousewheel plugin    
										   }).mousewheel()
											.circular()
											.navigator()
											 .autoscroll({
									steps: 1,
									interval: 5000		
								});	
			}); 

//************************** SCRIPT PER VALIDAZIONE CAMPI REGISTRAZIONE UTENTE ******************

 function validate()
   {
	   if (document.dati.datnascita.value!="gg/mm/aaaa" && document.dati.datnascita.value!="" )
	   {  
	   	 var espressione = /^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/;
		 if (!espressione.test(document.dati.datnascita.value))
		 {	
			 alert("Formato data Sbagliato");
			 return false;
		 }		     
	   }
	   else
	   {		   
		   document.dati.datnascita.value=""
	   }
	   if (document.dati.OPE.value!="EDIT"){
			   if (document.dati.acconsenti.checked==false)
			   {  alert("Acconsentire al trattamento dei dati!");
				  return false;
			   }
	   }
	  
	 
	  if (document.dati.OPE.value!="EDIT"){
			  var StrPass=document.dati.pass.value;
			  var StrConfPass=document.dati.confpass.value;
			  
			  if (document.dati.pass.value=="")
			   {
				  alert("Inserire una password!");
				  
				  return false;
			   } else {
				  if (StrPass.length<8){
					  alert("La password deve essere lunga almeno 8 caratteri");
					  return false;
				  }else{
					  if (StrPass!=StrConfPass){
						  alert("Attenzione, la password di conferma non è uguale alla password inserite.");
						  return false;
					  }	  
				  }	   
			   
			   }
	  }else{
			   if (document.dati.oldpass.value!=""){
				   var StrPass=document.dati.pass.value;
			 	   var StrConfPass=document.dati.confpass.value;
				   
				   if (document.dati.pass.value=="")
					   {
						  alert("Inserire una password!");
						  
						  return false;
					   } else {
						  if (StrPass.length<8){
							  alert("La password deve essere lunga almeno 8 caratteri");
							  return false;
						  }else{
							  if (StrPass!=StrConfPass){
								  alert("Attenzione, la password di conferma non è uguale alla password inserite.");
								  return false;
							  }	  
						  }	   
					   
					   }
				   
			   }
	  }
		  
	  
	  
	   
	   if (document.dati.nome.value=="")
	   {
	      alert("Inserire il Nome!");
		  return false;
	   }	   
	   
	   
	   if (document.dati.cognome.value=="")
	   {
		   alert("Inserire il Cognome!");
		  return false;
	   }
	   if (document.dati.email.value=="")
	   {
		    alert("Inserire l\'\Email!");
		  return false;
	   }
	   else
	   {
		var espressione = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;	
				if (!espressione.test(document.dati.email.value))	{	    
					alert("La mail inserita non è valida!");	
					return false;
				}
		  
	   }
	   if (document.dati.stato.value=="0")
	   {
		    alert("Selezionare lo stato");
		  return false;
	   }
	    if (document.dati.comune.value=="0" && document.dati.stato.value=="Italia")
	   {
		    alert("Selezionare il comune di appartenenza");
		  return false;
	   }
	   if (document.dati.comune.value!="0" && document.dati.stato.value!="Italia")
	   {
		    alert("Impossibile selezionare un comune se lo stato scelto non è Italia");
		  return false;
	   }
	  
	
	  var Ini=0;
	  var Fin=document.dati.Cate.length-1;
	  var ESITO=false;
	
		while (Ini<=Fin && ESITO==false)
		  {			  
			 if (document.dati.Cate.item(Ini).checked==true)
			 {
					ESITO=true;	 
			 }else{
					Ini++;	 
		     }
			  
		  }
		 
		  if (ESITO==false) {
			alert("Selezionare almeno una categoria!") 
			return false;
		  }
	   return true;
   }
  
//***************************************************************************************

//************************** SCRIPT PER VALIDAZIONE CAMPI LOGIN UTENTE ******************
	function checkdati(from){
		
		if (document.dati.login.value==""){	
				  $("#errore").html("Inserire il nome utente.");			   	 
				  return false;			   
	    }else{
			var espressione = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;	
				if (!espressione.test(document.dati.login.value))	{	    
					$("#errore").html("Nome utente non valido.");	
					return false;
				}	
		}
		if (document.dati.password.value==""){			    
			   	  $("#errore").html("Inserire la password.");
				  return false;			   
	    }		
		$.post("checklogin.asp", { login: document.dati.login.value, password: document.dati.password.value },   
			   function(data){		
			  
			    
				   if (data=="OK"){
						if (from=="faq"){							
							$.post("faq_overlay.asp",{dati:"OK"},
							function(data){	
								$("#corpologin").html(data);	
							} );
						}
						if (from=="commento"){							
							$.post("commenti_overlay.asp",{dati:"OK"},
							function(data){	
								$("#corpologin").html(data);	
							} );
						}	
						if (from=="giudizio"){							
							$.post("giudizi_overlay.asp",{dati:"OK"},
							function(data){	
								$("#corpologin").html(data);	
							} );
						}
						if (from=="sondaggi"){							
							$.post("sondaggi_overlay.asp",{dati:"OK"},
								function(data){	
							   
								
								$("#corpologin").html(data);	
							} );
						}
				  }else{					  
					  $("#errore").html("Attenzione, login o password non corretti.");
				 	  return false;	
				  }
			   } );
		$('#errore').ajaxError(function() {
		  $(this).text("Errore");
		});
	}

//***************************************************************************************




//************************** SCRIPT PER VOTO SONDAGGIO******************
	function checkdatisondaggio(){
		
	
		
		$.post("votasondaggio.asp", { 	numerodomande: document.formSondaggi.numerodomande.value, 
									Suggerimento: document.formSondaggi.Suggerimento.value, 
									ID_sp: document.formSondaggi.ID_sp.value,
									ID_sondaggio: document.formSondaggi.ID_sondaggio.value,
									ID_sondaggiopadre: document.formSondaggi.ID_sondaggiopadre.value
									},   
			   function(data){				   		
			   		if (data=="OK"){
			   			
					}
			   } );
		$('#errore').ajaxError(function() {
										alert("errore")
		  $(this).text("Errore durante l'inserimento della F.A.Q");
		});
	}

//***************************************************************************************


//************************** SCRIPT PER VALIDAZIONE CAMPI FAQ ******************
	function checkdatifaq(){
		
		if (document.FormFaq.oggetto.value=="Oggetto - massimo 200 caratteri"){	
				  $("#errorefaq").html("Inserire l'oggetto.");			   	 
				  return false;			   
	    }
		if (document.FormFaq.testo.value=="Testo della domanda"){			    
			   	  $("#errorefaq").html("Inserire il testo della domanda.");
				  return false;			   
	    }
		
		$.post("insertfaq.asp", { 	oggetto: document.FormFaq.oggetto.value, 
									testo: document.FormFaq.testo.value, 
									IDpub: document.FormFaq.IDpub.value,
									IDuff: document.FormFaq.IDuff.value,
									Nome: document.FormFaq.Nome.value,
									Cognome: document.FormFaq.Cognome.value,
									Email: document.FormFaq.Email.value },   
			   function(data){				   		
			   		if (data=="OK"){
			   			$("#corpologin").html("<div id='conferma' class='Arial16' style='margin-top:160px; margin-left:160px; color:#060; font-weight:bold;' >Inserimento avvenuto con successo</div>");
					}
			   } );
		$('#errorefaq').ajaxError(function() {
		  $(this).text("Errore durante l'inserimento della F.A.Q");
		});
	}

//***************************************************************************************

//************************** SCRIPT PER VALIDAZIONE CAMPI COMMENTO ******************
	function checkdaticommenti(){
		
		if (document.FormCommento.testo.value=="Testo del commento"){			    
			   	  $("#errorefaq").html("Inserire il testo del commento.");
				  return false;			   
	    }
		
		$.post("insertcommento.asp", { 	 
										testo: document.FormCommento.testo.value, 
										IDpub: document.FormCommento.IDpub.value,
										IDUtente: document.FormCommento.IDUtente.value
									},   
			   function(data){				   		
			   		if (data=="OK"){
			   			$("#corpologin").html("<div id='conferma' class='Arial16' style='margin-top:160px; margin-left:160px; color:#060; font-weight:bold;' >Inserimento avvenuto con successo</div>");
					}
			   } );
		$('#errorefaq').ajaxError(function() {
		  $(this).text("Errore durante l'inserimento del commento");
		});
	}

//***************************************************************************************

//************************** SCRIPT PER VALIDAZIONE CAMPI GIUDIZIO ******************
	function checkdatigiudizi(){
		
		if (document.FormGiudizio.NumStar.value=="0"){			    
			   	  $("#errorefaq").html("Inserire giudizio.");
				  return false;			   
	    }
		
		$.post("insertgiudizio.asp", { 	 
										NumStar: document.FormGiudizio.NumStar.value, 
										IDpub: document.FormGiudizio.IDpub.value,
										IDUtente: document.FormGiudizio.IDUtente.value
									},   
			   function(data){				   		
			   		if (data=="OK"){
			   			$("#corpologin").html("<div id='conferma' class='Arial16' style='margin-top:160px; margin-left:160px; color:#060; font-weight:bold;' >Inserimento avvenuto con successo</div>");
					}
			   } );
		$('#errorefaq').ajaxError(function() {
		  $(this).text("Errore durante l'inserimento del giudizio");
		});
	}

//***************************************************************************************

//************************** SCRIPT PER VALIDAZIONE LOGIN ******************

function checkdatilogin(){
		
		if (document.dati.login.value==""){	
				  $("#errore").html("Inserire il nome utente.");			   	 
				  return false;			   
	    }else{
			var espressione = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;	
				if (!espressione.test(document.dati.login.value))	{	    
					$("#errore").html("Nome utente non valido.");	
					return false;
				}	
		}
		if (document.dati.password.value==""){			    
			   	  $("#errore").html("Inserire la password.");
				  return false;			   
	    }
		document.dati.submit();
}
//****************************************************************************
//******************* FUNZIONE ROLLOVER STELLE GIUDIZI *************************
function addstar(id) {
            if (document.getElementById("NumStar").value == id) {
                document.getElementById("Star1").style.background = "url(images/emptystar.png)";
                document.getElementById("Star2").style.background = "url(images/emptystar.png)";
                document.getElementById("Star3").style.background = "url(images/emptystar.png)";
                /*document.getElementById("Star4").style.background = "url(images/emptystar.png)";
                document.getElementById("Star5").style.background = "url(images/emptystar.png)";*/
                document.getElementById("NumStar").value = 0;
            }else{
                switch (id) {
                    case 1:
                        document.getElementById("Star1").style.background = "url(images/star.png)";
                        document.getElementById("Star2").style.background = "url(images/emptystar.png)";
                        document.getElementById("Star3").style.background = "url(images/emptystar.png)";
                      /*  document.getElementById("Star4").style.background = "url(images/emptystar.png)";
                        document.getElementById("Star5").style.background = "url(images/emptystar.png)";*/
                        break
                    case 2:
                        document.getElementById("Star1").style.background = "url(images/star.png)";
                        document.getElementById("Star2").style.background = "url(images/star.png)";
                        document.getElementById("Star3").style.background = "url(images/emptystar.png)";
                       /* document.getElementById("Star4").style.background = "url(images/emptystar.png)";
                        document.getElementById("Star5").style.background = "url(images/emptystar.png)";*/
                        break
                    case 3:
                        document.getElementById("Star1").style.background = "url(images/star.png)";
                        document.getElementById("Star2").style.background = "url(images/star.png)";
                        document.getElementById("Star3").style.background = "url(images/star.png)";
                       /* document.getElementById("Star4").style.background = "url(images/emptystar.png)";
                        document.getElementById("Star5").style.background = "url(images/emptystar.png)";*/
                        break
                    /*case 4:
                        document.getElementById("Star1").style.background = "url(images/star.png)";
                        document.getElementById("Star2").style.background = "url(images/star.png)";
                        document.getElementById("Star3").style.background = "url(images/star.png)";
                        document.getElementById("Star4").style.background = "url(images/star.png)";
                        document.getElementById("Star5").style.background = "url(images/emptystar.png)";
                        break
                    case 5:
                        document.getElementById("Star1").style.background = "url(images/star.png)";
                        document.getElementById("Star2").style.background = "url(images/star.png)";
                        document.getElementById("Star3").style.background = "url(images/star.png)";
                        document.getElementById("Star4").style.background = "url(images/star.png)";
                        document.getElementById("Star5").style.background = "url(images/star.png)";
                        break*/
                }
                document.getElementById("NumStar").value = id;
            }
        }
//***********************************************************************************************************

var TestoLink = "<a href='elenco_pubblicazioni.asp?param=40,0,137,0,0,0'>Tutti gli gli eventi a Cannobio</a> "
