/*
 * Localization
 */
function __(word)
{
	var locale = getLocale();

	if (word != '')
	{
		if (locale == 'es')
			return esDictionary(word);
		else return word;
	}	
}

function image_url(image_name)
{
	var locale = getLocale();
	var imagesServer;
	var pathToImage;
	
	//locale = locale != 'es/' ? '' : locale;
	if (location.host == 'www.piquo')
		imagesServer = 'http://www.piquo/gr/';
	else
		imagesServer = 'http://images.piquo.com/';
	
	pathToImage = imagesServer + image_name;

	return pathToImage;
		
}

function getLocale()
{
	return getCookie('piquo_loc');
}

function getCookie(name)
{
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset);
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

function esDictionary(word)
{
	var dictHash = {		
		'Stop following this user?': 'Dejar de seguir este usuario',
		'Please, select messages': 'Por favor, seleccione Mensajes',
		'You are not longer following this user' : 'No son más largos después de este usuario',
		'CLOSE' : 'CERRAR',
		'NEWER' : 'NUEVOS',
		'OLDER' : 'MAYORES'
	};

	if (!dictHash[word])
		return word;
	else
		return dictHash[word];
}
