function trim(stringa){
	while (stringa.substring(0,1) == ' '){
		stringa = stringa.substring(1, stringa.length);
	}
	while (stringa.substring(stringa.length-1, stringa.length) == ' '){
		stringa = stringa.substring(0,stringa.length-1);
	}
	return stringa;
}

// ------------------------------------------------------------
function setSH() {

	var myElements = ".btSh";

	$(myElements).each(function(i) {

		$(this).click(function() {

			if($(this).next('div').css('display') == 'none')
				$(this).next('div').show('slow');
			else
				$(this).next('div').hide('slow');
		});
	});
}
// -------------------------------------------------------------------------

function setCittaFrmContatto(pProv) {
	$('.codComuneTmp').addClass('nascosto');
	$('#citta').addClass('nascosto');
	$('#codComune'+pProv).removeClass('nascosto');
	$('#nazione').attr('value','Italia');

	if(pProv == 'NOT ITALY' || pProv == '-1') {
		$('.codComuneTmp').addClass('nascosto');
		$('#citta').removeClass('nascosto');
		$('#nazione').attr('value','-1');
	}
}

// -------------------------------------------------------------------------

function setCampiNewsletter() {
	$('#nomeNewsletter').focus(function() {
		if($(this).val() == 'Inserisci il tuo nome') {
			$(this).val('');
		}
	});
	$('#nomeNewsletter').blur(function() {
		if($(this).val() == '') {
			$(this).val('Inserisci il tuo nome');
		}
	});

	$('#emailNewsletter').focus(function() {
		if($(this).val() == 'Inserisci la tua email') {
			$(this).val('');
		}
	});
	$('#emailNewsletter').blur(function() {
		if($(this).val() == '') {
			$(this).val('Inserisci la tua email');
		}
	});


}

// -------------------------------------------------------------------------

$(document).ready(function(){
	setSH();

	setCampiNewsletter();

	fleXenv.initByClass("riqScrollH_int");

	$("a.gallery").colorbox({slideshow:true,height:"90%"});

	effectsDemo2 = 'fade';
	var demoSlider_2 = Sliderman.slider({container: 'SliderName_2', width: 587, height: 325, effects: effectsDemo2,
		display: {
			autoplay: 5000,
			loading: {background: '#000000', opacity: 0.5, image: 'img/loading.gif'},
			description: { background: '#ffffff', opacity: 0.4, height: 25, position: 'bottom'},
		}
	});
});



