$(document).ready(function() {

	// Gestione target blank links con doctype strict
	// This is how it works:
	// <a href="http://www.tripwiremagazine.com/" rel="external">tripwiremagazine.com</a>
	$('a[rel="external"]').click(function(){
		this.target = "_blank";
	});

	// gestione IMG HOVER
	$(".mHover").each(function() {
		var src = $(this).attr('src');
		var extension = src.substring(src.lastIndexOf('.'), src.length);
		$(this).mouseover(function() {
			$(this).attr('src', src.replace(extension,'-on' + extension));
		}).mouseout(function() {
			$(this).attr('src', src);
		});
	});

});

function getContent(element, id, tipo)
{
	if(element) {
		$('.colonne ul li').each(function(index) {
			$(this).removeClass('active');
			$(this).children('img').css('opacity', '0.4');
		});
		$(element).addClass('active');
		$(element).parent('ul').parent('li').addClass('active');
	}

	$.ajax({
		url: '/ajax/?id='+id+'&tipo='+tipo,
		cache: true,
		async: true,
		global: true,
		type: 'GET',
		data: null,
		success: function(html){
			$('#gallery').html(html);
		}
	});
}
