




/*// BROWSER UPDATE ////////////////////////////////////////////////////////////////////////////////////*/
$(document).ready(function(){	/* Lo script viene eseguito solo quando la pagina è stata caricata completamente */

	if($.browser.msie && $.browser.version<'7.0')	/* Se è internet explorer v.6 o inferiore */
		$('#browser_update','html body')
			.fadeIn('slow')						/* fai comparire la barra */

	$('#browser_update_close','html body #browser_update').click(function(){	/* Se l'utente clicca sul tasto di chiusura */
		$('#browser_update','html body')							/* La barra */
			.fadeOut('slow')										/* e ritorna invisibile */
	})

	/* E' più pratico far aprire la pagina di download in un'altra finestra,
	   ma dato che l'attributo target non è più considerato valido dal w3c
	   è meglio impostarlo via javascript */
	$('.browser_download','html body #browser_update').attr('target','_blank')
})






/*// APRI POPUP ////////////////////////////////////////////////////////////////////////////////////*/
var pagina=null;
function apriPopup(url,w,h){
	x=screen.width/2-w/2;
	y=screen.height/2-h/2;
	if (pagina != null)
		pagina.close();
	pagina=window.open(url,"","fullscreen=no,status=no,toolbar=no,scrollbars=yes,width="+w+",height="+h+",top="+y+",left="+x);
}





/*// CONTROLLO EMAIL ////////////////////////////////////////////////////////////////////////////////////*/
var whitespace = " \t\n\r";
function isEmail (s)
{
	if (isEmpty(s)) 
	   if (isEmail.arguments.length == 1) return defaultEmptyOK;
	   else return (isEmail.arguments[1] == true);
	if (isWhitespace(s)) return false;
	var i = 1;
	var sLength = s.length;
	while ((i < sLength) && (s.charAt(i) != "@")){ 
		i++
	}
	if ((i >= sLength) || (s.charAt(i) != "@")) return false;
	else i += 2;
	while ((i < sLength) && (s.charAt(i) != ".")){ 
		i++
	}
	if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
	else return true;
}
function isEmpty(s){
	return ((s == null) || (s.length == 0))
}
function isWhitespace (s){
	var i;
	if (isEmpty(s)) return true;
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	}
	return true;
}





/*// ANTI-SPAM ////////////////////////////////////////////////////////////////////////////////////*/
function DisplayMail(Server, Login, Display){
if ((Display.length == 0) || (Display.indexOf('@')+1)) {
document.write("<a href=" + "'mai" + "lto:" + Login + "@" + Server + "'>" + Login + "@" + Server + "</a>"); }
else {
document.write("<a href=" + "'mai" + "lto:" + Login + "@" + Server + "'>" + Display + "</a>"); }
}




/*// CAMPI FORM ////////////////////////////////////////////////////////////////////////////////////*/
	$(document).ready(function(){
		
		// REPLACE SELECT
		$("select").change(function () {
			var str_select_option = "";
			$(this).find("option:selected").each(function () {
				str_select_option += $(this).text() + " ";
			});
			$(this).prev("span.select_replace").text(str_select_option);
		})
		.change();
		$("select").keyup(function () {
			var str_select_option = "";
			$(this).find("option:selected").each(function () {
				str_select_option += $(this).text() + " ";
			});
			$(this).prev("span.select_replace").text(str_select_option);
		});
		$("select").focus(function () {
			$(this).prev("span.select_replace").addClass("selected");
		});
		$("select").blur(function () {
			$(this).prev("span.select_replace").removeClass("selected");
		});
		
		// REPLACE INPUT FILE
		$("input[type='file']").change(function () {
			var str_inputfile = $(this).val();
			var tmp = str_inputfile.split("\\");
			$(this).prev("span.inputfile_replace").text(tmp[tmp.length-1]);
		})
		.change();
		
		// FOCUS INPUT NEWSLETTER
		var tmp_value_input_cerca;
		$("#field_newsletter_email").focus(function(){tmp_value_input_cerca = $(this).val();$(this).val("");});
		$("#field_newsletter_email").blur(function(){if ($(this).val()==""){$(this).val(tmp_value_input_cerca);}});
		
	});
	
	
	
	
	
/*// EFFETTO ROLLOVER BOX HOME ////////////////////////////////////////////////////////////////////////////////////*/
	$(document).ready(function(){
			var tmp_size =$(".fx_box_hover a").find("span").innerWidth();
			$(".fx_box_hover a").find("span").css("margin-left",-+tmp_size);
			$(".fx_box_hover a:not(.attivo)").hover(function() {
					//$(this).find("span").show();
					$(this).find("span").stop().animate({
						marginLeft: 0
					}, 300);
					$(this).find("img").stop().animate({
						opacity: 0.30
					}, 200);
				},function() {
					//$(this).find("span").hide();
					$(this).find("span").stop().animate({
						marginLeft: -+tmp_size
					}, 300);
					$(this).find("img").stop().animate({
						opacity: 1.00
					}, 200);
				});
	});
/*// CLEAR FORM  ///////////////////////////////////////////////////////////////////////*/

<!--
function clearForm() {
	document.newsletter.campo_newsletter.value = "";
}
//-->
