
$(document).ready(function(){
	
	// Gestione pop-up delle schede di progetto negli elenchi di progetto.
	$(".project_item a, a.netProject").each(function(){
		
		var href = $(this).attr('href');
		href = href + '?&modalWin=trueiframe=true&width=815&height=480';
		
		//alert(href);
		
		$(this)
			.attr('href', href )
			//.attr('rel','prettyPhoto[iframes]')
			.prettyPhoto({f:''
				,theme: 'light_square'
				,hideflash: true
				,padding:1
				,changepicturecallback:function(){
					
					$('.pp_nav').hide();
					$('.pp_description').hide();
					$('.pp_close').css('position', 'absolute').css('left','735px');
					
					$('.pp_content').parent().css('overflow','hidden');
					
					$('#pp_full_res').css('height','480px').css('overflow','hidden');
					
					$('#pp_full_res iframe').css('height','480px');
					
				}
			})
		;
	});
	
	$("form").keypress(function(e) {
		if (e.which == 13) {
			return false;
		}
	});
	
	/*
	$('.project_item').each(function(){
		
		$(this).attr('style','position:relative;overflow:hidden;');
		
		$(this).append('<span class="clicker"></span>');
		var cl = $(this).find('.clicker');
		cl
			.css('position','absolute')
			.css('top','0')
			.css('left','0')
			.css('display','block')
			.css('width','100%')
			.css('height','600px')
			.css('background-image','url(none.png)')
			.css('cursor','pointer')
			.bind('click',function(){ $(this).parent().find('h3 a').click(); })
	
	});
	*/
	
	
	
	/*
	$(".project_item .link a, .project_item h2 a, .project_item h3 a, .project_item .img a").bind('click',function(){
		
		var url 		= $(this).attr('href');
		var title		= $(this).attr('title');
		var projectId 	= $(this).parent().parent().attr('id');
		var winId		= 'PWin';
		var winObj		= '#'+winId;
		
		$(winObj).remove();
		$('body').append('<div id="'+winId+'"><iframe src="'+url+'?modalWin=true" scrolling="no"></iframe></div>');
		
		$(winObj).dialog({
			title:		title,
			width:		'815px',
			height:		'480',
			resizable:	false,
			draggable:	false,
			modal:		true,
			open:		function(){ __hideFlash(); },
			close:		function() { __showFlash(); }
		});
		
		return false;
	});
	*/
	
	
	
	// Apre in nuova finestra il link all'approfondimento della scheda di progetto.
	$('.project-details a').attr('target','_blank');
	
	
	$('#ft>ul:first li:first').addClass('first');
	
	// Tutti i link-logo del footer si aprono in una nuova finestra.
	$('#ft-logo a').attr('target','_blank');
	
});


/**
 * Visualizza/nasconde il flash per la visualizzazione in explorer.
 */
function __hideFlash() {
	$('#flash-menu').hide();
}
function __showFlash() {
	$('#flash-menu').show();
}