var ie6 = false;
$(function() {
	bindSizeSwitcher();
});

function newsletterSignUp() {

	$.ajax( {
		type : "POST",
		url : "/newsletter/",
		dataType : "jsondata",
		success : function(response) {
			eval('myjson =' + response + ';');
			if (myjson.stat == "Success") {
				$("#post_error_news").html(myjson.data)
			} else {
				location.href = '/login/';
			}
		}
	});
}

function changeLanguage(lang) {
	cUrl = location.href.replace('#', '');
	var formval = {
		"lan" : lang
	};
	$.ajax( {
		type : "POST",
		data : formval,
		url : "/language",
		dataType : "jsondata",
		success : function(response) {
			eval('myjson =' + response + ';');
			if (myjson.stat == "Success") {
				location.href = cUrl;
			}
		}
	});
}

function changeFontsize(objId) {
	size = $('#' + objId + '').attr("rel");
	cUrl = location.href.replace('#', '');
	var formval = {
		"fsize" : size
	};
	$.ajax( {
		type : "POST",
		data : formval,
		url : "/index/fontsizeswitcher",
		dataType : "jsondata",
		success : function(response) {
			eval('myjson =' + response + ';');
			if (myjson.stat == "Success") {
				$("#current-size").attr("rel", size);
				var a = $("#current-size").attr("rel");
				$("body").css("font-size", a);
				bindSizeSwitcher();
				// location.href = cUrl;
	}
}
	});
}

function bindSizeSwitcher() {
	var a = $("#current-size").attr("rel");
	$("body").css("font-size", a);
	$("#current-size").click(function() {
		$("#available-languages").hide();
		if (!($("#available-sizes").css("display") == "block")) {
			var b = $(this).position();
			$("#available-sizes").css( {
				width : $("#current-size").width() + 12,
				left : b.left - 5,
				top : b.top - 3
			});
			$("#available-sizes").show("blind")
		}
		$("body").bind("click", function() {
			$("#available-sizes").hide();
			$("body").unbind("click");
		});
		return false;
	});
}

