function setlanguage(lang){
	var expirationDate = 1000*60*60*24*365;
	setCookie('fbllc',lang,expirationDate,'/');
}

function setCookie( cookieName, cookieValue, lifeTime, path, domain, isSecure ) {

	if( !cookieName ) { return false; }
	if( lifeTime == "delete" ) { lifeTime = -10; } //this is in the past. Expires immediately.
	/* This next line sets the cookie but does not overwrite other cookies.
	syntax: cookieName=cookieValue[;expires=dataAsString[;path=pathAsString[;domain=domainAsString[;secure]]]]
	Because of the way that document.cookie behaves, writing this here is equivalent to writing
	document.cookie = whatIAmWritingNow + "; " + document.cookie; */
	document.cookie = escape( cookieName ) + "=" + escape( cookieValue ) +
		( lifeTime ? ";expires=" + ( new Date( ( new Date() ).getTime() + ( 1000 * lifeTime ) ) ).toGMTString() : "" ) +
		( path ? ";path=" + path : "") + ( domain ? ";domain=" + domain : "") + 
		( isSecure ? ";secure" : "");
	//check if the cookie has been set/deleted as required
	if( lifeTime < 0 ) { if( typeof( retrieveCookie( cookieName ) ) == "string" ) { return false; } return true; }
	if( typeof( retrieveCookie( cookieName ) ) == "string" ) { return true; } return false;
}

function retrieveCookie( cookieName ) {

	/* retrieved in the format
	cookieName4=value; cookieName3=value; cookieName2=value; cookieName1=value
	only cookies for this domain and path will be retrieved */
	var cookieJar = document.cookie.split( "; " );
	for( var x = 0; x < cookieJar.length; x++ ) {
		var oneCookie = cookieJar[x].split( "=" );
		if( oneCookie[0] == escape( cookieName ) ) { return unescape( oneCookie[1] ); }
	}
	return null;
}

function getLanguage(){
	var cookieLang = retrieveCookie('fbllc');
	if(cookieLang==null){return "fr";}else return cookieLang;
	//	if(cookieLang.toLowerCase()=='fr')return 'fr';
	//	if(cookieLang.toLowerCase()=='en')return "en";
	//	if(cookieLang.toLowerCase()=='de')return "de";
	//	if(cookieLang.toLowerCase()=='nl')return "nl";
	//}
	// default language will be english
	
}
