function loadAjaxContent(languageId) {
	urlPath = $.url.attr("path").toString();

	if (urlPath == '/') {
		urlPath = '/index.html';
	}

	contentPath = $.url.attr("protocol") + "://" + $.url.attr("host") + "/translations/" + languageId + urlPath;
	//Debug
	//prompt("contentPath", contentPath);
	$("#contentLeft").load( contentPath + " #contentLeft *");
	$("#otherTitle").load(contentPath + " #otherTitle *");
	$.cookie('canterbury-cathedral.org-translationpreferences', 'lang=' + languageId, {path: '/', domain: 'canterbury-cathedral.org'});

	if ($('#translationBarID').length) {
		$('#translationBarID').html('<img src="/assets/templates/cathedralClean/media/images/layout/lang-' + languageId + '.png" title="Language Flag" alt="Language Flag"/><p>This page has been translated, reset to <a href="' + $.url.attr("path") +'" onclick="resetLanguage();">English?</a></p>')
//
	} else {
		$('body').append('<div id="translationBarID" class="translationBar"> <img src="/assets/templates/cathedralClean/media/images/layout/lang-' + languageId + '.png" title="Language Flag" alt="Language Flag"/><p>This page has been translated, reset to <a href="' + $.url.attr("path") +'" onclick="resetLanguage();">English?</a></p></div>');

		}
	if ($('.translationIconDisplay').length) {
		$('.translationIconDisplay').attr("src",'/assets/templates/cathedralClean/media/images/layout/langsmall-' + languageId + '.png');
	} else {
		$('.showTranslationIcon').append('<img src="/assets/templates/cathedralClean/media/images/layout/langsmall-' + languageId + '.png" title="Language Flag" alt="Language Flag" class="translationIconDisplay"/>');

	}
return false;
};

function loadLanguageAutomatically() {
currentCookie = $.cookie('canterbury-cathedral.org-translationpreferences');
//alert(currentCookie);
//alert(currentCookie.split('=')[0]);
//alert(currentCookie.split('=')[1]);

if (currentCookie == null) {
	$.cookie('canterbury-cathedral.org-translationpreferences', 'none', {path: '/', domain: 'canterbury-cathedral.org'});

} else {

if (currentCookie != "none") {
	//Debug
	//alert("We Are currently testing the translations, please be patient, to view this page correctly please delete your cookies");
	if (currentCookie.split("=")[0] == 'lang') {
		loadAjaxContent(currentCookie.split('=')[1]);

	}
}
}
}

function resetLanguage() {
$.cookie('canterbury-cathedral.org-translationpreferences', 'none', {path: '/', domain: 'canterbury-cathedral.org'});
return false;
}

