<?php
define('IS_ADMIN', true);
require_once(dirname(__FILE__)."/../../include/init.php");
$language =& GetLanguage();
$request = new LocalObject(array_merge($_GET, $_POST));
if ($request->GetProperty('Module'))
	$translation = $language->LoadForJS($request->GetProperty('Module'));
else
	$translation = $language->LoadForJS();
$expire = mktime(0, 0, 0, date("m")+COOKIE_EXPIRE, date("d"), date("Y"));
$expireDate = date("Y", $expire).", ".date("n", $expire).", ".date("j", $expire);
?>
function GetTranslation(key)
{
	switch (key)
	{
<?php
		foreach ($translation as $key => $value)
		{
?>
		case "<?php echo $key; ?>": return "<?php echo htmlspecialchars(addcslashes($value, "\r\n'\\")); ?>";
<?php
		}
?>
		default: return key;
	}
}

function changeDLang(languageCode)
{
	var d = new Date(<?php echo $expireDate ?>);
	document.cookie =  "DLangCode=" + escape(languageCode) + "; expires=" + d.toUTCString() + "; path=<?php echo PROJECT_PATH; ?>;";
	document.location.href = document.location.href;
}
