hideNews = function(){
	$('TopNews').hide();
	document.cookie = 'hideNews=true; path=/';
}

fb_sharer = function() {
	u=location.href;
	t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

Subscribe = function(){
	new Ajax.Request('/ajax/NewsLetter.php?T' + Math.random(), {
			asynchronous: true,
			method      : 'post',
			parameters  : $('Subscriber').serialize(),
			onLoading   : function(rq){$('form_results').hide();$('form_wait').show();},
			onComplete  : function(rq){$('form_wait').hide();$('form_results').show();},
			onFailure   : function(rq){alert('Errore ' + rq.status + ' -- ' + rq.statusText);},
			onSuccess   : function(rq){
							if(!rq.responseText.isJSON()){alert('JSON: NOT A JSON RESPONSE.');return false;}
							var obj = rq.responseText.evalJSON();
							alert(obj.ResultDesc);
							$('NL_FName').value='';
							$('NL_LName').value='';
							$('NL_Email').value='';
						}
		}
	);
	return false;
}

sceltaComagnia = function(val){
	var optID = 'AUD' + val;
	$('etCompagnia').hide();
	$('divCompagnia1').hide();
	$('divCompagnia2').hide();
	$('divCompagnia3').hide();
	
	if($(optID).hasClassName('compagnia1')) {$('etCompagnia').show();$('divCompagnia1').show(); $('inpCompagnia1').checked=true;}
	if($(optID).hasClassName('compagnia2')) {$('etCompagnia').show();$('divCompagnia2').show(); $('inpCompagnia2').checked=true;}
	if($(optID).hasClassName('compagnia3')) {$('etCompagnia').show();$('divCompagnia3').show();$('divCompagnia2').show();$('divCompagnia1').show();}
}





$j(document).ready(function(){
	// CORREZIONE BG NERO NELLE IMAGINI LINKS
	$$('#wBody a img').each(function(e){var i = e.up();i.setStyle({backgroundColor: 'transparent'});}); 
	
	// SLIDESHOW IN HOME
	$j('ul.slideshow-content').cycle();
	
	// NEWS IN HEADER
	if($("TopNews")) Effect.Appear("TopNews");
	
	$j.changeVideo = function(videoid, elm){
		var w = 480;
		var h = 270;
		var html = '';

		html += '<object width="' + w +'" height="' + h +'"> \n';
		html += '	<param name="movie" value="http://www.youtube.com/v/' + videoid +'?version=3&amp;autohide=1&amp;showinfo=0&amp;autoplay=1&showsearch=0&iv_load_policy=3&cc_load_policy=1"></param> \n';
		html += '	<param name="allowScriptAccess" value="always"></param> \n';
		html += '	<param name="allowFullScreen" value="true"></param> \n';
		html += '	<embed \n';
		html += '		src="http://www.youtube.com/v/' + videoid +'?version=3&autohide=1&showinfo=0&amp;autoplay=1&showsearch=0&iv_load_policy=3&cc_load_policy=1" \n';
		html += '		type="application/x-shockwave-flash" \n';
		html += '		allowscriptaccess="always" \n';
		html += '		allowFullScreen="true" \n';
		html += '		width="' + w +'" \n';
		html += '		height="' + h +'"> \n';
		html += '	</embed> \n';
		html += '</object> \n';

		$j('#flashVideo').fadeOut('slow', function() {
			$j(this).html(html).hide();
			$j('#listVideo ul li a').each(function() {
				if ($j(this).hasClass('active'))
					$j(this).removeClass('active');
			});
			elm.addClass('active');
			$j(this).fadeIn();
		});
	}
	
});

