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

		// Set Cookie
		function setCookie(name,value,expiredays){
			var exdate=new Date();
			exdate.setDate(exdate.getDate()+expiredays);
			document.cookie=name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+";path=/;domains=";
		}
		
		function getCookie(c_name){
			if (document.cookie.length>0){
			  c_start=document.cookie.indexOf(c_name + "=");
				  if (c_start!=-1){ 
				    c_start=c_start + c_name.length+1; 
				    c_end=document.cookie.indexOf(";",c_start);
				    if (c_end==-1) c_end=document.cookie.length;
				    return unescape(document.cookie.substring(c_start,c_end));
			    } 
			}
		return "";
		}

		// Animate the Click-To-French bar that replace the previous Front-Page ( http://ariannerelocation.dreamhosters.com/wp3/ )
		if ($('body.page-id-17 #clickFr').length != 0) {
			$("#clickFr").animate({top: "0"},{duration:2500}).delay(4000).animate({top: "-60px"},{duration:2500});
			$("#topMenu .langSwitch a").animate({opacity: "1"},{duration:2500}).delay(6000).animate({opacity: ""},{duration:250});
		};

		// Add class on links
		$("a[href$=pdf]").addClass("pdf").attr("target","pdf");
		
		// Wrap the alias within the mailto link tag
		$("a[rel='3m4il']").each(function(){
			var spaceShip = $(this).text();
			var spaceStation = $(this).attr('href');
			
			$(this).attr({
				href: 'mailto:'+ spaceShip +'@'+ spaceStation +'',
				rel: 'nofollow'
			});
			$(this).text(''+ spaceShip +'@'+ spaceStation +'');
		});

		/* Lightbox set-up
		$('a[rel*=lightbox]').colorbox();
		$('a[rel*=lightboxAlone]').colorbox({iframe:true, innerWidth:500, innerHeight:500});
		*/

		// Add class to all unordered list for maximum CSS compatibility
		if ($('ul').length != 0) {
			$('li:first').addClass('first-child');
			$('li:last').addClass('last-child');
		};
	
	});

});

