﻿$(document).ready(function(){	
	$('a[rel="external"]').click( function() {
		window.open( $(this).attr('href') );
		return false;
	});
	$('.vid').colorbox({iframe:true, innerWidth:425, innerHeight:344, close:"Fermer"});
	$('#gallery a').colorbox({close:"Fermer", next:"suivante", previous:"précédente"});
	$("a[rel='3m4il']").each(function(){
		var spaceShip = $(this).text();
		var spaceStation = $(this).attr('title');
		
		$(this).attr({
			href: 'mailto:'+ spaceShip +'@'+ spaceStation +'',
			rel: 'nofollow'
		});
	
		$(this).text(''+ spaceShip +'@'+ spaceStation +'');
	});
});

// Simuler un target=_blank
$.fn.addTargetBlank = function() {
   $(this).bind('click',function(){
		window.open(this.href);
		return false;
	});
};

// vide / remplit un élément on focus / blur
var originalValue = new Array;
$.fn.emptyField = function() {
	val = $(this).val();
	
	if(!originalValue[$(this).attr('id')]) {
		originalValue[$(this).attr('id')] = val;
	}
	
	if(val == originalValue[$(this).attr('id')]) {
		$(this).val('');
	}
	
	$(this).blur(function(){
		if($(this).val() == "") {
			$(this).val(originalValue[$(this).attr('id')]);
		}
	});
}










