// JavaScript Document
function getWholeCookie(offset) {
	var endstr = document.cookie.indexOf (';', offset)
	if (endstr ==-1) {
		endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset,endstr));
}

function getCookie(name) {
	var arg = name + '=';
	var argLength = arg.length;
	var cookieLength = document.cookie.length;
	var i = 0;
	while (i < cookieLength) {
		var j = i + argLength;
		if (document.cookie.substring(i,j) == arg) {
			return getWholeCookie(j);
		}
		i = document.cookie.indexOf(' ',i) + 1;
		if (i==0) break;
	}
	return '';
}


function setCookie(name,value,expires,path) {
var today = new Date();
today.setTime( today.getTime() );

if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" );
}


function tossCookie( name, path, domain ) {
if ( getCookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}


function getDataCookie(cookiename) {
	var data = '';
	if (navigator.cookieEnabled) data = getCookie(cookiename);
	if (data == '') data = 'fantasy';
	return data;
}
function changeStyle(newStyle) {
	if (navigator.cookieEnabled) {
	setCookie('styleName',newStyle,31,'/');
	location.href = self.location;
	}
	else alert ('Vous avez besoin d\'activer javascript pour profiter pleinement du site');
}

function lien(nom,src) {	
	document.images[nom].src=src;}